Record Class LinearProgram.Variable

java.lang.Object
java.lang.Record
com.darkcollective.relix.solver.LinearProgram.Variable
Record Components:
integral - whether the variable is restricted to whole numbers
lower - the inclusive lower bound
upper - the inclusive upper bound
weight - the variable's objective coefficient
Enclosing class:
LinearProgram

public static record LinearProgram.Variable(boolean integral, double lower, double upper, double weight) extends Record
One decision variable: a value in [lower, upper] contributing weight per unit to the objective.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Variable(boolean integral, double lower, double upper, double weight)
    Creates an instance of a Variable record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    binary(double weight)
    A 0/1 decision — "is this row chosen?".
    continuous(double lower, double upper, double weight)
    A continuous decision within a range — "how much of this row?".
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the integral record component.
    double
    Returns the value of the lower record component.
    final String
    Returns a string representation of this record class.
    double
    Returns the value of the upper record component.
    double
    Returns the value of the weight record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Variable

      public Variable(boolean integral, double lower, double upper, double weight)
      Creates an instance of a Variable record class.
      Parameters:
      integral - the value for the integral record component
      lower - the value for the lower record component
      upper - the value for the upper record component
      weight - the value for the weight record component
  • Method Details

    • binary

      public static LinearProgram.Variable binary(double weight)
      A 0/1 decision — "is this row chosen?".
      Parameters:
      weight - the objective coefficient earned when the variable is 1
      Returns:
      a binary variable
    • continuous

      public static LinearProgram.Variable continuous(double lower, double upper, double weight)
      A continuous decision within a range — "how much of this row?".
      Parameters:
      lower - the inclusive lower bound
      upper - the inclusive upper bound
      weight - the objective coefficient per unit
      Returns:
      a continuous variable
    • 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 '=='.
      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.
    • integral

      public boolean integral()
      Returns the value of the integral record component.
      Returns:
      the value of the integral record component
    • lower

      public double lower()
      Returns the value of the lower record component.
      Returns:
      the value of the lower record component
    • upper

      public double upper()
      Returns the value of the upper record component.
      Returns:
      the value of the upper record component
    • weight

      public double weight()
      Returns the value of the weight record component.
      Returns:
      the value of the weight record component