Decision Optimization

 View Only
Expand all | Collapse all

Status seems Infeasible but getValue and getObjValue don't throw errors (feat. how to interpret the conflict refiner)

  • 1.  Status seems Infeasible but getValue and getObjValue don't throw errors (feat. how to interpret the conflict refiner)

    Posted Sun September 19, 2021 06:45 PM
    Edited by System Fri January 20, 2023 04:26 PM
    In a part of my application I have the following code:

            bool result = m_cplex.solve();
            IloAlgorithm::Status status = m_cplex.getStatus();
            if(status == IloAlgorithm::Status::Infeasible){
                double f = m_cplex.getObjValue();
                std::cout << "result = " << result << "\n";
                std::cout << "status = " << status << "\n";
                m_cplex.exportModel("INF.lp");
                std::cout << "f = " << f << "\n";
                for(int i = 0; i < m_vars.getSize(); ++i){
                    if(m_cplex.getValue(m_vars[i]) > m_params.EPS){
                        std::cout << m_vars[i].getName() << "" << m_cplex.getValue(m_vars[i]) << "\n";
                    }
                }
                
                IloNumArray preferences(m_env);
                IloConstraintArray infeas(m_env);
                for(int i = 0; i < m_con_demand.getSize(); ++i){
                    infeas.add(m_con_demand[i]);
                }

                for(int i = 0; i < m_vars.getSize(); ++i){
                    infeas.add(IloBound(m_vars[i], IloBound::Lower));
                    infeas.add(IloBound(m_vars[i], IloBound::Upper));
                }

                for(int i = 0; i < infeas.getSize(); ++i){
                    preferences.add(1.0);
                }

                if ( m_cplex.refineConflict(infeas, preferences) ){
                    IloCplex::ConflictStatusArray conflict = m_cplex.getConflict(infeas);
                    m_env.getImpl()->useDetailedDisplay(IloTrue);
                    std::cout << "Conflict :" << endl;
                    for (IloInt i = 0; i<infeas.getSize(); i++){
                        if ( conflict[i] == IloCplex::ConflictMember){
                            std::cout << "Proved  : " << infeas[i] << "\n";
                        }
                        if(conflict[i] == IloCplex::ConflictPossibleMember){
                            std::cout << "Possible: " << infeas[i] << "\n";
                        }

                    }
                }else{
                    std::cout << "Didn't refined\n";
                }
            }

    I've attached the full output given by the above code and the exported model, but here's part of the output:
    result = 0
    status = Infeasible
    f = 23
    lam_43: 1
    lam_51: 0.6
    lam_63: 0.8
    lam_120: 0.6
    lam_154: 0.2
    lam_163: 0.4
    lam_165: 1.4
    lam_221: 0.4
    lam_276: 1
    lam_285: 0.2
    lam_587: 1
    lam_939: 0.2
    lam_964: 0.2
    lam_970: 1


    1) Shouldn't an exception be thrown at the getValue or getObjValue calls?

    2) On the second part of the output, the conflict refiner states that constraints demand 11, 21 and 23 are proven to be on a conflict, but since lam_43 and lam_51 are not fixed to zero, how is it possible? I mean, demand_11 and demand_21 contains lam_43 while demand_23 contains lam_51. I'm not seeing the problem here.



    ------------------------------
    Victor Hugo Rodrigues do Nascimento
    ------------------------------
    #DecisionOptimization


  • 2.  RE: Status seems Infeasible but getValue and getObjValue don't throw errors (feat. how to interpret the conflict refiner)

    IBM Champion
    Posted Mon September 20, 2021 06:07 PM
    It appears that you have removed the file containing the model, so it will not be possible to provide a definitive answer.

    I believe you are correct that CPLEX should throw an exception when you try to access the "solution" to an infeasible model. I just ran a little test program (in Java), and trying to access either the objective value or the values of the variable produces an exception (CPLEX Error 1217).

    As for the conflict refiner output, keep in mind that it is telling you that the constraints in the conflict set cannot be satisfied simultaneously, not individually. Are you saying that you think you can satisfy the constraints in the conflict set (while staying within the bounds of the variables)? Without the exported model, I cannot test that myself.

    ------------------------------
    Paul Rubin
    Professor Emeritus
    Michigan State University
    ------------------------------