IloObject | +--IloOplCplexBasis
See the Overview for a general presentation of the ILOG Script extensions for OPL.
See the CPLEX documentation for the methods
IloCplex::getBasisStatuses and IloCplex::setBasisStatuses,
or for CPXgetbasis and CPXcopybasis for details.
float maxOfx = ...;
dvar float x;
maximize x;
subject to {
x<=maxOfx;
}maxOfx=10;
main {
var basis= new IloOplCplexBasis();
var source = new IloOplModelSource("basicmodel.mod");
var cplex = new IloCplex();
var def = new IloOplModelDefinition(source);
var opl = new IloOplModel(def,cplex);
var data = new IloOplDataSource("basicmodel.dat");
opl.addDataSource(data);
opl.generate();
if (cplex.solve()) {
writeln("OBJ = " + cplex.getObjValue());
}
else {
writeln("No solution");
}
if ( !basis.getBasis(cplex) ) {
writeln("warm start preparation failed: ",basis.status);
} else {
writeln("warm start preparation succeeded ");
}
var opl2 = new IloOplModel(def,cplex);
var data2= new IloOplDataElements();
data2.maxOfx=11;
opl2.addDataSource(data2);
opl2.generate();
if ( !basis.setBasis(cplex) ) {
writeln("warm start ",basis.Nrows,"x",basis.Ncols," failed: ",basis.status);
} else {
writeln("warm start ",basis.Nrows,"x",basis.Ncols," succeeded ");
}
if (cplex.solve()) {
writeln("OBJ = " + cplex.getObjValue());
} else {
writeln("No solution");
}
opl.end();
opl2.end();
data.end();
def.end();
cplex.end();
basis.end();
source.end();
}OBJ = 10 warm start preparation succeeded warm start 1x2 succeeded OBJ = 11
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Field Attributes | Field Name and Description |
|---|---|
| flow control |
Accesses the number of columns in the currently stored basis.
|
| flow control |
Accesses the number of rows in the currently stored basis.
|
| flow control |
CPLEX status of last call.
|
| Method Attributes | Method Name and Description |
|---|---|
| flow control |
attach(dvars, statuses)
Attaches a variable array to a status array.
|
| flow control |
getBasis(cplex)
Accesses this basis information from the given CPLEX instance.
|
| flow control |
setBasis(cplex)
Restores the basis information available from the given CPLEX instance.
|
| end |
true if successful. The CPLEX return status is available as the property status.true if successful. The CPLEX return status is available as the property status.