12.07.2015 Views

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Developing a ModelAs in other examples in this manual, this application begins by creating an environment, aninstance of IloEnv.IloEnv env;Within that environment, a model for this problem is created as an instance of IloModel.IloModel model(env);Then constraints and an objective are added to the model. The following sections sketchthese steps.◆ Representing the Data on page 345◆ Adding Constraints on page 345◆ Checking Convexity and Concavity on page 346◆ Adding an Objective on page 346Representing the DataAs in other examples, the template class IloArray appears in a type definition to creatematrices for this problem, like this:typedef IloArray NumMatrix;typedef IloArray NumVarMatrix;Those two-dimensional arrays (that is, arrays of arrays) are now available in the applicationto represent the demands from the showrooms and the supplies available from the factories.IloInt nbDemand = 4;IloInt nbSupply = 3;IloNumArray supply(env, nbSupply, 1000., 850., 1250.);IloNumArray demand(env, nbDemand, 900., 1200., 600., 400.);NumVarMatrix x(env, nbSupply);NumVarMatrix y(env, nbSupply);for(i = 0; i < nbSupply; i++){x[i] = IloNumVarArray(env, nbDemand, 0, IloInfinity, ILOFLOAT);y[i] = IloNumVarArray(env, nbDemand, 0, IloInfinity, ILOFLOAT);}Adding ConstraintsAccording to the description of the problem, the supply of cars from the factories must meetthe demand of the showrooms. At the same time, it is important not to ship cars that are not<strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL 345

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!