Decision Variables

DecisionVariable — a single decision variable bound on a parameter or data field.

class DVType(*values)[source]

Domain of a decision variable.

Values:

RANGE: Discrete integer in a contiguous range. LIST: Discrete integer drawn from an allowed list. REAL: Continuous floating-point value.

RANGE = 'range'
LIST = 'list'
REAL = 'real'
class DecisionVariable(dv, dv_table=None, dv_type=DVType.RANGE)[source]

A single decision variable bound on a model named value or data field.

Construct via ModelConfiguration.add_decision_variable(); configure bounds and behaviour with the chained set_* methods.

set_min(dv_min)[source]

Set the lower bound. Pass a literal/named value for a model-level DV, or a Field for a per-row DV.

Return type:

DecisionVariable

set_max(dv_max)[source]

Set the upper bound. None removes the bound. See set_min() for the literal-vs-field rule.

Return type:

DecisionVariable

set_scale(scale)[source]

Set the granularity at which the solver explores this variable.

Return type:

DecisionVariable

set_seed_source(seed_source)[source]

Set the model source used to seed this variable’s initial value.

Pass a Parameter or Calculation for a model-level decision variable, or a Field resolved against this variable’s dv_table for a per-row decision variable. The source is emitted as a !!!-prefixed reference, matching the format of cellReference.

Return type:

DecisionVariable

set_tag_source(tag_source)[source]

Set the model source for reading tags on this decision variable.

Pass a Parameter or Calculation for a model-level decision variable, or a Field resolved against this variable’s dv_table for a per-row decision variable. For multiple tags per variable, the referenced value should be an array.

Tags are consumed by step-level includedTags filters on StepConfiguration. The source is emitted as a !!!-prefixed reference, matching the format of cellReference.

Return type:

DecisionVariable

set_disabled(disabled)[source]

Disable this variable, holding it at its seed value.

Return type:

DecisionVariable

set_disabled_if_invalid(disabled_if_invalid)[source]

Disable this variable automatically when its row fails validation.

Return type:

DecisionVariable

build()[source]

Serialise to a JSON-compatible dict.

Return type:

dict[str, Any]