Minimizng the Lagrange multiplier (marginal values)

Hi,

Could anyone shed some light here with regards to the following question please.
Suppose you solve the (primal) problem and read the marginal values (lagrange multiplier). Is there any chance we can minimize these marginal values by fixing the solution to the primal model and solve the problem again?
I mean suppose we have an equation and we read its marginal value as Eq.m. Now is it possible to minimize this value as a variable to another optimization problem?

Thanks,

\

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/_qJzVAQ_6NYJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Primal,

This is an interesting question. One way to do this is to solve a
bilevel program, where the inner or lower-level problem is the
original, primal problem and the outer or upper-level problem is
simply to optimize whatever combination of the marginal and level
values you are interested in.

I am attaching two examples of how this can be done easily in GAMS
using the EMP (Extended Math Programming) framework. Both are based
on the transport model from the GAMS model library. In the first, we
compute the minimum and maximum shipment levels from Seattle s.t. we
have an optimal LP solution. In the second, I add an upper bound to
one of the variables so the model has multiple dual solutions and then
find the minimum and maximum values for the sum of the demand
marginals, s.t. we have an optimal LP solution. When optimizing over
the LP dual values we need use the “dualVar” syntax to introduce a
variable dPrice(j). We optimize over dPrice, but internally the JAMS
solver equates dPrice(j) to demand.m(j), the duals for the demand
equation.

Note that you will need GAMS 23.6 or higher to run this.

HTH,

-Steve

On Mon, May 14, 2012 at 9:55 AM, TE wrote:

Hi,

Could anyone shed some light here with regards to the following question
please.
Suppose you solve the (primal) problem and read the marginal values
(lagrange multiplier). Is there any chance we can minimize these marginal
values by fixing the solution to the primal model and solve the problem
again?
I mean suppose we have an equation and we read its marginal value as Eq.m.
Now is it possible to minimize this value as a variable to another
optimization problem?

Thanks,


optLevels.gms (2.37 KB)
optMarginals.gms (2.51 KB)

Thanks Steven,

It helps alot. Just some notes please:

  1. is “Solve transport using lp minimizing z ;” necessary? I mean why we need to solve it for the first time? Does it automatically beng handled in EMP?
  2. what does ‘min z * cost supply demand’ exactly mean in emp info? What is the role of * there?

Thanks,


On Tuesday, May 15, 2012 8:01:18 PM UTC+1, Steven Dirkse wrote:

Primal,

This is an interesting question. One way to do this is to solve a
bilevel program, where the inner or lower-level problem is the
original, primal problem and the outer or upper-level problem is
simply to optimize whatever combination of the marginal and level
values you are interested in.

I am attaching two examples of how this can be done easily in GAMS
using the EMP (Extended Math Programming) framework. Both are based
on the transport model from the GAMS model library. In the first, we
compute the minimum and maximum shipment levels from Seattle s.t. we
have an optimal LP solution. In the second, I add an upper bound to
one of the variables so the model has multiple dual solutions and then
find the minimum and maximum values for the sum of the demand
marginals, s.t. we have an optimal LP solution. When optimizing over
the LP dual values we need use the “dualVar” syntax to introduce a
variable dPrice(j). We optimize over dPrice, but internally the JAMS
solver equates dPrice(j) to demand.m(j), the duals for the demand
equation.

Note that you will need GAMS 23.6 or higher to run this.

HTH,

-Steve

On Mon, May 14, 2012 at 9:55 AM, TE wrote:

Hi,

Could anyone shed some light here with regards to the following question
please.
Suppose you solve the (primal) problem and read the marginal values
(lagrange multiplier). Is there any chance we can minimize these marginal
values by fixing the solution to the primal model and solve the problem
again?
I mean suppose we have an equation and we read its marginal value as Eq.m.
Now is it possible to minimize this value as a variable to another
optimization problem?

Thanks,


“gamsworld” group.
To view this discussion on the web visit
https://groups.google.com/d/msg/gamsworld/-/_qJzVAQ_6NYJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to
gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/gamsworld?hl=en.




Steven Dirkse, Ph.D.
GAMS Development Corp., Washington DC
Voice: (202)342-0180 Fax: (202)342-0181
sdirkse@gams.com
http://www.gams.com


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/d9CeICtn874J.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

