I need two objective funcitons in one model, and I need to choose them
in the run file.
Is there a way to do that?
ampl: model diet1obj.mod;
ampl: data diet1lim.dat;
ampl: option solver cplex;
With the given data, a solution can be found to minimize total costs:
ampl: objective TotalCost;
ampl: solve;
CPLEX 10.1.0: optimal integer solution; objective 16.52
87 MIP simplex iterations
30 branch-and-bound nodes
ampl: display TotalCost, TotalNutr['Cals'];
TotalCost = 16.52
TotalNutr['Cals'] = 3350
Or the objective can be changed to one that minimizes total calories:
ampl: objective TotalNutr['Cals'];
ampl: solve;
CPLEX 10.1.0: optimal integer solution; objective 3195
35 MIP simplex iterations
9 branch-and-bound nodes
ampl: display TotalCost, TotalNutr['Cals'];
TotalCost = 17.84
TotalNutr['Cals'] = 3195
If no objective is specified, then the the first one is chosen by default.
Bob Fourer
4...@ampl.com
On May 19, 5:20 pm, huang...@gmail.com wrote: