Record Class LinearProgram

java.lang.Object
java.lang.Record
com.darkcollective.relix.solver.LinearProgram
Record Components:
sense - whether the objective is maximised or minimised
variables - the decision variables, in the order a solution reports them
constraints - 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.

  • Constructor Details

  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • sense

      public LinearProgram.Sense sense()
      Returns the value of the sense record component.
      Returns:
      the value of the sense record component
    • variables

      public List<LinearProgram.Variable> variables()
      Returns the value of the variables record component.
      Returns:
      the value of the variables record component
    • constraints

      public List<LinearProgram.Constraint> constraints()
      Returns the value of the constraints record component.
      Returns:
      the value of the constraints record component