XPRBexpr
XPRBexpr(int i);
XPRBexpr(double d, XPRBvar& v);
XPRBexpr(double d, XPRBvar& v, XPRBvar& v2);
XPRBexpr(XPRBvar& v);
XPRBexpr(XPRBexpr& e);
int addTerm(double val, XPRBvar& var, XPRBvar& var2);
int addTerm(XPRBvar& var, double val);
int addTerm(double val, XPRBvar& var);
int addTerm(XPRBvar& var);
int addTerm(double val);
int setTerm(double val, XPRBvar& var, XPRBvar& var2);
int setTerm(XPRBvar& var, double val);
int setTerm(double val, XPRBvar& var);
int setTerm(double val);
add
|
|||||
Synopsis
|
XPRBexpr& add(XPRBexpr& e);
XPRBexpr& add(XPRBvar& v); |
||||
Arguments
|
|
||||
Return value
|
The modified expression.
|
||||
Description
|
|||||
Example
|
See
XPRBexpr.setTerm.
|
||||
addTerm
|
|||||
Synopsis
|
int addTerm(XPRBvar& var, XPRBvar& var2, double val);
int addTerm(double val, XPRBvar& var, XPRBvar& var2); int addTerm(XPRBvar& var, double val); int addTerm(double val, XPRBvar& var); int addTerm(XPRBvar& var); int addTerm(double val); |
||||
Arguments
|
|
||||
Return value
|
The modified expression.
|
||||
Description
|
This method adds a new term to an expression comprising the variable
var (or the product of variables
var and
var2) with coefficient
val. If the expression already has a term with variable
var (respectively variables
var and
var2),
val is added to its coefficient. If no variable is specified, the value
val is added to the constant term of the expression. Terms can also be added with method
XPRBexpr.add.
|
||||
Example
|
See
XPRBexpr.setTerm.
|
||||
assign
|
|||||
Synopsis
|
XPRBexpr& assign(XPRBexpr& e);
|
||||
Argument
|
|
||||
Return value
|
Copy of the expression in the argument.
|
||||
Description
|
|||||
delTerm
|
|||||
Synopsis
|
int delTerm(XPRBvar& var);
int delTerm(XPRBvar& var, XPRBvar& var2); |
||||
Argument
|
|
||||
Return value
|
The modified expression.
|
||||
Description
|
This function deletes a variable term from an expression. The constant term is changed or reset with method
XPRBexpr.setTerm.
|
||||
Example
|
See
XPRBexpr.setTerm.
|
||||
getSol
|
|||||
Synopsis
|
double getSol();
|
||||
Return value
|
Evaluation of the expression with the last solution.
|
||||
Description
|
This method returns the evaluation of an expression with the solution values from the last solution found. If this method is called after completion of a branch and bound tree search and an integer solution has been found (that is, if method
XPRBprob.getMIPStat returns values
XPRB_MIP_SOLUTION or
XPRB_MIP_OPTIMAL), it returns the value corresponding to the best integer solution. If no integer solution is available after a branch and bound tree search this method outputs a warning and returns 0. In all other cases it returns the evaluation corresponding to the last LP that has been solved. If this method is used
during the execution of an optimization process (for instance in Optimizer library callback functions) it needs to be preceded by a call to
XPRBprob.sync with the flag
XPRB_XPRS_SOL.
|
||||
mul
|
|||||
Synopsis
|
XPRBexpr& mul(double d);
XPRBexpr& mul(XPRBexpr& e); |
||||
Arguments
|
|
||||
Return value
|
The modified expression.
|
||||
Error handling
|
ArithmeticException `Non-quadratic expression' if the result of the operation is not quadratic.
|
||||
Description
|
|||||
Example
|
See
XPRBexpr.setTerm.
|
||||
neg
|
|||||
Synopsis
|
XPRBexpr& neg();
|
||||
Return value
|
Negation of the expression.
|
||||
Description
|
|||||
Example
|
See
XPRBexpr.setTerm.
|
||||
setTerm
|
|||||
Synopsis
|
int setTerm(XPRBvar& var, XPRBvar& var2, double val);
int setTerm(double val, XPRBvar& var, XPRBvar& var2); int setTerm(XPRBvar& var, double val); int setTerm(double val, XPRBvar& var); int setTerm(double val); |
||||
Arguments
|
|
||||
Return value
|
The modified expression.
|
||||
Description
|
|||||
Example
|
This example shows different ways of defining and modifying a quadratic expression and finally sets the resulting expression as objective function. The comments display the definition of
qe after each modification.
XPRBvar x,y; XPRBexpr qe; XPRBprob prob("myprob"); x = prob.newVar("x", XPRB_PL, 0, 200); y = prob.newVar("y", XPRB_PL, 0, 200); qe = x; // x qe.mul(3*x); // 3*x^2 qe += x*2*y; // 3*x^2 + 2*x*y qe.add(1); // 1 + 3*x^2 + 2*x*y qe.setTerm(3, x); // 1 + 3*x + 3*x^2 + 2*x*y qe.setTerm(0, x, y); // 1 + 3*x + 3*x^2 qe.delTerm(x, x); // 1 + 3*x qe.setTerm(-1); // - 1 + 3*x qe.addTerm(2, x); // - 1 + 5*x qe -= 3*sqr(3*y); // - 1 + 5*x - 27*y^2 qe.neg(); // 1 - 5*x + 27*y^2 prob.setObj(qe); |
sqr
|
|||||
Synopsis
|
XPRBexpr sqr(XPRBexpr& e);
XPRBexpr sqr(XPRBvar& var); |
||||
Arguments
|
|
||||
Return value
|
The square of the variable or expression in the argument.
|
||||
Description
|
|||||
Example
|
See
XPRBexpr.setTerm.
|
||||
|
© 2001-2024 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.