On Wed, May 16, 2012 at 7:56 AM, TE wrote:

Thanks Steven,

It helps alot. Just some notes please:

  1. is “Solve transport using lp minimizing z ;” necessary? I mean why we
    need to solve it for the first time? Does it automatically beng handled in
    EMP?

The “solve using EMP” results in the creation and solution of an MPEC
(Math Program with Equilibrium Constraints) model. This MPEC model
creation does not depend on the solution of the inner LP, but MPEC
models can be difficult to solve. I didn’t get a solution on my first
try without the LP solve, so I put that in there to give a feasible
start point for the equilibrium constraints.

\

  1. what does ‘min z * cost supply demand’ exactly mean in emp info? What is
    the role of * there?

The JAMS & EMP documentation will say more than I can here and can be
found at http://www.gams.com/dd/docs/solvers/emp.pdf. Briefly, the
“min z * cost supply demand” is there to say what variables and
equations belong to the inner problem, while what remains belongs in
the outer problem. In this case, all the constraints but the one
defining the outer objective belong to the inner problem. The “*”
says that all variables not otherwise assigned belong to this inner
problem.

HTH,

Steve

Thanks Steven. It definitely helped a lot.

Do you mind if I ask how to make only one of dPrice minimized instead of the summation over all of them? I mean how to indicate that the dPrice is only for the first demand equation?

Thanks,


On Wednesday, May 16, 2012 10:05:09 PM UTC+1, Steven Dirkse wrote:

On Wed, May 16, 2012 at 7:56 AM,

Thanks Steven,

It helps alot. Just some notes please:

  1. is “Solve transport using lp minimizing z ;” necessary? I mean why we
    need to solve it for the first time? Does it automatically beng handled in
    EMP?

The “solve using EMP” results in the creation and solution of an MPEC
(Math Program with Equilibrium Constraints) model. This MPEC model
creation does not depend on the solution of the inner LP, but MPEC
models can be difficult to solve. I didn’t get a solution on my first
try without the LP solve, so I put that in there to give a feasible
start point for the equilibrium constraints.

\

  1. what does ‘min z * cost supply demand’ exactly mean in emp info? What is
    the role of * there?

The JAMS & EMP documentation will say more than I can here and can be
found at http://www.gams.com/dd/docs/solvers/emp.pdf. Briefly, the
“min z * cost supply demand” is there to say what variables and
equations belong to the inner problem, while what remains belongs in
the outer problem. In this case, all the constraints but the one
defining the outer objective belong to the inner problem. The “*”
says that all variables not otherwise assigned belong to this inner
problem.

HTH,

Steve


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/-PrjtauHbPcJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

he syntax allows this. It’s a bit more clumsy to do things item by item. The scarfemp-dem model in emplib gives an example where these are mixed - you can use exclusions on the loops to restrict what goes where.

On May 17, 2012, at 8:14 AM, TE wrote:

Thanks Steven. It definitely helped a lot.

Do you mind if I ask how to make only one of dPrice minimized instead of the summation over all of them? I mean how to indicate that the dPrice is only for the first demand equation?

Thanks,

On Wednesday, May 16, 2012 10:05:09 PM UTC+1, Steven Dirkse wrote:
On Wed, May 16, 2012 at 7:56 AM,

Thanks Steven,

It helps alot. Just some notes please:

  1. is “Solve transport using lp minimizing z ;” necessary? I mean why we
    need to solve it for the first time? Does it automatically beng handled in
    EMP?

The “solve using EMP” results in the creation and solution of an MPEC
(Math Program with Equilibrium Constraints) model. This MPEC model
creation does not depend on the solution of the inner LP, but MPEC
models can be difficult to solve. I didn’t get a solution on my first
try without the LP solve, so I put that in there to give a feasible
start point for the equilibrium constraints.

  1. what does ‘min z * cost supply demand’ exactly mean in emp info? What is
    the role of * there?

The JAMS & EMP documentation will say more than I can here and can be
found at http://www.gams.com/dd/docs/solvers/emp.pdf. Briefly, the
“min z * cost supply demand” is there to say what variables and
equations belong to the inner problem, while what remains belongs in
the outer problem. In this case, all the constraints but the one
defining the outer objective belong to the inner problem. The “*”
says that all variables not otherwise assigned belong to this inner
problem.

