[AMPL 15304] AMPL - CPLEX needs quadratic constraint for dual prices to be correct, AMPL - Gurobi doesn't. Why?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[AMPL 15304] AMPL - CPLEX needs quadratic constraint for dual prices to be correct, AMPL - Gurobi doesn't. Why?

sels.peter
Dear AMPLers,

We have an issue with a simple linear DC power flow model, formulated in AMPL.

When we use Gurobi as a solver, it solves fine, including the returned values for active power prices.
However, when we use CPLEX as a solver, these returned prices (as the value of the dual variable of the active power balance constraint) are all 0 (which is incorrect).
To solve these zero-problem with CPLEX, we seem to need to enforce the constraint in a quadratic way as:

subject to LineUptoPowerLimitTxSquared{e in TransmissionEdges inter SubNetEdges,fT in ForTimes}: 
        fp[e,"u",fT]^2  <=  S_ji_rated[e]^2 ;
where fp is active power flow on edges and S_ji_rated is just a constant AMPL parameter (always 100 in this case).

If we enforce the constraint instead in a linear way as, 

subject to LineUpPowerLimitTxLb{e in TransmissionEdges inter SubNetEdges,fT in ForTimes}:
        -S_ji_rated[e] <= fp[e,"u",fT];
subject to LineUpPowerLimitTxUb{e in TransmissionEdges inter SubNetEdges,fT in ForTimes}:
                          fp[e,"u",fT] <= S_ji_rated[e];

with CPLEX, we do not get the correct shadow prices for active energy,
but instead get 0 for all active energy shadow prices.

Does anybody know why this happens and how to remediate this?

For example, is there a CPLEX option we can set to tell/convince CPLEX that it is a linear problem?

PS: I cannot post the full AMPL code for the problem.

thanks and best regards,

Peter

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

RE: [AMPL 15325] AMPL - CPLEX needs quadratic constraint for dual prices to be correct, AMPL - Gurobi doesn't. Why?

Robert Fourer-2
You don't need to tell CPLEX that you have a linear problem.  It can be helpful to set "option show_stats 1;" to check that AMPL finds the problem to be linear.

In the linear case, your constraints are simple bounds on the variables, and so normally AMPL's presolve phase removes those constraints and instead merges -S_ji_rated[e] and S_ji_rated[e] with the lower and upper bounds on fp[e,"u",fT] that are sent to CPLEX as part of the description of the variable.  When the solution is returned by CPLEX, AMPL performs a "postsolve" that uses the reduced costs of the fp[e,"u",fT] variables to infer the dual values on the bound constraints.  So here are two troubleshooting steps:

(1) Set "option presolve 0;" before solving and then display the dual values to see whether they are still all zero.

(2) Remove (or comment out) the constraints LineUpPowerLimitTxLb and LineUpPowerLimitTxUb, and instead define "var fp {...your indexing...} >= -S_ji_rated[e], <= S_ji_rated[e];".  After solving, display the fp[e,"u",fT].rc values to see whether or not they are all zero.

The results of these tests should at least suggest to us where to look for the problem.  It will also be helpful if you can copy into your reply the messages produced by these AMPL commands,

   option version;
   shell "cplex -v";

and the "solve;" output produced by CPLEX on the linear model (which shows the options you are using).

Bob Fourer
[hidden email]

=======

We have an issue with a simple linear DC power flow model, formulated in AMPL.

When we use Gurobi as a solver, it solves fine, including the returned values for active power prices.
However, when we use CPLEX as a solver, these returned prices (as the value of the dual variable of the active power balance constraint) are all 0 (which is incorrect).
To solve these zero-problem with CPLEX, we seem to need to enforce the constraint in a quadratic way as:

subject to LineUptoPowerLimitTxSquared{e in TransmissionEdges inter SubNetEdges,fT in ForTimes}:
        fp[e,"u",fT]^2  <=  S_ji_rated[e]^2 ;
where fp is active power flow on edges and S_ji_rated is just a constant AMPL parameter (always 100 in this case).

If we enforce the constraint instead in a linear way as,

subject to LineUpPowerLimitTxLb{e in TransmissionEdges inter SubNetEdges,fT in ForTimes}:
        -S_ji_rated[e] <= fp[e,"u",fT];
subject to LineUpPowerLimitTxUb{e in TransmissionEdges inter SubNetEdges,fT in ForTimes}:
                          fp[e,"u",fT] <= S_ji_rated[e];

with CPLEX, we do not get the correct shadow prices for active energy,
but instead get 0 for all active energy shadow prices.

Does anybody know why this happens and how to remediate this?

For example, is there a CPLEX option we can set to tell/convince CPLEX that it is a linear problem?

PS: I cannot post the full AMPL code for the problem.


--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.