Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
Expand all | Collapse all

Dual rays from an infeasible primal

  • 1.  Dual rays from an infeasible primal

    Posted Sun February 07, 2010 09:08 AM

    Originally posted by: SystemAdmin


    Hi Everybody,

    I am wondering whether there is any trick in ILOG Concert for the following:

    "I have a problem for which I know if it is infeasible then the dual is unbounded. The dual is an ugly model which I don't like touch it.
    I would rather find a way to extract the rays from the infeasible primal model."

    Does any one has an idea for that?

    kind regards,
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Dual rays from an infeasible primal

    Posted Sun February 07, 2010 12:04 PM

    Originally posted by: Laci Ladanyi


    Try using the CPXdualfarkas advanced function.

    --Laci
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Dual rays from an infeasible primal

    Posted Sun February 07, 2010 12:27 PM

    Originally posted by: SystemAdmin


    > Laci Ladanyi wrote:
    > Try using the CPXdualfarkas advanced function.

    I was wondering about that. Is the vector produced by dualFarkas guaranteed to be a recession direction of the dual?

    /Paul
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Dual rays from an infeasible primal

    Posted Sun February 07, 2010 06:15 PM

    Originally posted by: SystemAdmin


    CPXdualfarkas() is somewhat tricky to understand. The method provides a set of dual multipliers y', such that the aggregated row y'Ax >= y'b is a valid inequality (the signs of y' match the inequality sense of the constraints) that proves infeasibility of the system. Namely, this aggregated row a'x >= b' cannot be made feasible even if you substitute the "most feasible" bound of x_j for each variable x_j. In other words, max{a'x | l <= x <= u} < b'. In this sense, y' is not a dual ray (because y'A does not need to be 0), but you can extend it with suitable reduced cost values (i.e., duals for the bounds) to a dual ray.

    For example, consider the following system:

    1x1 + 3x2 - 2x3 >= 5
    1x1 - 4x2 + 4x3 >= 6

    with bounds 0 <= x1 <= 3, 0 <= x2 <= 5, 0 <= x3 <= 1.

    Then, the dual vector y'=(1,2) yields the aggregated row y'Ax >= y'b that reads

    3x1 - 5x2 + 6x3 >= 17.

    This shows the infeasibility of the model, because substituting the "most feasible" bounds for x yields

    3*3 - 5*0 + 6*1 = 15 < 17.

    Now, if you extend the dual vector y' with reduced costs r' = (-3,5,-6), you get a dual ray:

    1x1 + 3x2 - 2x3 >= 5 (y'_1 = 1)
    1x1 - 4x2 + 4x3 >= 6 (y'_2 = 2)
    x1 <= 3 (r'_1 = -3)
    x2 >= 0 (r'_2 = 5)
    x3 <= 1 (r'_3 = -6)

    Summing this up with the weights of the dual ray yields

    0x1 + 0x2 + 0x3 >= 2,

    which proves the infeasibility of the model.
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Dual rays from an infeasible primal

    Posted Mon April 09, 2012 02:40 PM

    Originally posted by: SystemAdmin


    Tobias,

    For Cplex 12.2 and above, has this procedure of extending a Farkas certificate to a dual ray using reduced costs been included in the cplex.dualFarkas() method ? The Cplex support page

    http://www-01.ibm.com/support/docview.wss?uid=swg21400058

    does not explicitly mention anything about bounded variables. I am particularly interested in the case of solving a infeasible primal using dual simplex method.

    Thanks,
    Akshay.
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Dual rays from an infeasible primal

    Posted Mon April 09, 2012 05:36 PM

    Originally posted by: T_O


    We had a similar problem. It is easy to implement yourself. See also (including the comments):

    http://orinanobworld.blogspot.de/2011/07/farkas-certificates-in-cplex.html

    Best regards,
    Thomas
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Dual rays from an infeasible primal

    Posted Mon May 01, 2017 04:27 AM

    Originally posted by: EXCT_RALF_GOLLMER


    Hi Thomas,

    when looking for a way to implement Benders feasibility cuts for arbitrary problems read in (may contain ranged constraints, simple bounds on variables), it seemed to be too tedious to build a dual, since I think that for this usage the complete dual ray is not needed.

    The dualfarkas method gives multipliers and a violation of the corresponding inequality built with the dual weights.

    In the method the infeasible problem arises by fixing a part of the variables (the first stage). I just need a valid inequality on those variables, not for all.

    I think the missing information of weigths on the simple bounds attained by the nonbasic variables is in the violation. The value of the lhs is given by inserting the fixed variable values into the obtained constraint, Should not lhs+violation be the rhs for the cut?

    Best regars

    Ralf


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Dual rays from an infeasible primal

    Posted Mon May 01, 2017 02:35 PM

    Originally posted by: T_O


    Hi Ralf,

    that's interesting. I just had a look at the definition of CPXXdualfarkas. Let's assume, we are solving the second stage. Let's further assume, you kept the first stage variables in the problem as fixed variables. Also let this be infeasible with y being the farkas certificate and p being proof_p as defined in CPXXdualfarkas. Then y'Ax >= y'b is a valid inequality containing first and second stage variables. From this inequality, we have to remove the second stage variables and stay valid. The procedure to do this is ugly to describe, but trivial (see Paul's blog). If I'm not fully mistaken, this will lead to a cut for the first stage that has just p as rhs. Unfortunately, I have not worked on this for a while now and cannot test this without some work. Please keep us informed.

    Best regards,
    Thomas


    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: Dual rays from an infeasible primal

    Posted Tue May 02, 2017 07:40 PM

    Originally posted by: EXCT_RALF_GOLLMER


    Hi Thomas,

    according to the decsription of CXXdualfarkas the right-hand-side of the valid inequality is not p, but p is the minimal difference y^TAx - y^Tb for the best-feasible x-values.

    This means in my opinion that removing the second-stage variables from the valid inequality y^TAx >= y^Tb means to subtract the partial scalar product y^TA_2z_2 with A_2 being the columns of matrix A corresponding to the second-stage variables and z_2 the values for the second-stage variables being best-feasible (i.e. x_j=lb for y^TA_j >0, x_j=ub for  y^TA_j <0) from y^Tb. Doing so for all variables would result in  0< p = yTb - yTA z = yTb -( yTA _1z_1 + yTA _2z_2) .

    Since the first-stage variables are fixed it holds x_1=lb=ub for those.

    So I think that it is easier (and more efficient) to plug in the fixed values to the transformed inequality

    yTA _1x_1 >= yTA _1z_1 - p = yTb - yTA _1z_1

    since the coefficients yTA _1 for the first-stage variables have to be computed anyway.

    Since CPLEX has to work in Simplex with tolerances being minimally1e-9 I use yTA _1z_1 - p*(1-e-8) as the right-hand side.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: Dual rays from an infeasible primal

    Posted Wed May 03, 2017 05:23 PM

    Originally posted by: T_O


    Hi Ralf,

    I think you are right, I did not think about the first stage variables that might change the value of p even if they are fixed. Still, I'm wondering whether there is a sign error for p. I did several calculations and always got +p instead of -p. Could you please re-check this? I do not want to post all these calculations now (because I'm not really convinced of them), but here is a simple idea why +p might be correct: Imagine the first stage is x1=0 and yields an infeasible second stage. Then you would create some constraint yTA1x1 >= 0 - p that would not cut off x1=0 while yTA1x1 >= 0 + p would.

    Best regards,
    Thomas

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 11.  Re: Dual rays from an infeasible primal

    Posted Wed May 03, 2017 06:40 PM

    Originally posted by: EXCT_RALF_GOLLMER


    Hi Thomas,

    of course you are right, the "-" was a typo - and twice the same one!

    A '- p" would allow the infeasible x_1 values to fulfil the inequality, which of course should not be the case. (and I used the "+ p" in my program).

    The reason is that I wanted to derive the expression - and obviously made a mistake.

    The real argument should be: z_1 is infeasible, that's why p>0. For the best-feasible second-stage vector z_2 vector we get the equation

    p + yTA _1z_1  = yTb -  yTA _2z_2 - and that's the right-hand side of the valid inequality we were looking for.

    Sorry for the mistake.

    Ralf

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 12.  Re: Dual rays from an infeasible primal

    Posted Thu May 04, 2017 03:32 AM

    Originally posted by: T_O


    Hi Ralf,

    yeah, I think it should work like this.

    From a colleague of mine, I know that Benders decomposition, especially nested Benders sometimes is numerically very unstable. So even with your modification of the RHS by some small value, it might just not work in some cases. That's why we did an implementation based on rational arithmetic such that we can distinguish numeric and algorithmic errors.

    Best regards,
    Thomas


    #CPLEXOptimizers
    #DecisionOptimization


  • 13.  Re: Dual rays from an infeasible primal

    Posted Fri May 05, 2017 09:47 AM

    Originally posted by: EXCT_RALF_GOLLMER


    Hi Thomas,

    I do not quite believe that doing exact arithmetic on CPLEX results really works either. It would help when the MIP was solved by exact arithmetic, too - but that would require a hell of implementation work and lots of memory for solving bigger problems :-) I'm sure I won't be able to implement a MIP solver being anywhere near the performance of CPLEX or Gurobi within years. I'm just lacking the experience and the knowledge to do so - and these were not implemented by a single person either.

    I made the experience that in CPLEX the variable bounds are obeyed by presolving only to 1e-8, which may result in a slightly better objective value for a problem with more restricted bounds than for the original problem (I'm doing an outer B&B on the first-stage variables where this happened sometimes).

    And even something like this can happen: fixing first-stage variables improves the "integer optimal" objective by nearly 0.9%

    https://www.ibm.com/developerworks/community/forums/html/topic?id=5ae4daf4-88b0-4edc-aa57-3702cd17ff2e#cdaade34-9cfa-469e-a7a5-04562442c77e

    Of course CPLEX is done by humans, too, and I think nobody will really think of all possible cases when working on such complex piece of software.

    Best regards

    Ralf


    #CPLEXOptimizers
    #DecisionOptimization


  • 14.  Re: Dual rays from an infeasible primal

    Posted Fri May 05, 2017 01:54 PM

    Originally posted by: T_O


    Hi Ralf,

    you are right. We did not do this with CPLEX, but with own code using the GMP library. And we only did this for LP, not for MIP. And of course, this is not competitive. We just did this to be able to find out if there was an error in the Benders code or in the numeric. In our case it was an error in the Benders code and we were sure that we were serching at the correct place.

    I agree that for practical applications, our implementation is way too slow. I just wanted to say that even if you do everything correctly, Benders on inexact arithmetic might just not work. (Even LP does not work in all cases, but CPLEX does a very good job avoiding such problems.)

    Best regards,
    Thomas


    #CPLEXOptimizers
    #DecisionOptimization