323 views

Skip to first unread message

Mar 17, 2019, 1:47:36 AM3/17/19

to AMPL Modeling Language

Hi there, is there a way to express a goal programming problem in AMPL (using Gurobi as solver)? I have searched the internet and this group and cannot find examples

Thanks I’m advance for your help.

Kristy

Thanks I’m advance for your help.

Kristy

Mar 19, 2019, 2:48:42 PM3/19/19

to Ampl Modeling Language

Gurobi's multi-objective feature can handle more than one objective function in several of the ways that are envisioned by goal programming. To use this feature, you will need to first specify

option gurobi_options 'multiobj=1';

or, if you are already defining a gurobi_options string, add multiobj=1 to it. Then you will need to use suffix commands to define some suffixes, which may include the following:

suffix objpriority IN;

suffix objweight IN;

suffix objreltol IN;

suffix objabstol IN;

As an example, suppose you have used AMPL "minimize" statements to define three objective functions, A, B, and C. If you want Gurobi to minimize a weighted combination 8*A + 2*B + C, use AMPL "let" statements to assign objweight values to the objectives:

let A.objweight := 8;

let B.objweight := 2;

let C.objweight := 1;

Or, if you want Gurobi to first minimize A, then fix A at its minimum value and minimize B, then also fix B at its minimum value and minimize C, you can assign objpriority values to the objectives:

let A.objpriority := 3;

let B.objpriority := 2;

let C.objpriority := 1;

You can use any integers as objpriority values; the objective with the highest priority is minimized first, then the objective with the next highest priority, and so forth. Gurobi also offers two generalizations of this approach:

--

Robert Fourer

am...@googlegroups.com

{#HS:803814743-38664#}
option gurobi_options 'multiobj=1';

or, if you are already defining a gurobi_options string, add multiobj=1 to it. Then you will need to use suffix commands to define some suffixes, which may include the following:

suffix objpriority IN;

suffix objweight IN;

suffix objreltol IN;

suffix objabstol IN;

As an example, suppose you have used AMPL "minimize" statements to define three objective functions, A, B, and C. If you want Gurobi to minimize a weighted combination 8*A + 2*B + C, use AMPL "let" statements to assign objweight values to the objectives:

let A.objweight := 8;

let B.objweight := 2;

let C.objweight := 1;

Or, if you want Gurobi to first minimize A, then fix A at its minimum value and minimize B, then also fix B at its minimum value and minimize C, you can assign objpriority values to the objectives:

let A.objpriority := 3;

let B.objpriority := 2;

let C.objpriority := 1;

You can use any integers as objpriority values; the objective with the highest priority is minimized first, then the objective with the next highest priority, and so forth. Gurobi also offers two generalizations of this approach:

- If two objectives have the same priority, then their weighted sum is minimized, using weights given by objweight. For example if B.objpriority is set instead to 1 above, then after A is minimized, Gurobi fixes A at its minimum value and minimizes 2*B + C.
- You can assign an objreltol or objabstol value to an objective to allow its objective value to be degraded by a limited amount when lower-priority objectives are optimized. For example, if in addition to the priorities shown above, you set A.objreltol to 0.05, then instead of fixing A at its minimum value, Gurobi adds a constraint that A's value must be <= its minimum value plus 5%. Or, if you set A.objabstol to 100, then instead of fixing A at its minimum value, Gurobi adds a constraint that A's value must be <= its minimum value plus 100.

--

Robert Fourer

am...@googlegroups.com

Mar 27, 2019, 2:17:16 AM3/27/19

to AMPL Modeling Language

I'm trying to implement this, and I think I'm missing something. Example code:

**reset**;

**option** solver gurobi_ampl;

**var** x **binary**;

**minimize** OF_0: 1-x;

**minimize** OF_1: x;

**option** gurobi_options "multiobj=1";

**suffix** objpriority **IN**;

**let** OF_0.objpriority := 2;

**let** OF_1.objpriority := 1;

**solve**;

**printf** "x = %s\n", x;

Since priority for OF_1 is set lower than for OF_0, I would expect this to minimize OF_0 first i.e. set x=1. Instead, it returns x=0. If I swap the priority values, it still returns x=0. On the other hand, if I define OF_1 before OF_0 then the optimization returns x=1 (prioritizing OF_0) regardless of whether I set OF_1 as higher priority.

What have I missed here?

Thanks in advance - Geoffrey

Mar 27, 2019, 12:20:00 PM3/27/19

to Ampl Modeling Language

We are not seeing this problem. When running the example shown in your message, we get x = 1:

ampl: model multiobj.mod;

Gurobi 8.1.0: multiobj=1

Gurobi 8.1.0: optimal solution; objective 0

Individual objective values:

_sobj[1] = 0

_sobj[2] = 1

x = 1

(You can ignore the messages "No basis" and "Objective = OF_0".) When the priority values are reversed, we get x = 0. Are you using Gurobi 8.1? There may be have been some bugs with this feature in earlier versions.

--

Robert Fourer

am...@googlegroups.com

{#HS:803814743-38664#}
ampl: model multiobj.mod;

Gurobi 8.1.0: multiobj=1

Gurobi 8.1.0: optimal solution; objective 0

Individual objective values:

_sobj[1] = 0

_sobj[2] = 1

x = 1

(You can ignore the messages "No basis" and "Objective = OF_0".) When the priority values are reversed, we get x = 0. Are you using Gurobi 8.1? There may be have been some bugs with this feature in earlier versions.

--

Robert Fourer

am...@googlegroups.com

Mar 27, 2019, 6:57:41 PM3/27/19

to AMPL Modeling Language

Sounds like it's a version issue. We're still on Gurobi 7.0.2 here, though hoping to update soon. (Software updates here have to go through an approvals process, which is... kind of lengthy.)

In the meantime, I should be able to script around it, now that I know it's not a syntax issue.

Thanks - Geoffrey

Apr 1, 2019, 10:45:40 PM4/1/19

to AMPL Modeling Language

Confirming that running on Gurobi 8.1 resolved this issue.

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu