IloObject | +--IloOplCplexVectors
See the Overview for a general presentation of the ILOG Script extensions for OPL.
See the CPLEX documentation for the methods
IloCplex::getStart and IloCplex::setStart or for
CPXgetmipstart, CPXcopymipstart for details.
int maxOfx = ...;
dvar int x;
maximize x;
subject to {
x<=maxOfx;
}maxOfx=10;
main {
var vectors= new IloOplCplexVectors();
var source = new IloOplModelSource("basicmodel2.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 ( !vectors.getStart(cplex) ) {
writeln("warm start preparation failed: ",vectors.status);
} else {
writeln("warm start preparation successful ");
}
var opl2 = new IloOplModel(def,cplex);
var data2= new IloOplDataElements();
data2.maxOfx=11;
opl2.addDataSource(data2);
opl2.generate();
if ( !vectors.setStart(cplex) ) {
writeln("warm start ",vectors.Nrows,"x",vectors.Ncols," failed: ",vectors.status);
} else {
writeln("warm start ",vectors.Nrows,"x",vectors.Ncols," succeeded ");
}
if (cplex.solve()) {
writeln("OBJ = " + cplex.getObjValue());
} else {
writeln("No solution");
}
opl.end();
opl2.end();
data.end();
def.end();
cplex.end();
vectors.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 CPLEX matrix
from which the warm start information has been taken.
|
| flow control |
Accesses the number of rows in the CPLEX matrix from which the vectors have been taken.
|
| flow control |
The CPLEX status of the last call.
|
| Method Attributes | Method Name and Description |
|---|---|
| flow control |
attach(dvars, values)
Attaches a variable array to a value array.
|
| flow control |
clear()
Clears the vector from either all the previous attach commands or the getStart call.
|
| flow control |
deleteStart(cplex)
Deletes the MIP start information for the given CPLEX instance.
|
| flow control |
getStart(cplex)
Saves the MIP start information for the given CPLEX instance.
|
| flow control |
setStart(cplex)
Restores the MIP start information available for the given CPLEX instance.
|
| end |
true if successful. The CPLEX return status is available as the property status.cplex object. Depending on the
success the function returns with a different value and sets the
status field of the invoking instance to a different value:
| return value | status | meaning |
| true | 0 | All starting information set successfully. |
| true | 1219 (CPXERR_NO_NAMES) |
The variables in cplex have no names, no starting
information was set. |
| true | 1210 (CPXERR_NAME_NOT_FOUND) |
At least one variable/value pair could not be set since a variable
of that name was not found in cplex. Other variables may
have been set correctly. |
| false | Typically non-zero | Something else went wrong. |
true if successful. The CPLEX return status is available as the property status.