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.

Step 3Create the modelGo to the comment Step 3 in Dietlesson.cs, and add this statement to create the Cplexmodel for your application.Cplexcplex = new Cplex();Step 4Create an array to store the variablesGo to the comment Step 4 in Dietlesson.cs, and add this statement to create the array ofnumeric variables that will appear in the solution.INumVar[] Buy= new INumVar[nFoods];At this point, only the array has been created, not the variables themselves. The variableswill be created later as continuous or discrete, depending on user input. These numericvariables represent the unknowns: how much of each food to buy.Step 5Indicate by row or by columnGo to the comment Step 5 in Dietlesson.cs, and add the following lines to indicatewhether to build the problem by rows or by columns.if ( byColumn ) BuildModelByColumn(cplex, data, Buy, varType);else BuildModelByRow (cplex, data, Buy, varType);The finished application interprets an option entered through the command line by the userto apply this conditional statement.Build by RowsThe finished application is capable of building a model by rows or by columns, according toan option entered through the command line by the user. The next steps in this tutorial showyou how to add a static method to your application. This method builds a model by rows.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL 101

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

Saved successfully!

Ooh no, something went wrong!