Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

LP Infeasibility

  • 1.  LP Infeasibility

    Posted Fri May 27, 2011 05:08 AM

    Originally posted by: satdene


    Hi, I am working on an LP including a constraint like sum(yi)<=Y*sum(zj) in which Y is a big constant. and zj's are variables. When I assign Y to 1e6, the problem is feasible but when I assign it to 1e12, the problems become infeasible although the feasible region does not shrink in reality. The attached file is the infeasible one. Why this infeasibility occur? Thanks in advance.
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: LP Infeasibility

    Posted Fri May 27, 2011 05:10 AM

    Originally posted by: satdene


    And this is the feasible one which is almost equal to first one except Y parameter difference.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: LP Infeasibility

    Posted Fri May 27, 2011 05:27 AM

    Originally posted by: SystemAdmin


    Hm, in my interactive both problems produce an optimal solution.
    fm.lp has optimal objective 7.8714070641e+03, fm2.lp has optimal objective 7.4110671937e+02.
    What version of CPLEX are you using? Which port?
    Are you sure that CPLEX claimed infeasible? Is it possible that it claimed "unbounded" instead?
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: LP Infeasibility

    Posted Fri May 27, 2011 05:31 AM

    Originally posted by: SystemAdmin


    The larger you are choosing your big-M coefficient, the more numerical instabilities you introduce to the model. In particular with big-M = 1e+12 I am not too surprised that a floating point arithmetic based solver like CPLEX may produce wrong answers.

    But actually, I tried both your models with CPLEX 12.2.0.2 in default settings (i.e., using the dual simplex algorithm) on my Linux x86-64 system, and both are declared feasible. fm.lp has an objective value of 7.8714070641e+03, fm2.lp has objective 7.4110671937e+02. This actually makes sense, because these are maximization problems and fm.lp is the one with a larger big-M, i.e., with fewer restrictions in the constraints.

    You should really think about how you can improve the numerics in a model. Using such large big-M values is certainly a source of numerical trouble.
    Tobias
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: LP Infeasibility

    Posted Fri May 27, 2011 07:51 AM

    Originally posted by: satdene


    Thank you for responses. I use Cplex 12.2.2. My interactive also gave the same results you wrote. However, when I call Cplex from C# environment, problem seems to be infeasible. This is my code where I solve the model;

    fm.SetParam(Cplex.DoubleParam.WorkMem, 3000);
    fm.SetParam(Cplex.IntParam.NodeFileInd, 3);
    fm.ExportModel("fm.lp");
    fm.SetOut(null);
    fm.Solve();
    if (fm.GetStatus() == Cplex.Status.Optimal)
    {
    fobj = fm.GetObjValue();
    for (int t = 0; t < T; t++)
    Vw[t] = fm.GetValue(fw[t]);
    }
    else
    {
    Console.WriteLine(fm.GetStatus());
    Console.WriteLine("I couldn't solve the problem");
    Console.ReadKey();
    }
    and you can see the Console output from the attached file in which model's status is written as infeasible. I don't see any reason for that. Any suggestion would be appreciated.
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: LP Infeasibility

    Posted Fri May 27, 2011 07:58 AM

    Originally posted by: SystemAdmin


    You should use the .sav file format instead of the .lp format. Then, the interactive should produce exactly the same behavior as your C# code (provided that you did not change any parameter settings).

    The issue with .lp and .mps files is that exporting the model to those formats and reading it back in may lead to subtle changes in the model, in particular reordering of columns and nodes, and small changes in the data due to truncation of the double precision values to ASCII representations.

    The .sav format is binary and stores the model in exactly the bit pattern as it is represented in memory.

    Tobias
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: LP Infeasibility

    Posted Fri May 27, 2011 09:15 AM

    Originally posted by: satdene


    Unfortunately the result is same. It claims that the problem is infeasible in C#, but when the problem is saved in fm.sav file, interactive solves it to optimality. I can send the whole C# file if necessary for an answer.
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: LP Infeasibility

    Posted Fri May 27, 2011 10:05 AM

    Originally posted by: SystemAdmin


    And you did not change any of the CPLEX parameters?
    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: LP Infeasibility

    Posted Fri May 27, 2011 05:04 PM

    Originally posted by: SystemAdmin


    The complete C# source code would help in diagnosing this issue.
    If you don't want to post it in the Forum then you can send it directly to me: daniel(dot)junglas(at)de(dot)ibm(dot)com.
    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: LP Infeasibility

    Posted Fri May 27, 2011 10:21 AM

    Originally posted by: satdene


    fm.SetParam(Cplex.DoubleParam.WorkMem, 3000);
    fm.SetParam(Cplex.IntParam.NodeFileInd, 3);
    These are the only lines about the Cplex parameters.
    #CPLEXOptimizers
    #DecisionOptimization


  • 11.  Re: LP Infeasibility

    Posted Mon May 30, 2011 05:45 AM

    Originally posted by: satdene


    Thanks, I have just sent you an email with my code attached.
    #CPLEXOptimizers
    #DecisionOptimization


  • 12.  Re: LP Infeasibility

    Posted Mon May 30, 2011 06:05 AM

    Originally posted by: satdene


    Daniel, I just realized that the code can be complicated and it can take a while to find the place of the problem. Let me clarify it a little more here. There are three classes of the project, the main class mainly manages the issue. In inputentry class I take the necessary parameter values as iputs to the model. In LR class a subgradient algorithm is coded, and the name of the model which is claimed to be infeasible is fm. I try to solve the fm model in solvefm() method of LR. You can concentrate on that method. I can answer any of your questions to clarify further. Thanks again.
    #CPLEXOptimizers
    #DecisionOptimization


  • 13.  Re: LP Infeasibility

    Posted Mon June 06, 2011 04:58 AM

    Originally posted by: SystemAdmin


    I got your code and understood it (at least part of it). I also reproduced the problem here. What we see is that
    fm.ExportModel("fm.sav");
       fm.Solve();
    

    reports an infeasible status while solving fm.sav with the interactive optimizer solves the problem just fine.
    Parameters settings are not involved (the parameters you are setting are irrelevant for LPs and the problem occurs irrespective of these settings).
    I was able to work around the problem by setting
    fm.SetParam(Cplex.IntParam.AdvInd, 0);
    

    which instructs CPLEX to ignore any information from the previous solve of the fm instance.
    I have not found out yet what causes C# to report an infeasible status.
    #CPLEXOptimizers
    #DecisionOptimization