Skip to main content

DynProblem

Trait DynProblem 

Source
pub trait DynProblem: Any {
    // Required methods
    fn evaluate_dyn(&self, config: &[usize]) -> String;
    fn evaluate_json(&self, config: &[usize]) -> Value;
    fn serialize_json(&self) -> Value;
    fn as_any(&self) -> &dyn Any;
    fn dims_dyn(&self) -> Vec<usize>;
    fn problem_name(&self) -> &'static str;
    fn variant_map(&self) -> BTreeMap<String, String>;
    fn num_variables_dyn(&self) -> usize;
}
Expand description

Type-erased problem interface for dynamic dispatch.

Implemented via blanket impl for any T: Problem + Serialize + 'static.

Required Methods§

Source

fn evaluate_dyn(&self, config: &[usize]) -> String

Evaluate a configuration and return the result as a debug string.

Source

fn evaluate_json(&self, config: &[usize]) -> Value

Evaluate a configuration and return the result as a serializable JSON value.

Source

fn serialize_json(&self) -> Value

Serialize the problem to a JSON value.

Source

fn as_any(&self) -> &dyn Any

Downcast to &dyn Any for type recovery.

Source

fn dims_dyn(&self) -> Vec<usize>

Return the configuration space dimensions.

Source

fn problem_name(&self) -> &'static str

Return the problem name (Problem::NAME).

Source

fn variant_map(&self) -> BTreeMap<String, String>

Return the variant key-value map.

Source

fn num_variables_dyn(&self) -> usize

Return the number of variables.

Implementors§

Source§

impl<T> DynProblem for T
where T: Problem + Serialize + 'static, T::Metric: Debug + Serialize,