Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Infeasible problem Conflict refiner doesn't work

    Posted Tue October 04, 2011 03:01 PM

    Originally posted by: sophiejuin


    Hello,

    I am working with cplex and c++ together.

    I built a MIP(about 70 binary variables), and I used several logical constraints.

    The problem is that the program works well with some datasets. But for some particular ones, it's infeasible.

    I tried to solve the problem by looking at the linear program I exported, but no result.

    I tried to use conflict refiner, but it didn't give me any suggestion.

    Any one know the possible reasons for this weird problem?

    Thanks in advance.
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Infeasible problem Conflict refiner doesn't work

    Posted Tue October 04, 2011 04:44 PM

    Originally posted by: SystemAdmin


    Hello,

    > The problem is that the program works well with some datasets. But for
    > some particular ones, it's infeasible.
    > I tried to solve the problem by looking at the linear program I
    > exported, but no result.
    > I tried to use conflict refiner, but it didn't give me any suggestion.

    Was "No conflicts found" displayed after invoking the conflict refiner in the interactive optimizer on the model?

    The model could be facing numerical difficulty, but it is hard to judge that without having a look at the model. Can you export the model in the SAV format and then attach it here?
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Infeasible problem Conflict refiner doesn't work

    Posted Wed October 05, 2011 04:21 AM

    Originally posted by: SystemAdmin


    Here is a code snipped that I use to run the conflict refiner directly in C++. It starts at the point at which solve() returns false, indicating that no feasible solution was found. Does this code find a conflict for you?
    if ( !cplex.solve() ) {
             // No feasible solution was found. Perform conflict analysis.
             // We allow any constraint to be part of the conflict.
             std::cout << "Model is infeasible. Running conflict analysis."
                       << std::endl;
     
             // Build a list of constraints that can be part of the conflict.
             // Since bounds of variables may also render the model infeasible
             // we also add bounds to the set of constraints that are considered
             // for a conflict.
             std::cout << "Building constraint list ... " << std::flush;
             IloConstraintArray cons(env);
             IloNumArray prefs(env);
             for (IloModel::Iterator it(cplex.getModel()); it.ok(); ++it) {
                IloExtractable e = *it;
                if (e.isVariable()) {
                   IloNumVar v = e.asVariable();
                   if (v.getLB() > -IloInfinity) {
                      cons.add(IloBound(v, IloBound::Lower));
                      prefs.add(1.0);
                   }
                   if (v.getUB() < IloInfinity) {
                      cons.add(IloBound(v, IloBound::Upper));
                      prefs.add(1.0);
                   }
                }
                else if (e.isConstraint()) {
                   cons.add(e.asConstraint());
                   prefs.add(1.0);
                }
             }
             std::cout << cons.getSize() << " elements." << std::endl;
     
             // Refine the conflict.
             std::cout << "Refine the conflict ..." << std::endl;
             if ( !cplex.refineConflict(cons, prefs) ) {
                std::cout << "No conflict found!" << std::endl;
             }
             else {
                // Print out minimal conflict.
                std::cout << "Conflict found. Minimal conflict is:" << std::endl;
                int count = 0;
                for (IloInt i = 0; i < cons.getSize(); ++i) {
                   if (cplex.getConflict(cons[i]) == IloCplex::ConflictMember) {
                      std::cout << " " << cons[i] << std::endl;
                      ++count;
                   }
                }
                std::cout << count << " constraints in minimal conflict."
                          << std::endl;
             }
          }
          else {
             std::cout << "Model is feasible!" << std::endl;
          }
    

    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Infeasible problem Conflict refiner doesn't work

    Posted Wed October 05, 2011 08:41 AM

    Originally posted by: sophiejuin


    thank you for your code.

    I used the code to refine the conflicts. After calling cplex.refineConflict(cons, prefs) and 404 interaction, the program ended with:

    "Concert exception caught: CPLEX Error 1720: Conflict detection could not reproduce previously found infeasibility"

    I didn't modify the model after cplex.solve() was called.

    What does this mean?
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Infeasible problem Conflict refiner doesn't work

    Posted Wed October 05, 2011 09:46 AM

    Originally posted by: sophiejuin


    @AbhishekRaman

    Thanks for your reply.

    I used Daniel Junglas's code and I got a message:

    "Concert exception caught: CPLEX Error 1720: Conflict detection could not reproduce previously found infeasibility"

    I also think it's a numerical difficulty. As the infeasibility only occurs for some cases of datasets. In addition, I know there should be a solution for sure, but CPLEX just cannot find it.

    Please find attached the SAV format file of the problem. Could you tell me how to look for the reason of the problem because I think it would be not easy for someone who don't know the meaning of the model.
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Infeasible problem Conflict refiner doesn't work

    Posted Wed October 05, 2011 01:53 PM

    Originally posted by: SystemAdmin


    > "Concert exception caught: CPLEX Error 1720: Conflict detection could
    > not reproduce previously found infeasibility"

    I was not able to reproduce your error message. When I used Daniel's code, CPLEX did find the model to be infeasible and also displayed the set of constraints that were part of the minimal conflict. Please the c++ program attached.

    I used CPLEX 12.3 with VS2008 for this run (cmd-> ilolpex2.exe infeasible.sav). Which version of CPLEX are you using? Can you upgrade and use the latest one (12.3)?

    You should also be able to see the conflict using the interactive optimizer:
    CPLEX> read infeasible.sav
    CPLEX> conf
    CPLEX> write conflict.clp

    The conflict.clp file should now contain the minimal constraint set.
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Infeasible problem Conflict refiner doesn't work

    Posted Wed October 05, 2011 02:06 PM

    Originally posted by: SystemAdmin


    Also, attached is one such minimal conflict resulting in the infeasibility. Please note that the infeasibility is somewhere in the 1e-5 and 1e-6 range possibly because of the indicator constraints that specify certain variables (like id520) to be greater than equal to 1e-5 and which conflicts with CPLEX's default simplex feasibility tolerance of 1e-6. If you were to increase CPLEX's feasibility tolerance to say 1e-5 or reduce the lower bound on variables like id520 to 1e-6 or lower, then you would see that CPLEX does solve the model; but with significant indicator slack bound errors (in the order of 1.2e-5). This again confirms the fact that the model is indeed infeasible to start with and that such tweaks are just forcing the solver to provide solutions that may not be of great quality. I would recommend you to go through the .clp file to understand the constraints that are causing the real infeasibility.
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Infeasible problem Conflict refiner doesn't work

    Posted Thu October 06, 2011 12:01 PM

    Originally posted by: sophiejuin


    Although the conflict refiner still doesn't work, I found the problem thanks for your inspiration. The problem is indeed infeasible itself, because I set wrong lower bounds to some variables. Also, the lower bound of some indicator (1e-5) indeed results in poor solution. After correcting the two issues, the program now is able to find a good result!

    Thank you very much for your help!
    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: Infeasible problem Conflict refiner doesn't work

    Posted Thu October 06, 2011 12:52 PM

    Originally posted by: SystemAdmin


    Thats good to know. Thanks for keeping us posted.
    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: Infeasible problem Conflict refiner doesn't work

    Posted Thu October 06, 2011 11:52 AM

    Originally posted by: sophiejuin


    Thank you for letting me know how to use the interactive optimizer to see the conflict. It works for other cases of confliction, but not the one I posted before. I used cplex 11.1 with vs2005. Does that matter?
    #CPLEXOptimizers
    #DecisionOptimization