HTH,

Steve


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/-PrjtauHbPcJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

All the usual GAMS algebra can be used here, so you could say simply

zOutDef … zOut =e= dPrice(‘chicago’);


On Thu, May 17, 2012 at 9:14 AM, TE wrote:

Thanks Steven. It definitely helped a lot.

Do you mind if I ask how to make only one of dPrice minimized instead of the
summation over all of them? I mean how to indicate that the dPrice is only
for the first demand equation?

Thanks,

On Wednesday, May 16, 2012 10:05:09 PM UTC+1, Steven Dirkse wrote:

On Wed, May 16, 2012 at 7:56 AM,

Thanks Steven,

It helps alot. Just some notes please:

  1. is “Solve transport using lp minimizing z ;” necessary? I mean why we
    need to solve it for the first time? Does it automatically beng handled
    in
    EMP?

The “solve using EMP” results in the creation and solution of an MPEC
(Math Program with Equilibrium Constraints) model. This MPEC model
creation does not depend on the solution of the inner LP, but MPEC
models can be difficult to solve. I didn’t get a solution on my first
try without the LP solve, so I put that in there to give a feasible
start point for the equilibrium constraints.

  1. what does ‘min z * cost supply demand’ exactly mean in emp info? What
    is
    the role of * there?

The JAMS & EMP documentation will say more than I can here and can be
found at http://www.gams.com/dd/docs/solvers/emp.pdf. Briefly, the
“min z * cost supply demand” is there to say what variables and
equations belong to the inner problem, while what remains belongs in
the outer problem. In this case, all the constraints but the one
defining the outer objective belong to the inner problem. The “*”
says that all variables not otherwise assigned belong to this inner
problem.

HTH,

Steve


“gamsworld” group.
To view this discussion on the web visit
https://groups.google.com/d/msg/gamsworld/-/-PrjtauHbPcJ.

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to
gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/gamsworld?hl=en.



– Steven Dirkse, Ph.D. GAMS Development Corp., Washington DC Voice: (202)342-0180 Fax: (202)342-0181 sdirkse@gams.com http://www.gams.com

Thanks Micheal, I will look through it.
Cheers

On Thursday, May 17, 2012 3:30:23 PM UTC+1, Michael wrote:

he syntax allows this. It’s a bit more clumsy to do things item by item. The scarfemp-dem model in emplib gives an example where these are mixed - you can use exclusions on the loops to restrict what goes where.

On May 17, 2012, at 8:14 AM, TE wrote:

Thanks Steven. It definitely helped a lot.

Do you mind if I ask how to make only one of dPrice minimized instead of the summation over all of them? I mean how to indicate that the dPrice is only for the first demand equation?

Thanks,

On Wednesday, May 16, 2012 10:05:09 PM UTC+1, Steven Dirkse wrote:
On Wed, May 16, 2012 at 7:56 AM,

Thanks Steven,

It helps alot. Just some notes please:

  1. is “Solve transport using lp minimizing z ;” necessary? I mean why we
    need to solve it for the first time? Does it automatically beng handled in
    EMP?

The “solve using EMP” results in the creation and solution of an MPEC
(Math Program with Equilibrium Constraints) model. This MPEC model
creation does not depend on the solution of the inner LP, but MPEC
models can be difficult to solve. I didn’t get a solution on my first
try without the LP solve, so I put that in there to give a feasible
start point for the equilibrium constraints.

  1. what does ‘min z * cost supply demand’ exactly mean in emp info? What is
    the role of * there?

The JAMS & EMP documentation will say more than I can here and can be
found at http://www.gams.com/dd/docs/solvers/emp.pdf. Briefly, the
“min z * cost supply demand” is there to say what variables and
equations belong to the inner problem, while what remains belongs in
the outer problem. In this case, all the constraints but the one
defining the outer objective belong to the inner problem. The “*”
says that all variables not otherwise assigned belong to this inner
problem.

HTH,

Steve


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/-PrjtauHbPcJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/vBo1f8CUWg8J.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Steven, thanks a lot
I followed your advise and I did
zOutDef … zOut =e= dPrice(‘chicago’);

but I get the following problem:

