MCPcopy Create free account
hub / github.com/Open-Quant/openquant / validate

Method validate

crates/openquant/src/combinatorial_optimization.rs:52–62  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

50
51impl IntegerVariable {
52 fn validate(self) -> Result<(), CombinatorialOptimizationError> {
53 if self.step <= 0 {
54 return Err(CombinatorialOptimizationError::InvalidInput("step must be > 0"));
55 }
56 if self.lower > self.upper {
57 return Err(CombinatorialOptimizationError::InvalidInput(
58 "variable lower bound must be <= upper bound",
59 ));
60 }
61 Ok(())
62 }
63
64 fn cardinality(self) -> Result<usize, CombinatorialOptimizationError> {
65 self.validate()?;

Callers 5

cardinalityMethod · 0.45
valuesMethod · 0.45
solve_exactFunction · 0.45
solve_with_adapterFunction · 0.45
enumerate_trading_pathsFunction · 0.45

Calls 2

is_emptyMethod · 0.80
decision_space_sizeMethod · 0.80

Tested by

no test coverage detected