Package org.ddolib.ddo.core
Record Class Decision
java.lang.Object
java.lang.Record
org.ddolib.ddo.core.Decision
Represents a single decision within an optimization problem.
A Decision associates a variable identifier with a specific value.
It is an immutable data structure that captures a single assignment performed
during the search or compilation of a decision diagram (e.g., in an MDD-based solver).
Example:
Decision d = new Decision(2, 5);
System.out.println(d); // prints: Decision[variable=4, value=2]
Use in DD-based solvers:
- Encapsulates the assignment of a value to a variable during branching.
- Used to reconstruct solutions from paths in the decision diagram.
- Acts as a key element in comparing or storing decision paths in sets and maps.
-
Constructor Summary
ConstructorsConstructorDescriptionDecision(int variable, int value) Creates an instance of aDecisionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.intvalue()Returns the value of thevaluerecord component.intvariable()Returns the value of thevariablerecord component.
-
Constructor Details
-
Decision
public Decision(int variable, int value) Creates an instance of aDecisionrecord class.- Parameters:
variable- the value for thevariablerecord componentvalue- the value for thevaluerecord 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 with '=='. -
variable
public int variable()Returns the value of thevariablerecord component.- Returns:
- the value of the
variablerecord component
-
value
public int value()Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-