Skip to main content
PREV CLASS NEXT CLASS FRAMES NO FRAMES

 

Class IloOplDataElements

IloObject
   |
   +--IloOplDataSource
      |
      +--IloOplDataElements

Description:

See the Overview for a general presentation of the ILOG Script extensions for OPL.

Example:
For the following basic model:
float maxOfx = ...;
dvar float x;

maximize x;
subject to {
  x<=maxOfx;
}
and the following data:
maxOfx=10;
Flow control script:
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();
}
After execution, the Scripting log shows:
 OBJ = 10
 OBJ = 11
Iterating properties:
Iterates on the OPL data elements available in this data source.
Index resolution:
Default behavior.
Available for:
flow control

Constructor Summary
Constructor Attributes Constructor Name and Description
 
Properties inherited from class IloOplDataSource
name
Methods inherited from class IloObject
end
Constructor Detail
IloOplDataElements
IloOplDataElements()

©Copyright IBM Corp. 1987-2011.