Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Extract a model in the optimization studio

    Posted Mon November 04, 2013 04:03 PM

    Originally posted by: MohamedAbuSharkh


    Hi ,

     

    I am new to optimization studio and i am facing a small issue. I am getting an "Infeasible solution " result and i was hoping to look into the detailed model to resolve that,

     

    is there a way to extract the prodced model from the OPL program in a way similar to ExtractModel method ? or can i use the same method within the OPL code,

     

    I tried adding extract model command in a script block-excute { }    before the constraint block but it didn't work correctly.

    I am using optimization studio 12.5

    The code that is causing the infeasibility looks like this

     

     forall(r in requests)
             {  
                forall(s in server_nonode)
                  {
                           if( isSource[r][v]==1)
    (sum(l in links) (Y[r][l]*linkOutserver[l][s]) - sum (l in links) (Y[r][l]*linkInserver[l][s])) == X[v][s];
                   
                 }
              }
          }

                                 
    forall(v in VM_no_node)
         {
           forall(r in requests)
             {  
                forall(s in server_nonode)
                  {
                        if( isDest[r][v]==1)   

                     (sum(l in links) (Y[r][l]*linkOutserver[l][s]) - sum (l in links) (Y[r][l]*linkInserver[l][s])) ==0 (-1*X[v][s]);
                    
                 }
              }
          }  
     

    Your help is highly appreciated guys

     

    Thanks and Best Regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Extract a model in the optimization studio

    Posted Tue November 05, 2013 02:04 AM

    First of all, you can analyze infeasibility directly in the IDE, see here. Maybe that is already good enough for you.

    In order to write the model to a file you need a main scripting block (after the constraints) that looks like this:

    main {
       thisOplModel.generate();
       cplex.exportModel("model.lp");
       cplex.solve();
    }

    This will write the model in LP format to file "model.lp" before solving it. The 'cplex' variable is an instance of class IloCplex that has other useful methods, see here.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Extract a model in the optimization studio

    Posted Tue November 05, 2013 05:24 PM

    Originally posted by: MohamedAbuSharkh


    Thanks Daniel,

     

    I will try both suggestions.

     

    can you please provide the first link again , as it leads to tis page when clicking on it.

     

    Thanks again


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Extract a model in the optimization studio



  • 5.  Re: Extract a model in the optimization studio

    Posted Wed November 06, 2013 03:30 AM

    Hi,

    in your model you should label your constraint.

     forall(r in requests)
             {  
                forall(s in server_nonode)
                  {
                           if( isSource[r][v]==1)
    (sum(l in links) (Y[r][l]*linkOutserver[l][s]) - sum (l in links) (Y[r][l]*linkInserver[l][s])) == X[v][s];
                   
                 }
              }
          }

     

    should be rewritten into

     

     forall(r in requests)
             {  
                forall(s in server_nonode:isSource[r][v]==1)
                  {
                        
    ctName:(sum(l in links) (Y[r][l]*linkOutserver[l][s]) - sum (l in links) (Y[r][l]*linkInserver[l][s])) == X[v][s];
                   
                 }
              }
          }

     

    Only labeled constraints will be relaxed in OPL

     

    regards


    #CPLEXOptimizers
    #DecisionOptimization