Quadratic Masking Range
QuadraticMaskingRangeFunction is the binary-gated quadratic expression shared by the Kotlin and Rust implementations. For a quadratic polynomial
The solver model uses one positive finite constant
The mask is a binary variable, and
API
val z = BinVar("z")
val p = QuadraticPolynomial(
monomials = listOf(QuadraticMonomial.quadratic(Flt64.one, x, x)),
constant = Flt64.zero
)
val f = QuadraticMaskingRangeFunction(
polynomial = p,
z = z,
bigM = Flt64(100.0),
converter = IntoValue.Identity,
name = "masked_square"
)let z = BinaryVariableItem::create(VariableId::standalone(2), "z");
let p = Quadratic::new(
vec![QuadraticMonomial::new_quadratic(1.0, x_index, x_index)],
0.0,
);
let f = QuadraticMaskingRangeFunction::with_big_m(
2, "masked_square", p, z.clone(), 100.0,
);with_quadratic_bounds and the old lower/upper-bound contract were removed. They described a different range-variable operation and are no longer part of the public API.
Evaluation and registration
At evaluation time, z=0 returns zero without reading the result token; z=1 evaluates
Tests and source
- Kotlin source:
QuadraticMaskingRange.kt - Rust source:
quadratic_masking_range.rs - Kotlin independent tests:
QuadraticMaskingRangeFunctionDedicatedTest.ktandQuadraticFunctionGenericEvaluationTest.kt - Rust independent test:
function_symbol_quadratic_masking_range.rs