Package com.darkcollective.relix.solver
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 numberslower- the inclusive lower boundupper- the inclusive upper boundweight- 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
ConstructorsConstructorDescriptionVariable(boolean integral, double lower, double upper, double weight) Creates an instance of aVariablerecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic LinearProgram.Variablebinary(double weight) A 0/1 decision — "is this row chosen?".static LinearProgram.Variablecontinuous(double lower, double upper, double weight) A continuous decision within a range — "how much of this row?".final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanintegral()Returns the value of theintegralrecord component.doublelower()Returns the value of thelowerrecord component.final StringtoString()Returns a string representation of this record class.doubleupper()Returns the value of theupperrecord component.doubleweight()Returns the value of theweightrecord component.
-
Constructor Details
-
Variable
public Variable(boolean integral, double lower, double upper, double weight) Creates an instance of aVariablerecord class.
-
-
Method Details
-
binary
A 0/1 decision — "is this row chosen?".- Parameters:
weight- the objective coefficient earned when the variable is 1- Returns:
- a binary variable
-
continuous
A continuous decision within a range — "how much of this row?".- Parameters:
lower- the inclusive lower boundupper- the inclusive upper boundweight- the objective coefficient per unit- Returns:
- a continuous variable
-
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 with '=='. -
integral
public boolean integral()Returns the value of theintegralrecord component.- Returns:
- the value of the
integralrecord component
-
lower
public double lower()Returns the value of thelowerrecord component.- Returns:
- the value of the
lowerrecord component
-
upper
public double upper()Returns the value of theupperrecord component.- Returns:
- the value of the
upperrecord component
-
weight
public double weight()Returns the value of theweightrecord component.- Returns:
- the value of the
weightrecord component
-