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§
Sourcefn evaluate_dyn(&self, solution: &Value) -> Result<String, EvaluationError>
fn evaluate_dyn(&self, solution: &Value) -> Result<String, EvaluationError>
Evaluate a configuration and return the CLI-facing metric string.
Sourcefn evaluate_witness_dyn(
&self,
solution: &Value,
) -> Result<Option<String>, EvaluationError>
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.
Sourcefn evaluate_json(&self, solution: &Value) -> Result<Value, EvaluationError>
fn evaluate_json(&self, solution: &Value) -> Result<Value, EvaluationError>
Evaluate a configuration and return the result as a serializable JSON value.
Sourcefn serialize_json(&self) -> Value
fn serialize_json(&self) -> Value
Serialize the problem to a JSON value.
Sourcefn problem_name(&self) -> &'static str
fn problem_name(&self) -> &'static str
Return the problem name (Problem::NAME).
Sourcefn variant_map(&self) -> BTreeMap<String, String>
fn variant_map(&self) -> BTreeMap<String, String>
Return the variant key-value map.
Sourcefn parameter_names_dyn(&self) -> &'static [&'static str]
fn parameter_names_dyn(&self) -> &'static [&'static str]
Return this problem model’s canonical parameter names.
Sourcefn parameters_dyn(&self) -> ProblemParameters
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".