XPRBvar
XPRBvar |
XPRBvar
|
|||
Synopsis
|
XPRBvar();
XPRBvar(xbvar *v); |
||
Argument
|
|
||
Description
|
Create a new variable object.
|
||
|
fix
|
|||||||||||||||||||||||||
Synopsis
|
int fix(double val);
|
||||||||||||||||||||||||
Argument
|
|
||||||||||||||||||||||||
Return value
|
0 if method executed successfully, 1 otherwise.
|
||||||||||||||||||||||||
Description
|
This method fixes a variable to the given value. It replaces calls to
XPRBvar.setLB and
XPRBvar.setUB. The value
val may lie outside the original bounds of the variable. If the problem is loaded in the Optimizer, the bound change is passed on immediately without any need to reload the problem.
|
||||||||||||||||||||||||
Related topics
|
Calls
XPRBfixvar
|
||||||||||||||||||||||||
getColNum
|
|||||||||||||||||||||||||
Synopsis
|
int getColNum();
|
||||||||||||||||||||||||
Return value
|
Column number (non-negative value), or a negative value.
|
||||||||||||||||||||||||
Description
|
This method returns the column number of a variable in the matrix currently loaded in the Xpress Optimizer. If the variable is not part of the matrix, or if the matrix has not yet been generated, the function returns a negative value. To check whether the matrix has been generated, use function
XPRBprob.getProbStat. The counting of column numbers starts with
0.
|
||||||||||||||||||||||||
Example
|
See
XPRBvar.getSol.
|
||||||||||||||||||||||||
Related topics
|
Calls
XPRBgetcolnum
|
||||||||||||||||||||||||
getCRef
|
|||||||||||||||||||||||||
Synopsis
|
xbvar *getCRef();
|
||||||||||||||||||||||||
Return value
|
The underlying modeling object in BCL C.
|
||||||||||||||||||||||||
Description
|
This method returns the variable object in BCL C that belongs to the C++ variable object.
|
||||||||||||||||||||||||
getLB
|
|||||||||||||||||||||||||
Synopsis
|
double getLB();
|
||||||||||||||||||||||||
Return value
|
Lower bound on the variable (default 0).
|
||||||||||||||||||||||||
Description
|
|||||||||||||||||||||||||
Example
|
See
XPRBvar.getName.
|
||||||||||||||||||||||||
Related topics
|
Calls
XPRBgetbounds
|
||||||||||||||||||||||||
getLim
|
|||||||||||||||||||||||||
Synopsis
|
double getLim();
|
||||||||||||||||||||||||
Return value
|
Limit value (default 1):
|
||||||||||||||||||||||||
Description
|
|||||||||||||||||||||||||
Example
|
See
XPRBvar.getName.
|
||||||||||||||||||||||||
Related topics
|
Calls
XPRBgetlim
|
||||||||||||||||||||||||
getName
|
|||||||||||||||||||||||||
Synopsis
|
const char *getName();
|
||||||||||||||||||||||||
Return value
|
Name of the variable if executed successfully,
NULL otherwise.
|
||||||||||||||||||||||||
Description
|
|||||||||||||||||||||||||
Example
|
The following example displays information about a semi-continuous variable. The output printed by this program extract is shown in the comment.
XPRBvar s; XPRBprob prob("myprob"); s = prob.newVar("s", XPRB_SC, 0, 200); s.setLim(10); if (s.getType()==XPRB_SC || s.getType()==XPRB_SI) { cout << s.getName() << " in {" << s.getLB() << "}+["; cout << s.getLim() << "," << s.getUB() << "]" << endl; } // s in {0}+[10,200] |
||||||||||||||||||||||||
Related topics
|
Calls
XPRBgetvarname
|
||||||||||||||||||||||||
getRCost
|
|||||||||||||||||||||||||
Synopsis
|
double getRCost();
|
||||||||||||||||||||||||
Return value
|
Reduced cost value for the variable, 0 in case of an error.
|
||||||||||||||||||||||||
Description
|
This method returns the reduced cost value for a variable. The user may wish to test first whether this variable is part of the problem, for instance by checking that the column number is non-negative.
Reduced cost information is available only after LP solving. To obtain reduced cost values for a MIP solution (that is, if function XPRBprob.getMIPStat returns values XPRB_MIP_SOLUTION or XPRB_MIP_OPTIMAL), you need to fix the discrete variables to their solution values with a call to XPRSfixglobals, followed by a call to XPRBlpoptimize before calling XPRBgetrcost. Otherwise, if this function is called when a MIP solution is available it returns 0. If no solution information is available this function outputs a warning and returns 0. If this function 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. In this case it returns the reduced cost value in the last LP that has been solved. |
||||||||||||||||||||||||
Example
|
See
XPRBvar.getSol.
|
||||||||||||||||||||||||
Related topics
|
Calls
XPRBgetrcost
|
||||||||||||||||||||||||
getRNG
|
|||||||||||||||||||||||||
Synopsis
|
double getRNG(int rngtype);
|
||||||||||||||||||||||||
Argument
|
|
||||||||||||||||||||||||
Return value
|
Ranging information of the required type.
|
||||||||||||||||||||||||
Description
|
1.
This method can only be used after solving an LP problem. Ranging information for MIP problems can be obtained by fixing all discrete variables to their solution values and re-solving the resulting LP problem.
2. For non-basic variables, the unit costs are always the (absolute) values of the reduced costs.
|
||||||||||||||||||||||||
Example
|
This example retrieves ranging information (lower and upper activity) for a variable.
XPRBvar x; XPRBprob prob("myprob"); x = prob.newVar("x", XPRB_PL, 0, 200); ... // Define and solve an LP problem cout << "x: " << x.getSol(); cout << " (act. range: " << x.getRNG(XPRB_LOACT) << ", " ; cout << x.getRNG(XPRB_UPACT) << ")" << endl; |
||||||||||||||||||||||||
Related topics
|
Calls
XPRBgetvarrng
|
||||||||||||||||||||||||
getSol
|
|||||||||||||||||||||||||
Synopsis
|
double getSol();
|
||||||||||||||||||||||||
Return value
|
Primal solution value for the variable, 0 in case of an error.
|
||||||||||||||||||||||||
Description
|
This function returns the current solution value for a variable. The user may wish to test first whether this variable is part of the problem, for instance by checking that the column number is non-negative.
If this function is called after completion of a global search and an integer solution has been found (that is, if function XPRBprob.getMIPStat returns values XPRB_MIP_SOLUTION or XPRB_MIP_OPTIMAL), it returns the value of the best integer solution. If no integer solution is available after a global search this function outputs a warning and returns 0. In all other cases it returns the solution value in the last LP that has been solved. If this function 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. |
||||||||||||||||||||||||
Example
|
This example retrieves the solution information for the variable
x after solving an LP problem.
XPRBprob prob("myprob"); XPRBvar x; ... x = prob.newVar("x", XPRB_PL, 0, 200); prob.lpOptimize(); if (x.getColNum() >= 0 && prob.getLPStat()==XPRB_LP_OPTIMAL) { cout << x.getName() << ": solution: " << x.getSol(); cout << " reduced cost: " << x.getRCost() << endl; } else cout << "No solution information available." << endl; |
||||||||||||||||||||||||
Related topics
|
Calls
XPRBgetsol
|
||||||||||||||||||||||||
getType
|
|||||||||||||||||||||||||
Synopsis
|
int getType();
|
||||||||||||||||||||||||
Return value
|
|||||||||||||||||||||||||
Description
|
|||||||||||||||||||||||||
Example
|
See
XPRBvar.getName.
|
||||||||||||||||||||||||
Related topics
|
Calls
XPRBgetvartype
|
||||||||||||||||||||||||
getUB
|
|||||||||||||||||||||||||
Synopsis
|
double getUB();
|
||||||||||||||||||||||||
Return value
|
Upper bound on the variable (default
XPRB_INFINITY).
|
||||||||||||||||||||||||
Description
|
|||||||||||||||||||||||||
Example
|
See
XPRBvar.getName.
|
||||||||||||||||||||||||
Related topics
|
Calls
XPRBgetbounds
|
||||||||||||||||||||||||
isValid
|
|||||||||||||||||||||||||
Synopsis
|
bool isValid();
|
||||||||||||||||||||||||
Return value
|
true if object is valid,
false otherwise.
|
||||||||||||||||||||||||
Description
|
This method checks whether the variable object is correctly defined. It should always be used to test the result returned by
XPRBprob.getVarByName.
|
||||||||||||||||||||||||
Example
|
|||||||||||||||||||||||||
print
|
|||||||||||||||||||||||||
Synopsis
|
int print();
|
||||||||||||||||||||||||
Return value
|
The number of characters printed.
|
||||||||||||||||||||||||
Description
|
|||||||||||||||||||||||||
Example
|
|||||||||||||||||||||||||
Related topics
|
Calls
XPRBprintvar
|
||||||||||||||||||||||||
setDir
|
|||||||||||||||||||||||||
Synopsis
|
int setDir(int type, double val);
int setDir(int type); |
||||||||||||||||||||||||
Arguments
|
|
||||||||||||||||||||||||
Return value
|
0 if method executed successfully, 1 otherwise.
|
||||||||||||||||||||||||
Description
|
1. This
method sets any type of branching directive available in Xpress. This may be a priority for branching on a variable (type
XPRB_PR), the preferred branching direction (types
XPRB_UP,
XPRB_DN) or the estimated cost incurred when branching on a variable (types
XPRB_PU,
XPRB_PD). Several directives of different types may be set for a single variable.
2. Note that it is only possibly to set branching directives for discrete variables (including semi-continuous and partial integer variables). Method
XPRBsos.setDir may be used to set a directive for a SOS.
|
||||||||||||||||||||||||
Example
|
See
XPRBprob.clearDir.
|
||||||||||||||||||||||||
Related topics
|
Calls
XPRBsetvardir
|
||||||||||||||||||||||||
setLB
|
|||||||||||||||||||||||||
Synopsis
|
int setLB(double val);
|
||||||||||||||||||||||||
Argument
|
|
||||||||||||||||||||||||
Return value
|
0 if method executed successfully, 1 otherwise.
|
||||||||||||||||||||||||
Description
|
|||||||||||||||||||||||||
Related topics
|
Calls
XPRBsetlb
|
||||||||||||||||||||||||
setLim
|
|||||||||||||||||||||||||
Synopsis
|
int setLim(double val);
|
||||||||||||||||||||||||
Argument
|
|
||||||||||||||||||||||||
Return value
|
0 if method executed successfully, 1 otherwise.
|
||||||||||||||||||||||||
Description
|
|||||||||||||||||||||||||
Example
|
|||||||||||||||||||||||||
Related topics
|
Calls
XPRBsetlim
|
||||||||||||||||||||||||
setType
|
|||||||||||||||||||||||||
Synopsis
|
int setType(int type);
|
||||||||||||||||||||||||
Argument
|
|||||||||||||||||||||||||
Return value
|
0 if method executed successfully, 1 otherwise.
|
||||||||||||||||||||||||
Description
|
|||||||||||||||||||||||||
Related topics
|
Calls
XPRBsetvartype
|
||||||||||||||||||||||||
setUB
|
|||||||||||||||||||||||||
Synopsis
|
int setUB(double val);
|
||||||||||||||||||||||||
Argument
|
|
||||||||||||||||||||||||
Return value
|
0 if method executed successfully, 1 otherwise.
|
||||||||||||||||||||||||
Description
|
|||||||||||||||||||||||||
Related topics
|
Calls
XPRBsetub
|
||||||||||||||||||||||||
|
© 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.