> Languages and APIs > ILOG Concert Technology for Java Users > Optimizing the Diet Problem in Java |
Optimizing the Diet Problem in Java |
INDEX PREVIOUS NEXT |
The problem solved in this example is to minimize the cost of a diet that satisfies certain nutritional constraints. You might also want to compare this approach through the Java API of ILOG CPLEX with similar applications in other programming languages:
This example was chosen because it is simple enough to be viewed from a row as well as from a column perspective. Both ways are shown in the example. 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.
The example accepts a filename and two options -c
and -i
as command line arguments. Option -i
allows you to create a MIP model where the quantities of foods to purchase must be integers. Option -c
can be used to build the model by columns.
The example starts by evaluating the command line arguments and reading the input data file. The input data of the diet problem is read from a file using an object of the embedded class Diet.Data
. Its constructor requires a file name as an argument. Using the class InputDataReader
, it reads the data from that file. This class is distributed with the examples, but will not be considered here as it does not use ILOG CPLEX or Concert Technology in any special way.
Copyright © 1987-2003 ILOG, S.A. All rights reserved. Legal terms. | PREVIOUS NEXT |