> Languages and APIs > ILOG Concert Technology for C#.NET Users > Model |
Model |
INDEX PREVIOUS NEXT |
This example was chosen because it is simple enough to be viewed by rows as well as by columns. Both ways are implemented in the finished application. In this example, either perspective can be viewed as natural. Only one approach will seem natural for many models, but there is no general way of determining which is more appropriate (rows or columns) in a particular case.
Step 3 - | Create the model |
Go to the comment Step 3 in Dietlesson.cs
, and add this statement to create the Cplex
model for your application.
Cplex cplex = new Cplex(); |
Step 4 - | Create an array to store the variables |
Go to the comment Step 4 in Dietlesson.cs
, and add this statement to create the array of numeric 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 variables will be created later as continuous or discrete, depending on user input. These numeric variables represent the unknowns: how much of each food to buy.
Step 5 - | Indicate by row or by column |
Go to the comment Step 5 in Dietlesson.cs
, and add the following lines to indicate whether 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 user to apply this conditional statement.
Copyright © 1987-2003 ILOG, S.A. All rights reserved. Legal terms. | PREVIOUS NEXT |