Search Results for

    Show / Hide Table of Contents

    Class model::Poly

    Poly Model.

    Defines an Ising model with polynomial cost function. The cost function can be defined via recursive nesting of terms of the form: term_i = c_i p_i (\sum_j term_j) ^ e_i

    • or -

    term_i = c_i p_i \prod_j s_j where c_i is a numeric constant p_i is a parameter (which can be changed during the simulation) e_i is an integer exponent s_i is an Ising spin

    Note

    The limitation to Ising spins and products only in non-leaf of such spins is deliberate (this avoids needing to track the number of zeros in products). See Poly::configure() for the input format definition.

    Inheritance
    markov::Model
    model::Poly
    Inherited Members
    get_benchmark_properties
    estimate_max_cost_diff
    has_initial_configuration
    Model
    state_only_memory_estimate
    get_term_count
    get_sweep_size
    init
    get_initial_configuration_state
    render_state
    calculate_cost
    apply_transition
    estimate_min_cost_diff
    get_scale_factor
    is_empty
    set_step_limit
    is_rescaled
    state_memory_estimate
    rescale
    render
    calculate_cost_difference
    get_random_transition
    get_const_cost
    configure
    match_version
    ~BaseModel
    configure
    BaseModel
    render
    ~Component
    Component
    get_status
    param
    get_class_name

    Methods

    get_identifier()

    Returns the identifier string of the model type (e.g., "ising").

    Declaration
    std::string model::Poly::get_identifier() const override

    get_version()

    Returns the version of the input format this implementation expects.

    Declaration
    std::string model::Poly::get_version() const override

    get_const_cost()

    Declaration
    double model::Poly::get_const_cost() const override

    is_empty()

    Declaration
    bool model::Poly::is_empty() const override

    create_state()

    Create a state with specific spin and parameter values.

    Parameters: spins array of initial spin values {-1, 1} parameters array of initial parameter values (defaults to all-1). Returns: An initialized state with intermediate term values populated.

    Declaration
    PolyState model::Poly::create_state(std::vector<int>spins, std::vector<double>parameters={}) const

    get_random_state()

    Create a random state.

    This fill the state with random spin values {-1, +1} and all parameters set to 1.0.

    Declaration
    PolyState model::Poly::get_random_state(utils::RandomGenerator&rng) const override

    create_spin_flip()

    Create a specific spin flip.

    This returns a transition which spins flip spin_id.

    Declaration
    PolyTransition model::Poly::create_spin_flip(size_t spin_id) const

    create_parameter_change()

    Create a parameter change.

    This returns a transition which substitutes the model parameters.

    Declaration
    PolyTransition model::Poly::create_parameter_change(const std::vector<double>values) const

    get_random_transition()

    Return a random spin flip.

    The default markov transition for Poly is a random spin flip. create_parameter_change to manually create a parameter transition.

    Declaration
    PolyTransition model::Poly::get_random_transition(const PolyState&state, utils::RandomGenerator&rng) const override

    calculate_cost()

    Get the full cost function.

    We can entirely rely on the root term's intermediate value.

    Declaration
    double model::Poly::calculate_cost(const PolyState&state) const override

    calculate_cost_difference()

    Calculate the cost difference for a transition.

    Declaration
    double model::Poly::calculate_cost_difference(const PolyState&state, const PolyTransition&transition) const override

    apply_transition()

    Apply a transition to a state.

    Declaration
    void model::Poly::apply_transition(const PolyTransition&transition, PolyState&state) const override

    get_sweep_size()

    Declaration
    size_t model::Poly::get_sweep_size() const override

    configure()

    Populates model internals from the input json.

    Declaration
    void model::Poly::configure(const utils::Json&json) override

    configure()

    Declaration
    void model::Poly::configure(Configuration_T&configuration)

    print()

    Declaration
    std::string model::Poly::print() const

    get_parameters()

    Declaration
    std::vector<std::string>model::Poly::get_parameters() const

    get_spin_overlap()

    Declaration
    double model::Poly::get_spin_overlap(const PolyState&s, const PolyState&t) const

    get_term_overlap()

    Declaration
    double model::Poly::get_term_overlap(const PolyState&s, const PolyState&t) const

    state_memory_estimate()

    Declaration
    size_t model::Poly::state_memory_estimate() const override

    state_only_memory_estimate()

    Declaration
    size_t model::Poly::state_only_memory_estimate() const override

    configure_term()

    Read a term from the input configuration.

    Declaration
    void model::Poly::configure_term(const utils::Json&json, int parent=-1)

    configure_term()

    Declaration
    void model::Poly::configure_term(PolySpinsConfiguration&input, int parent=-1)

    configure_term()

    Declaration
    void model::Poly::configure_term(PolyTermConfiguration&input, int parent=-1)

    configure_term()

    Declaration
    void model::Poly::configure_term(std::vector<PolyTermConfiguration>&, int parent=-1)

    initialize_terms()

    Initialize a state.

    This takes a state with spins and parameters set and populates its intermediate evaluation results in terms. This is the only time we evaluate all of the terms. All subsequent calls to calculate_cost(state) and calculate_cost_difference(state, transition) rely on these terms.

    Declaration
    void model::Poly::initialize_terms(PolyState&state) const

    calculate_term_differences()

    Calculate difference for each term.

    This calculates all the nodes affected by a transition and bubbles those changes up to the root node of the poly tree.

    Declaration
    std::map<size_t, double>model::Poly::calculate_term_differences(const PolyState&state, const PolyTransition&transition) const

    term_factor()

    Return the factor preceding term term_id

    This computes the product constant * parameter where the parameter is optional and taken from the set of parameters passed.

    Declaration
    double model::Poly::term_factor(const std::vector<double>parameters, size_t term_id) const

    term_to_string()

    Render a term's string representation (recursively)

    Declaration
    std::string model::Poly::term_to_string(size_t term_id) const
    In This Article
    Back to top Generated with Doxygen and DocFX