Class Variable

All Implemented Interfaces:
Comparable<Variable>, Optimisation, Optimisation.Constraint, Optimisation.Objective

public final class Variable extends ModelEntity<Variable>
Variable represents a decision variable in an optimization model.

Each variable has a unique index in the model and can have:

  • Lower and upper bounds (constraints)
  • A contribution weight in the objective function
  • An integer or continuous domain
  • A current value

Variables can be configured as:

  • Binary (0-1 integer variables)
  • Integer (whole number values only)
  • Continuous (any value within bounds)
  • Fixed (equal lower and upper bounds)
  • Unbounded (no effective limits)

As a subclass of ModelEntity, a Variable can function both as a constraint (through lower/upper bounds) and as an objective function component (through its contribution weight).

Variables are typically created and managed through ExpressionsBasedModel, which assigns their indices and incorporates them into the optimization problem.