Skip to main content
PREV CLASS NEXT CLASS FRAMES NO FRAMES

 

Class IloOplModelDefinition

IloObject
   |
   +--IloOplModelDefinition

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();
}
Iterating properties:
Default behavior.
Index resolution:
Default behavior.
Available for:
flow control

Constructor Summary
Constructor Attributes Constructor Name and Description
 
IloOplModelDefinition(modelSource)
Property Summary
Field Attributes Field Name and Description
flow control
The underlying model source.
Method Summary
Method Attributes Method Name and Description
flow control
Model with main scripting.
flow control
Accesses a model for the CP Optimizer engine.
flow control
Accesses a model for the CPLEX engine.
Methods inherited from class IloObject
end
Constructor Detail
IloOplModelDefinition
IloOplModelDefinition(modelSource)
Parameters:
modelSource - An instance of IloOplModelSource.
Property Detail
modelSource
{IloOplModelSource} modelSource
The underlying model source.
Available for:
flow control
Method Detail
hasMain
{boolean} hasMain()
Model with main scripting.
Returns:
true if this model definition has a main scripting block defined.
Available for:
flow control

isUsingCP
{boolean} isUsingCP()
Accesses a model for the CP Optimizer engine.
Returns:
true if this model definition is using CP Optimizer.
Available for:
flow control

isUsingCplex
{boolean} isUsingCplex()
Accesses a model for the CPLEX engine.
Returns:
true if this model definition is using CPLEX.
Available for:
flow control

©Copyright IBM Corp. 1987-2011.