Inequality
- java.lang.Object
-
- com.dashoptimization.objects.Inequality
-
- All Implemented Interfaces:
-
Index
,java.lang.Comparable<Inequality>
public final class Inequality extends java.lang.Object implements Index, java.lang.Comparable<Inequality>
A reference to an equation, inequality, or ranged row.- Since:
- 43.00
-
-
Nested Class Summary
Modifier and Type Class Description static class
Inequality.Definition
Class representing a<=
,>=
,==
, or ranged constraint.
-
Method Summary
Modifier and Type Method Description Inequality
chgCoef(Variable v, double newCoef)
Change the coefficient for a variable in this row.Inequality
chgCoefs(Variable[] v, double[] newCoef)
Change the coefficients for multiple variables in this row.int
compareTo(Inequality other)
boolean
equals(java.lang.Object other)
double
getCallbackDual()
Get the dual value value for this row from the solution associated with the current callback.double
getCallbackSlack()
Get the slack value for this row from the solution associated with the current callback.double
getDual()
Get the current dual value value for this row.int
getIndex()
Get the index that this object has in the underlying model.int
getIndexForProb(XpressProblem xprob)
Get the index stored in this object but raise an exception if the problem that created this object is notprob
.Expression
getLhs()
Get the left-hand side of this inequality.java.lang.String
getName()
Get the name of this object.XpressProblem
getProblem()
Get the problem to which this element belongs.double
getRhs()
Get the right-hand side for this row.double
getRhsRange()
Get the right-hand side range for this row.double
getSlack()
Get the current slack value for this row.RowType
getType()
Get the type for this row.double
getValue(double[] data)
Get the value of this row from an array.int
hashCode()
Inequality
setName(java.lang.String newName)
Set the name of this inequality.Inequality
setRhs(double newRhs)
Set the right-hand side for this row.Inequality
setRhsRange(double newRange)
Set the right-hand side range for this row.Inequality
setType(RowType newType)
Set the type for this row.void
updateIndex(int delta)
-
-
-
Method Detail
-
getIndex
public int getIndex()
Get the index that this object has in the underlying model. Attention: this is a very advanced function. Use it only if you know exactly what you are doing.Used in these examples:
- GlobalObjectiveParametrics
- GlobalRHSParametrics
-
updateIndex
public void updateIndex(int delta)
- Specified by:
-
updateIndex
in interfaceIndex
- Parameters:
-
delta
- The value to add to the index. - Since:
- 43.00
-
getIndexForProb
public int getIndexForProb(XpressProblem xprob)
Get the index stored in this object but raise an exception if the problem that created this object is notprob
.- Specified by:
-
getIndexForProb
in interfaceIndex
- Parameters:
-
xprob
- The problem for which the index is queried. If this object does not belong toprob
then an execption is raised. - Returns:
-
The low-level index for this object in
prob
. - Since:
- 43.00
-
getProblem
public XpressProblem getProblem()
Get the problem to which this element belongs.- Specified by:
-
getProblem
in interfaceIndex
- Returns:
-
The problem to which this element belongs. This will be
null
if the element was deleted. - Since:
- 43.00
-
equals
public final boolean equals(java.lang.Object other)
- Overrides:
-
equals
in classjava.lang.Object
- Parameters:
-
other
- - Returns:
- Since:
- 43.00
-
compareTo
public final int compareTo(Inequality other)
- Specified by:
-
compareTo
in interfacejava.lang.Comparable<Inequality>
- Parameters:
-
other
- - Returns:
- Since:
- 43.00
-
hashCode
public final int hashCode()
- Overrides:
-
hashCode
in classjava.lang.Object
-
getRhs
public double getRhs()
Get the right-hand side for this row. Queries thecom.dashoptimization.objects.XpressProblem
instance to which this row belongs and returns the right-hand side from that instance.- Returns:
- Right-hand side of this inequality.
- Since:
- 43.00
-
getRhsRange
public double getRhsRange()
Get the right-hand side range for this row. Queries thecom.dashoptimization.objects.XpressProblem
instance to which this row belongs and returns the right-hand side range from that instance.- Returns:
- Right-hand side range of this inequality.
- Since:
- 43.00
-
getName
public java.lang.String getName()
Get the name of this object. Queries the problem instance that owns this object and returns the name from that instance.
-
getType
public RowType getType()
Get the type for this row. Queries thecom.dashoptimization.objects.XpressProblem
instance to which this row belongs and returns the name obtained from that instance.- Returns:
- Type of this inequality.
- Since:
- 43.00
-
setRhs
public Inequality setRhs(double newRhs)
Set the right-hand side for this row. Set the right-hand side in thecom.dashoptimization.objects.XpressProblem
instance to which this row belongs.- Parameters:
-
newRhs
- New rhs. - Returns:
- This row
- Since:
- 43.00
-
setRhsRange
public Inequality setRhsRange(double newRange)
Set the right-hand side range for this row. Sets the right-hand side range value in thecom.dashoptimization.objects.XpressProblem
instance to which this row belongs.- Parameters:
-
newRange
- The new range value for this row. - Returns:
- This row.
- Since:
- 43.00
-
setType
public Inequality setType(RowType newType)
Set the type for this row. Set the type in thecom.dashoptimization.objects.XpressProblem
instance to which this row belongs.- Parameters:
-
newType
- New type. - Returns:
- This row
- Since:
- 43.00
-
setName
public Inequality setName(java.lang.String newName)
Set the name of this inequality. Sets the name of this inequality in the problem instance that owns the object.- Parameters:
-
newName
- The name to be set. - Returns:
- Always returns this instance.
- Since:
- 43.00
-
getValue
public double getValue(double[] data)
Get the value of this row from an array. The function assumes thatdata
is an array that stores a value for each row in the underlying problem and returns the value from this array that corresponds to this row.data
arrays can be obtained for example fromprob.getSlacks()
orprob.getCallbackSlacks()
.Used in these examples:
- AddMipSol
- FixBV
- GlobalObjectiveParametrics
- GlobalRHSParametrics
- GoalProg
- Knapsack
- LoadLP
- MipSolEnum
- MipSolPool
- MostViolated
- SaveSol
- TSP
- Tableau
- Trimloss
- Parameters:
-
data
- Array data with data for this inequality. - Returns:
-
The value for this inequality in
data
. - Since:
- 43.00
-
getSlack
public double getSlack()
Get the current slack value for this row.Note: This function uses
XPRSprob.getSlacks(IntHolder, double[], int, int)
under the hood. This is only valid to call if the `com.dashoptimization.objects.XpressProblem` instance owning this row is currently not under optimization.Note: Calling this function for multiple rows is not efficient. If you need to get values for multiple rows then consider using
XPRSprob.getSlacks()
to get the values for all rows and then usegetValue(double[])
to extract the value for a particular row. This strategy is also valid from callbacks.- Returns:
- Slack for this row.
- Since:
- 43.00
-
getDual
public double getDual()
Get the current dual value value for this row.Note: This function uses
XPRSprob.getDuals(IntHolder, double[], int, int)
under the hood. This is only valid to call if the `com.dashoptimization.objects.XpressProblem` instance owning this row is currently not under optimization.Note: Calling this function for multiple rows is not efficient. If you need to get values for multiple rows then consider using
XPRSprob.getDuals()
to get the values for all rows and then usegetValue(double[])
to extract the value for a particular row. This strategy is also valid from callbacks.- Returns:
- Dual value for this row.
- Since:
- 43.00
-
getCallbackSlack
public double getCallbackSlack()
Get the slack value for this row from the solution associated with the current callback.Note: This function uses
XPRSprob.getCallbackSlacks(BoolHolder, double[], int, int)
under the hood.Note: Calling this function for multiple rows is not efficient. If you need to get values for multiple rows then consider using
XPRSprob.getCallbackSlacks()
to get the values for all rows and then usegetValue(double[])
to extract the value for a particular row.- Returns:
- Slack for this row.
- Since:
- 43.00
-
getCallbackDual
public double getCallbackDual()
Get the dual value value for this row from the solution associated with the current callback.Note: This function uses
XPRSprob.getCallbackDuals(BoolHolder, double[], int, int)
under the hood.Note: Calling this function for multiple rows is not efficient. If you need to get values for multiple rows then consider using
XPRSprob.getCallbackDuals()
to get the values for all rows and then usegetValue(double[])
to extract the value for a particular row.- Returns:
- Dual value for this row.
- Since:
- 43.00
-
chgCoef
public Inequality chgCoef(Variable v, double newCoef)
Change the coefficient for a variable in this row.- Parameters:
-
v
- Variable for which to change the coefficient. -
newCoef
- New coefficient. - Returns:
- Always returns this instance.
- Since:
- 43.00
-
chgCoefs
public Inequality chgCoefs(Variable[] v, double[] newCoef)
Change the coefficients for multiple variables in this row.- Parameters:
-
v
- Variables for which to change the coefficient. -
newCoef
- New coefficients. - Returns:
- Always returns this instance.
- Since:
- 43.00
-
getLhs
public Expression getLhs()
Get the left-hand side of this inequality.- Returns:
- The left-hand side of this inequality.
- Since:
- 43.00
-
-
© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.