Package com.darkcollective.relix.solver
Record Class LinearProgram
java.lang.Object
java.lang.Record
com.darkcollective.relix.solver.LinearProgram
- Record Components:
sense- whether the objective is maximised or minimisedvariables- the decision variables, in the order a solution reports themconstraints- the linear constraints; may be empty
public record LinearProgram(LinearProgram.Sense sense, List<LinearProgram.Variable> variables, List<LinearProgram.Constraint> constraints)
extends Record
One linear program: an objective to maximise or minimise over a list of decision
variables, subject to a list of linear constraints over the same variables.
This is the whole of what the engine says to a solver. Every relational notion —
which rows are candidates, what expression produced a coefficient, what a NULL
coefficient means — has already been resolved by the time a program is built; what
remains is arithmetic. That split is deliberate: the rules for dropping a row whose
objective is NULL are the OPTIMIZE operator's semantics, and two solvers must
not be able to disagree about them.
A constraint's coefficient array is positional: coefficients[i] multiplies
variables.get(i), and the array is exactly as long as the variable list.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOne linear constraint:Σ coefficients[i]·x[i]related tobound.static enumHow a constraint's weighted sum relates to its bound.static enumWhether the objective is to be maximised or minimised.static final recordOne decision variable: a value in[lower, upper]contributingweightper unit to the objective. -
Constructor Summary
ConstructorsConstructorDescriptionLinearProgram(LinearProgram.Sense sense, List<LinearProgram.Variable> variables, List<LinearProgram.Constraint> constraints) Creates an instance of aLinearProgramrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theconstraintsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.sense()Returns the value of thesenserecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thevariablesrecord component.
-
Constructor Details
-
LinearProgram
public LinearProgram(LinearProgram.Sense sense, List<LinearProgram.Variable> variables, List<LinearProgram.Constraint> constraints) Creates an instance of aLinearProgramrecord class.- Parameters:
sense- the value for thesenserecord componentvariables- the value for thevariablesrecord componentconstraints- the value for theconstraintsrecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
sense
Returns the value of thesenserecord component.- Returns:
- the value of the
senserecord component
-
variables
Returns the value of thevariablesrecord component.- Returns:
- the value of the
variablesrecord component
-
constraints
Returns the value of theconstraintsrecord component.- Returns:
- the value of the
constraintsrecord component
-