XPRBcut
XPRBcut |
int addTerm(double val, XPRBvar& var);
int addTerm(XPRBvar& var);
int addTerm(double val);
int setTerm(double val, XPRBvar& var);
int setTerm(XPRBvar& var);
int setTerm(double val);
XPRBcut
|
|||||
Synopsis
|
XPRBcut();
XPRBcut(xbcut *c); XPRBcut(xbcut *c, XPRBrelation& r); |
||||
Arguments
|
|
||||
Description
|
Create a new cut object.
|
||||
|
add
|
|||||
Synopsis
|
int add(XPRBexpr& le);
|
||||
Argument
|
|
||||
Return value
|
0 if method executed successfully, 1 otherwise.
|
||||
Description
|
|||||
Example
|
This example defines a cut and then modifies its definition by adding a terms and changing the coefficient of a variable. The resulting cut definitions (as displayed by
XPRBcut.print) are shown as comments. Please notice in particular the different behavior of
add and
addTerm for the addition of constants.
XPRBvar x,y,b; XPRBcut Cut2; XPRBprob prob("myprob"); x = prob.newVar("y", XPRB_PL, 0, 200); y = prob.newVar("y", XPRB_PL, 0, 200); b = prob.newVar("b", XPRB_BV); Cut2 = prob.newCut(y <= 100*b, 1); Cut2.add(x+2); // x + y - 100*b <= -2 Cut2.delTerm(x); // y - 100*b <= -2 Cut2.setTerm(0); // y - 100*b <= 0 Cut2 += x+2; // x + y - 100*b <= -2 Cut2.addTerm(2); // x + y - 100*b <= 0 Cut2.setTerm(y, -5); // x - 5*y - 100*b <= 0 |
||||
addTerm
|
|||||
Synopsis
|
int addTerm(XPRBvar& var, double val);
int addTerm(double val, XPRBvar& var); int addTerm(XPRBvar& var); int addTerm(double val); |
||||
Arguments
|
|
||||
Return value
|
0 if method executed successfully, 1 otherwise.
|
||||
Description
|
This method adds a new term to a cut, comprising the variable
var with coefficient
val. If the cut already has a term with variable
var,
val is added to its coefficient. If no variable is specified, the value
val is added to the right hand side of the cut. Cut terms can also be added with method
XPRBcut.add.
|
||||
Example
|
See
XPRBcut.add.
|
||||
Related topics
|
Calls
XPRBaddcutterm
|
||||
delTerm
|
|||||
Synopsis
|
int delTerm(XPRBvar& var);
|
||||
Argument
|
|
||||
Return value
|
0 if method executed successfully, 1 otherwise.
|
||||
Description
|
This method removes a variable term from a cut. The constant term (right hand side value) is changed/reset with method
XPRBcut.setTerm.
|
||||
Example
|
See
XPRBcut.add.
|
||||
Related topics
|
Calls
XPRBdelcutterm
|
||||
getCRef
|
|||||
Synopsis
|
xbcut *getCRef();
|
||||
Return value
|
The underlying modeling object in BCL C.
|
||||
Description
|
This method returns the cut object in BCL C that belongs to the C++ cut object.
|
||||
getID
|
|||||
Synopsis
|
int getID();
|
||||
Return value
|
Classification or identification number.
|
||||
Description
|
|||||
Example
|
See
XPRBcut.setID.
|
||||
Related topics
|
Calls
XPRBgetcutid
|
||||
getRHS
|
|||||
Synopsis
|
double getRHS();
|
||||
Return value
|
Right hand side (RHS) value (default 0).
|
||||
Description
|
|||||
Related topics
|
Calls
XPRBgetcutrhs
|
||||
getType
|
|||||
Synopsis
|
int getType();
|
||||
Return value
|
|||||
Description
|
|||||
Related topics
|
Calls
XPRBgetcuttype
|
||||
isValid
|
|||||
Synopsis
|
bool isValid();
|
||||
Return value
|
true if object is valid,
false otherwise.
|
||||
Description
|
|||||
print
|
|||||
Synopsis
|
int print();
|
||||
Return value
|
0 if function executed successfully, 1 otherwise.
|
||||
Description
|
|||||
Example
|
See
XPRBcut.setID.
|
||||
Related topics
|
Calls
XPRBprintcut
|
||||
reset
|
|||||
Synopsis
|
void reset();
|
||||
Description
|
|||||
setID
|
|||||
Synopsis
|
int setID(int id);
|
||||
Argument
|
|
||||
Return value
|
0 if method executed successfully, 1 otherwise.
|
||||
Description
|
This function changes the classification or identification number of a previously defined cut. This change does not have any effect on the cut definition in Xpress Optimizer if the cut has already been added to the matrix with
XPRBprob.addCuts.
|
||||
Example
|
This example defines a cut and then modifies its ID and relation type. The resulting output is shown in the comment.
XPRBvar y,b; XPRBcut Cut1; XPRBprob prob("myprob"); y = prob.newVar("y", XPRB_PL, 0, 200); b = prob.newVar("b", XPRB_BV); Cut1 = prob.newCut(y == 100*b); Cut1.setID(1); if (Cut1.getID()>0) Cut1.setType(XPRB_G); Cut1.print(); // CUT(1): y - 100*b >= 0 |
||||
Related topics
|
Calls
XPRBsetcutid
|
||||
setTerm
|
|||||
Synopsis
|
int setTerm(XPRBvar& var, double val);
int setTerm(double val, XPRBvar& var); int setTerm(XPRBvar& var); int setTerm(double val); |
||||
Arguments
|
|
||||
Return value
|
0 if method executed successfully, 1 otherwise.
|
||||
Description
|
|||||
Example
|
See
XPRBcut.add.
|
||||
Related topics
|
Calls
XPRBsetcutterm
|
||||
setType
|
|||||
Synopsis
|
int setType(int type);
|
||||
Argument
|
|||||
Return value
|
0 if method executed successfully, 1 otherwise.
|
||||
Description
|
This function changes the type of the given cut. This change does not have any effect on the cut definition in Xpress Optimizer if the cut has already been added to the matrix with the method
XPRBprob.addCuts.
|
||||
Example
|
See
XPRBcut.setID.
|
||||
Related topics
|
Calls
XPRBsetcuttype
|
||||
|
© 2001-2019 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.