multi obj.optimization.

753 views
Skip to first unread message

Maya Ks

unread,
Jan 7, 2017, 1:39:45 PM1/7/17
to am...@googlegroups.com
Hello sir,

In AMPL can we optimize multi objective optimization (with equality & inequality  constraints) problem ? is there any example for that?.



kind regards

maya.

Robert Fourer

unread,
Jan 9, 2017, 11:51:42 AM1/9/17
to am...@googlegroups.com
An AMPL model can have two or more objective functions defined. However it is up to you to decide what to do with them. For example you can optimize the first objective, then optimize the second objective subject to the first objective being held at its optimal value; see section 8.3 of the AMPL book (http://ampl.com/BOOK/CHAPTERS/11-linprog.pdf#page=6) for some examples. Or you can combine the two objectives by minimizing alpha * the first + (1-alpha) * the second, where alpha is a parameter that can be varied between 0 and 1 to get different tradeoffs. If you are lucky you might find a solution that achieves the optimal value of both objectives at the same time, but in general no such solution exists -- to optimize one objective, you have to allow the other one to take a suboptimal value.

In general, solvers only optimize one objective, so even if your model has several objectives, you will have to decide which objective to use in each optimization run. The new Gurobi version 7.0 does have some multi-objective options; see the entry for 'multiobj' at http://www.gurobi.com/documentation/7.0/ampl-gurobi/parameters.html, and the related options mentioned in that entry.

Bob Fourer
am...@googlegroups.com

=======

vincent gao

unread,
Dec 3, 2017, 11:17:35 PM12/3/17
to AMPL Modeling Language

Hello Bob,

I just saw this post. I am working on a hierarchical LP problem and would love to leverage multi-objective features of AMPL-Gurobi. However, I am having some difficulties specifying multiple objectives in AMPL. I was wondering if you have some examples?

Many thanks for your time in advance!

Robert Fourer

unread,
Dec 4, 2017, 6:49:05 PM12/4/17
to am...@googlegroups.com
For more examples of models that have multiple objectives, see section 2.3 here,

http://www.4er.org/CourseNotes/Book%20A/A-I.pdf#page=24

and the example in this presentation,

http://ampl.com/MEETINGS/TALKS/2017_10_Houston_MB69.pdf

which introduces a second objective on slide 23 and has an example of a script trading off the two objectives beginning on slide 33. For multiple objectives with Gurobi, use the options multiobj, multiobjmethod, and multiobjpre and associated user-defined suffixes described in http://www.gurobi.com/documentation/7.5/ampl-gurobi/parameters.html; reply if you need specific help with any of these. A good description of how Gurobi uses priorities and weights for multi-objective optimization is given in this posting on the Gurobi user forum: https://groups.google.com/d/msg/gurobi/Wlem8kWNQ2A/8lx8RhBLBgAJ.

Bob Fourer
am...@googlegroups.com

=======

vincent gao

unread,
Dec 5, 2017, 5:41:24 PM12/5/17
to AMPL Modeling Language
Thanks a lot! This is really helpful. Now I think I understand how this should work.
I might need some help with the user-defined suffixes. I wrote the code below following http://users.iems.northwestern.edu/~4er/amplweb/NEW/suffixes.html, which does not seem to work:


suffix objpriority >= 0 integer;

minimize Obj1: var1;
minimize Obj2: var2;

let Obj1.objpriority := 10;
let Obj2.objpriority := 2;

It seems from the solution that Obj1 and Obj2 have the same priority, and a solution of minimized Obj1 + Obj2 is returned. Do I have a syntax error?

Many thanks for your help again!

Robert Fourer

unread,
Dec 6, 2017, 11:02:55 AM12/6/17
to am...@googlegroups.com

There is a possibility that the optimal solution with the prioritized objectives is the same as the optimal solution for the summed objectives, but you can easily test this.  The prioritized objectives can be done in AMPL -- without recourse to the Gurobi multi-objective feature -- by use of commands like these:

   param Obj1val;
   subj to Obj1fix: var1 = Obj1val;

   drop Obj1fix;
   objective Obj1;
   solve;

   restore Obj1fix;
   let Obj1val := Obj1;
   objective Obj2;
   solve;

Then you can compare the result that you get after the second solve, to the result that you get from

   minimize Obj3: var1 + var2;

   drop Obj1fix;
   objective Obj3;
   solve;

If the two results are different, then if you can provide us with your example model and data, we will reproduce the problem and get it fixed.

Bob Fourer
am...@googlegroups.com
  

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.

vincent gao

unread,
Dec 6, 2017, 12:25:25 PM12/6/17
to AMPL Modeling Language
Hi Bob,

Thanks a lot for your suggestion!

Attached please find my AMPL test model based on the Python example for multiple-objective (http://www.gurobi.com/documentation/7.5/examples/multiobj_py.html#subsubsection:multiobj.py) and suggestions in this discussion (https://groups.google.com/forum/#!msg/gurobi/Wlem8kWNQ2A/8lx8RhBLBgAJ). I simplified it to two objectives and adjusted coefficients so the solutions would be different if we prioritize obj1, prioritize obj2, or maximize the summed objectives.

I followed your suggestion to prioritize objectives in AMPL, and it works as expected. However, when I used the Gurobi multi-objective feature, the solution does not change as I change priority between obj1 vs obj2.
test_multi.mod

Robert Fourer

unread,
Dec 15, 2017, 9:23:56 AM12/15/17
to am...@googlegroups.com
We have posted an updated gurobi.exe which addresses the problem you reported with multiple objectives in Gurobi.
Reply all
Reply to author
Forward
0 new messages