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.

◆CPXsetstrparam accepts arguments to indicate:●●the environment; that is, a pointer of type CPXENVptr returned by CPXopen<strong>CPLEX</strong>;the parameter to set; this routine sets parameters of type const char*;● the value you want the parameter to assume.The reference manual <strong>ILOG</strong> <strong>CPLEX</strong> Parameters documents the type of each parameter(int, double, char*) along with the symbolic constant and reference number representingthe parameter.The routine CPXsetdefaults resets all parameters (except the log file) to their defaultvalues, including the <strong>ILOG</strong> <strong>CPLEX</strong> callback functions. This routine resets the callbackfunctions to NULL. Like other Callable Library routines to manage parameters, this oneaccepts an argument indicating the environment, and it returns 0 for success or a nonzerovalue in case of error.Example: Optimizing the Diet Problem in the Callable LibraryThe optimization problem solved in this example is to compose a diet from a set of foods, sothat the nutritional requirements are satisfied and the total cost is minimized. The examplediet.c illustrates these points:◆ Creating a Model Row by Row on page 126;◆ Creating a Model Column by Column on page 126;◆ Solving the Model with CPXlpopt on page 127.Problem RepresentationThe problem contains a set of foods, which are the modeling variables; a set of nutritionalrequirements to be satisfied, which are the constraints; and an objective of minimizing thetotal cost of the food. There are two ways to look at this problem:◆◆The problem can be modeled in a row-wise fashion, by entering the variables first andthen adding the constraints on the variables and the objective function.The problem can be modeled in a column-wise fashion, by constructing a series of emptyconstraints and then inserting the variables into the constraints and the objectivefunction.The diet problem is equally suited for both kinds of modeling. In fact you can even mix bothapproaches in the same program: If a new food product is introduced, you can create a newvariable for it, regardless of how the model was originally built. Similarly, is a new nutrientis discovered, you can add a new constraint for it.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL 125

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

Saved successfully!

Ooh no, something went wrong!