IloObject | +--IloOplDataSource
See the Overview for a general presentation of the ILOG Script extensions for OPL.
float maxOfx = ...;
dvar float x;
maximize x;
subject to {
x<=maxOfx;
}maxOfx=10;
main {
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");
}
var opl2 = new IloOplModel(def,cplex);
var data2= new IloOplDataElements();
data2.maxOfx=11;
opl2.addDataSource(data2);
opl2.generate();
if (cplex.solve()) {
writeln("OBJ = " + cplex.getObjValue());
} else {
writeln("No solution");
}
opl.end();
opl2.end();
data.end();
def.end();
cplex.end();
source.end();
}OBJ = 10 OBJ = 11
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
IloOplDataSource(path)
|
| Field Attributes | Field Name and Description |
|---|---|
| flow control |
Accesses the name of the data source.
|
| end |
.dat file.
This is the path for file model sources.
A data source cannot be reused for multiple models.