Skip to main content

DynProblem

Trait DynProblem 

Source
pub trait DynProblem: Any {
    // Required methods
    fn evaluate_dyn(&self, solution: &Value) -> Result<String, EvaluationError>;
    fn evaluate_witness_dyn(
        &self,
        solution: &Value,
    ) -> Result<Option<String>, EvaluationError>;
    fn evaluate_json(&self, solution: &Value) -> Result<Value, EvaluationError>;
    fn serialize_json(&self) -> Value;
    fn as_any(&self) -> &dyn Any;
    fn problem_name(&self) -> &'static str;
    fn variant_map(&self) -> BTreeMap<String, String>;
    fn parameter_names_dyn(&self) -> &'static [&'static str];
    fn parameters_dyn(&self) -> ProblemParameters;
}
Expand description

Type-erased problem interface for dynamic dispatch.

Implemented for serializable problems whose values support solution witnesses.

Required Methods§

Source

fn evaluate_dyn(&self, solution: &Value) -> Result<String, EvaluationError>

Evaluate a configuration and return the CLI-facing metric string.

Source

fn evaluate_witness_dyn( &self, solution: &Value, ) -> Result<Option<String>, EvaluationError>

Evaluate a candidate witness, returning None when it is infeasible. This validates feasibility, not global optimality.

Source

fn evaluate_json(&self, solution: &Value) -> Result<Value, EvaluationError>

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 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 parameter_names_dyn(&self) -> &'static [&'static str]

Return this problem model’s canonical parameter names.

Source

fn parameters_dyn(&self) -> ProblemParameters

Measure the complete canonical parameters of this concrete instance.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§