XPRBsol
- java.lang.Object
-
- com.dashoptimization.XPRBsol
-
public class XPRBsol extends java.lang.Object
This class represents a Solution definition in BCL. All variables in solution must belong to the same problem as the solution itself.
-
-
Method Summary
Modifier and Type Method and Description void
delVar(XPRBvar var)
Delete a variable assignment from a solution.int
getSize()
Get the size of a solution.java.lang.Double
getVar(XPRBvar var)
Get the value assignet to a variable in a solution.boolean
isValid()
Test whether a solution is correctly defined.void
print()
Print out a solution.void
setVar(XPRBvar var, double value)
Add a variable assignment in a solution.
-
-
-
Method Detail
-
isValid
public boolean isValid()
Test whether a solution is correctly defined.XPRBsol sol1; if(sol1.isValid() == false) System.out.println("Error in sol definition.");
-
setVar
public void setVar(XPRBvar var, double value)
Add a variable assignment in a solution. This method sets the value of a variable in a (partial) solution.XPRBprob expl1; XPRBvar x1, x2; XPRBsol sol1; expl1 = new XPRBprob("example1"); x1 = expl1.newVar("abc3", XPRB.UI, 1, 100); x2 = expl1.newVar("abc1", XPRB.PL, 0, XPRB.INFINITY); sol1 = expl1.newSol(); sol1.setVar(x1,1.0); sol1.setVar(x2,0.0);
- Parameters:
-
var
- a variable of typeXPRBvar
-
value
- a double constant
-
getVar
public java.lang.Double getVar(XPRBvar var)
Get the value assignet to a variable in a solution. This method retrieves the value assigned to a variable in the given solution.XPRBprob expl1; XPRBvar x1, x2; XPRBsol sol1; double val1; expl1 = new XPRBprob("example1"); x1 = expl1.newVar("abc3", XPRB.UI, 1, 100); sol1 = expl1.newSol(); sol1.setVar(x1,1.0); val1 = sol1.getVar(x1, value);
- Parameters:
-
var
- a variable of typeXPRBvar
- Returns:
- The value assigned to var or null.
-
delVar
public void delVar(XPRBvar var)
Delete a variable assignment from a solution. This method removes a variable from a solution.XPRBprob expl2; XPRBvar x1; XPRBsol sol1; expl2 = new XPRBprob("example2"); x1 = expl2.newVar("abc3", XPRB.UI, 1, 100); sol1 = expl2.newSol(); sol1.addVar(x1, 1.0); sol1.delVar(x1);
- Parameters:
-
var
- a variable of typeXPRBvar
-
getSize
public int getSize()
Get the size of a solution. Returns the number of variables assigned to a value in a solution.XPRBprob expl2; XPRBvar x1; XPRBsol sol1; int size; expl2 = new XPRBprob("example2"); x1 = expl2.newVar("abc3", XPRB.UI, 1, 100); sol1 = expl2.newSol(); sol1.addVar(x1, 1.0); size = sol1.getSize();
- Returns:
- Solution size (integer value)
-
print
public void print()
Print out a solution. This method is not available in the Student Edition.XPRBprob expl2; XPRBsos set1; expl2 = new XPRBprob("example2"); sol1 = expl2.newSol(); sol1.print();
-
-
© 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.