IN EQUATION demand(new-york)
AND VARIABLE dPrice(chicago)
1 e. r r o r (s): dualVAR pair has different domains
1 e r. r o r (s): dualVar pair of different size

do you know the possible reason?
Thanks again

On Tuesday, May 15, 2012 8:01:18 PM UTC+1, Steven Dirkse wrote:

Primal,

This is an interesting question. One way to do this is to solve a
bilevel program, where the inner or lower-level problem is the
original, primal problem and the outer or upper-level problem is
simply to optimize whatever combination of the marginal and level
values you are interested in.

I am attaching two examples of how this can be done easily in GAMS
using the EMP (Extended Math Programming) framework. Both are based
on the transport model from the GAMS model library. In the first, we
compute the minimum and maximum shipment levels from Seattle s.t. we
have an optimal LP solution. In the second, I add an upper bound to
one of the variables so the model has multiple dual solutions and then
find the minimum and maximum values for the sum of the demand
marginals, s.t. we have an optimal LP solution. When optimizing over
the LP dual values we need use the “dualVar” syntax to introduce a
variable dPrice(j). We optimize over dPrice, but internally the JAMS
solver equates dPrice(j) to demand.m(j), the duals for the demand
equation.

Note that you will need GAMS 23.6 or higher to run this.

HTH,

-Steve

On Mon, May 14, 2012 at 9:55 AM, TE wrote:

Hi,

Could anyone shed some light here with regards to the following question
please.
Suppose you solve the (primal) problem and read the marginal values
(lagrange multiplier). Is there any chance we can minimize these marginal
values by fixing the solution to the primal model and solve the problem
again?
I mean suppose we have an equation and we read its marginal value as Eq.m.
Now is it possible to minimize this value as a variable to another
optimization problem?

Thanks,


“gamsworld” group.
To view this discussion on the web visit
https://groups.google.com/d/msg/gamsworld/-/_qJzVAQ_6NYJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to
gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/gamsworld?hl=en.




Steven Dirkse, Ph.D.
GAMS Development Corp., Washington DC
Voice: (202)342-0180 Fax: (202)342-0181
sdirkse@gams.com
http://www.gams.com


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/I_uFj1PPFjkJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

I followed your advise and I did

zOutDef … zOut =e= dPrice(‘chicago’);

but I get the following problem:

IN EQUATION demand(new-york)
AND VARIABLE dPrice(chicago)
1 e. r r o r (s): dualVAR pair has different domains
1 e r. r o r (s): dualVar pair of different size

do you know the possible reason?
Thanks again




On Thursday, May 17, 2012 3:37:42 PM UTC+1, Steven Dirkse wrote:

All the usual GAMS algebra can be used here, so you could say simply

zOutDef … zOut =e= dPrice(‘chicago’);


On Thu, May 17, 2012 at 9:14 AM, TE wrote:

Thanks Steven. It definitely helped a lot.

Do you mind if I ask how to make only one of dPrice minimized instead of the
summation over all of them? I mean how to indicate that the dPrice is only
for the first demand equation?

Thanks,

On Wednesday, May 16, 2012 10:05:09 PM UTC+1, Steven Dirkse wrote:

On Wed, May 16, 2012 at 7:56 AM,

Thanks Steven,

It helps alot. Just some notes please:

  1. is “Solve transport using lp minimizing z ;” necessary? I mean why we
    need to solve it for the first time? Does it automatically beng handled
    in
    EMP?

The “solve using EMP” results in the creation and solution of an MPEC
(Math Program with Equilibrium Constraints) model. This MPEC model
creation does not depend on the solution of the inner LP, but MPEC
models can be difficult to solve. I didn’t get a solution on my first
try without the LP solve, so I put that in there to give a feasible
start point for the equilibrium constraints.

  1. what does ‘min z * cost supply demand’ exactly mean in emp info? What
    is
    the role of * there?

The JAMS & EMP documentation will say more than I can here and can be
found at http://www.gams.com/dd/docs/solvers/emp.pdf. Briefly, the
“min z * cost supply demand” is there to say what variables and
equations belong to the inner problem, while what remains belongs in
the outer problem. In this case, all the constraints but the one
defining the outer objective belong to the inner problem. The “*”
says that all variables not otherwise assigned belong to this inner
problem.

HTH,

Steve


