Solved

# multiple optimization

• Newcomer
• 27 replies
Hi,
I would like to do a multiple optimization in AIMMS. For example I would concurrently minimize the costs and maximize the amount of captured carbon dioxide.
How can I set this kind of optimization in AIMMS?
Thanks.
Best
icon

Best answer by Marcel Hunting 26 August 2019, 16:56

View original

### 13 replies

Userlevel 5 +4
You can use the multi-objective optimization functionality in AIMMS for this. It is explained and demonstrated in this article.

Note that you can specify only one optimization direction for the whole set of multi-objectives (minimization or maximization). However, by specifying a negative weight for an objective, you can reverse the optimization direction of any objective.
Userlevel 5 +2
There is a period in the end of Marcel's link that leads to 404: article. Thanks for sharing the aimms project!
Userlevel 5 +4
Dear,
thanks for your responses. However, how can I set it in AIMMS?
For example, if I have to minimaze only the costs, I have to define the objective function and then select the mathematical programm that minimize it.
In the case of you objective function how can I write it?
Best
GL
Userlevel 5 +5
@graleo , as mentioned in the article Marcel shared, you need to use a AIMMS version which has CPLEX 12.9 (AIMMS 4.65 and above). Make sure to set CPLEX 12.9 as the default solver from Tools -> Solver configuration.

You said you wanted to minimize costs and maximize CO2 captured

For example I would concurrently minimize the costs and maximize the amount of captured carbon dioxide.

As Marcel already mentioned, you can only have a single direction to the multiple math programs to use CPLEX multi-objective. Say, vTotalCosts is the total cost objective and vCarbonCapture is the total CO2 captured.

1. Create a mathprogram mpMinCosts with vTotalCosts as the objective and minimize as the direction.
2. Now, modify vCarbonCapture by multiplying its definition with -1. If original value of vCaronCapture was 10, now it should be -10.
Now, write the procedure as shown in the article. You can set the values for priority, weight, abstol and reltol as per your problem requirement. Read the documentation of GMP::Column::SetAsMultiObjective in the Function Ref document (in AIMMS, Help -> Function reference, or Right click on the function after typing it in a procedure and click on Help on). The below code will prioritize minimizing total costs over maximizing CO2 captured because priority of vTotalCosts is set as 2. Hope this helps.

code:
`Procedure SolveMultiObj {    Body: {        ep_GMP := gmp::Instance::Generate( mpMinCosts );        GMP::Column::SetAsMultiObjective(                    GMP      :  ep_GMP,                    column   :  vTotalCosts,                    priority :  2,                    weight   :  1,                    abstol   :  0,                    reltol   :  0.1);                GMP::Column::SetAsMultiObjective(                    GMP      :  ep_GMP,                    column   :  vCarbonCapture,                    priority :  1,                    weight   :  1,                    abstol   :  0,                    reltol   :  0.0);                GMP::Instance::Solve( ep_GMP );            }        }`
Dear @mohansx mohansx
Why have I to multiply vCarbonCapture for -1? Do you mean the value that should have the objective function? What are the meaning of priority, weight, abstol and reltol and how can I define these?
Is this the epsilon constraint method or just a method to solve the MOO?
I would have to find the pareto solution also.
Thank you very much.
Best
GL
Userlevel 5 +4
You have to multiply vCarbonCapture by -1 because you want to minimize the costs and maximize the amount of captured carbon dioxide. However, in multi-objective optimization you can only specify one optimization direction, so either minimize or maximize, which means that you have to change the maximization into a minimization (or the minimization into a maximization). Note that maximizing f(x) is equivalent to minimizing -f(x). Multiplying vCarbonCapture by -1 means that you multiply all coefficients in the definition of vCarbonCapture by -1.

AIMMS uses CPLEX or Gurobi to solve multi-objective optimization models. They can uses two methods, namely blended objective and lexicographic objective. If the lexicographic objective method is used then CPLEX/Gurob will return a pareto optimal solution (if both the relative and absolute tolerances are 0). The lexicographic objective method implies that you have to specify unique priorities for each objective. The meaning of priority, weight, abstol and reltol is explained in section 16.7 of the AIMMS Language Reference. How to set these values is illustrated by the example code provided by Mohan.

AIMMS (to be more precise, CPLEX/Gurobi) does not use the epsilon constraint method for solving multi-objective optimization problems.
Dear @Marcel Hunting
thanks for your response. In the model vCarbonCapture is defined as a variable nonnegative? If so, how can I multiply it for -1?
Using lexicograph method priority is defined by the optimization order. Is the weight set as in the shown model above?
Can I use the epsilon constraint model if I write a code for it?
Best
GL
Userlevel 5 +4
Probably the variable vCarbonCapture has a definition or it is used in a constraint, e.g., vCarbonCapture = sum( i, x(i) ). If the variable vCarbonCapture has a definition then you should multiply the expression in the definition by -1. In the latter case you have to change the constraint into vCarbonCapture = - sum( i, x(i) ).

(vCarbonCapture should have a definition or be used in a constraint otherwise the model would be unbounded.)

The weight is indeed set as in the above model. If all priorities are unique then the weights are not important and you can just use 1 for all weights.

You could implement the epsilon constraint model in AIMMS but it could be a lot of work. You could first try the lexicograph method to see whether you obtain good results.
Dear @Marcel Hunting
If I want to implement it with the epsilon contraint, can you give me some indications?
Thanks
Best
GL
Dear all,
I want to write a code in the MainExecution section.
I want to consider in the first cycle a constraint, but I wan't to consider this constraint in the second cycle.
How can I write this?
Thanks
Best
GL
Dear @mohansx
code:
`in your suggested code for the lexicograph method how can I define the "SetAsMultiObjective"?Should I define also other things in the model?BestGL`
dear @mohansx
can I consider acceptable a pareto front with the trend in the figure?
Thanks
Best
GL 