“gamsworld” group.
To view this discussion on the web visit
https://groups.google.com/d/msg/gamsworld/-/-PrjtauHbPcJ.

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to
gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/gamsworld?hl=en.




Steven Dirkse, Ph.D.
GAMS Development Corp., Washington DC
Voice: (202)342-0180 Fax: (202)342-0181
sdirkse@gams.com
http://www.gams.com


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/vS6KXc8-xi8J.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

TE:



You should look at the syntax for EMP. Basically, dPrice is a vector that is equal to the vector of duals for the demand equation. This is described in the info file with this line:



put ‘dualVar dPrice demand’;



When you write dPrice(‘chicago’) then some of the components of dPrice (dprice(‘new-york’) and dPrice(‘topeka’)) do not appear in the EMP model and the matching gets messed up. You can instead write the objective as a weighted sum of duals:



Parameter w(j) weight of the duals / new-york 0.001, chicago 1.0, topeka 0.001 /;

*Parameter w(j) weight of the duals / new-york 0.000, chicago 1.0, topeka 0.000 /;

zOutDef … zOut =e= sum(j, w(j)*dPrice(j));



This works as long as all weights are nonzero. So the line commented out above with some zero weight gives the same error since the corresponding dPrice variables disappear from the model.



Good luck



Arne


\

Arne Stolbjerg Drud

ARKI Consulting & Development A/S

Bagsvaerdvej 246A, DK-2880 Bagsvaerd, Denmark

Phone: (+45) 44 49 03 23, Fax: (+45) 44 49 03 33, email: adrud@arki.dk



From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of TE
Sent: Monday, May 21, 2012 3:23 PM
To: gamsworld@googlegroups.com
Subject: Re: Minimizng the Lagrange multiplier (marginal values)




I followed your advise and I did



zOutDef … zOut =e= dPrice(‘chicago’);

but I get the following problem:

IN EQUATION demand(new-york)
AND VARIABLE dPrice(chicago)
1 e. r r o r (s): dualVAR pair has different domains
1 e r. r o r (s): dualVar pair of different size

do you know the possible reason?
Thanks again




On Thursday, May 17, 2012 3:37:42 PM UTC+1, Steven Dirkse wrote:

All the usual GAMS algebra can be used here, so you could say simply

zOutDef … zOut =e= dPrice(‘chicago’);


On Thu, May 17, 2012 at 9:14 AM, TE wrote:

Thanks Steven. It definitely helped a lot.

Do you mind if I ask how to make only one of dPrice minimized instead of the
summation over all of them? I mean how to indicate that the dPrice is only
for the first demand equation?

Thanks,

On Wednesday, May 16, 2012 10:05:09 PM UTC+1, Steven Dirkse wrote:

On Wed, May 16, 2012 at 7:56 AM,

Thanks Steven,

It helps alot. Just some notes please:

  1. is “Solve transport using lp minimizing z ;” necessary? I mean why we
    need to solve it for the first time? Does it automatically beng handled
    in
    EMP?

The “solve using EMP” results in the creation and solution of an MPEC
(Math Program with Equilibrium Constraints) model. This MPEC model
creation does not depend on the solution of the inner LP, but MPEC
models can be difficult to solve. I didn’t get a solution on my first
try without the LP solve, so I put that in there to give a feasible
start point for the equilibrium constraints.

  1. what does ‘min z * cost supply demand’ exactly mean in emp info? What
    is
    the role of * there?

The JAMS & EMP documentation will say more than I can here and can be
found at http://www.gams.com/dd/docs/solvers/emp.pdf. Briefly, the
“min z * cost supply demand” is there to say what variables and
equations belong to the inner problem, while what remains belongs in
the outer problem. In this case, all the constraints but the one
defining the outer objective belong to the inner problem. The “*”
says that all variables not otherwise assigned belong to this inner
problem.

HTH,

Steve


“gamsworld” group.
To view this discussion on the web visit
https://groups.google.com/d/msg/gamsworld/-/-PrjtauHbPcJ.

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to
gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/gamsworld?hl=en.




Steven Dirkse, Ph.D.
GAMS Development Corp., Washington DC
Voice: (202)342-0180 Fax: (202)342-0181
sdirkse@gams.com
http://www.gams.com


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/vS6KXc8-xi8J.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.