Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Cplex Class API methods

    Posted 05/09/10 09:23 PM

    Originally posted by: BugHunter


    After solving LP I called cplex.Solution.dual and got the message:
    ??? Reference to non-existent field 'dual'. at the same time the interactive cplex gives me the dual solution.
    What is wrong with cplex.Solution.dual ?

    thanks
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Cplex Class API methods

    Posted 05/10/10 07:33 AM

    Originally posted by: SystemAdmin


    Which API do you use? Python?
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Cplex Class API methods

    Posted 05/10/10 07:46 AM

    Originally posted by: SystemAdmin


    If you use Python try function
    cplex.solution.get_dual_values
    

    to read the dual solution values.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Cplex Class API methods

    Posted 05/10/10 09:02 AM

    Originally posted by: BugHunter


    I am using MATLAB API Version 7.10.0.499(R2010a)
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Cplex Class API methods

    Posted 05/13/10 12:07 AM

    Originally posted by: BugHunter


    Nobody knows what the problem? There is no method for the class that supposed to be and nobody comes across to this problem?
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Cplex Class API methods

    Posted 05/13/10 12:44 AM

    Originally posted by: John Cui


    Could you please try below code and tell me the cplex.Solution?

    >> cplex=Cplex()
         
    ans=
         
       Cplex handle
         
       Properties:
          Model: [1x1 struct]
          Param: [1x1 struct]
          DisplayFunc: @disp
         
       Methods, Events, Superclasses
    >> cplex.addCols(1)
         
    ans=
         
       Cplex handle
         
       Properties:
          Model: [1x1 struct]
          Param: [1x1 struct]
          DisplayFunc: @disp
         
       Methods, Events, Superclasses
    >> cplex.addRows(1,1,1)
         
    ans=
         
       Cplex handle
         
       Properties:
          Model: [1x1 struct]
          Param: [1x1 struct]
          DisplayFunc: @disp
         
       Methods, Events, Superclasses
    >> cplex.solve
     
    ans = 
     
              status: 1
        statusstring: 'optimal'
                time: 0
              objval: 1
                   x: 1
              method: 2
                dual: 1
                  ax: 1
         reducedcost: 0
               basis: [1x1 struct]
     
    >> cplex.Solution.dual
     
    ans =
     
         1
    


    You can see we have cplex.Solution.dual
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Cplex Class API methods

    Posted 05/13/10 10:12 AM

    Originally posted by: BugHunter


    John, thanks a lot. I got the problem: when you set the 'ctype' parameter, even it is 'C' - for continuous vars, it takes the problem as an MIP and doesn't calculate the duals (even I set the lpmethod to the primal cplex
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Cplex Class API methods

    Posted 05/13/10 10:52 AM

    Originally posted by: John Cui


    If you want convert your mip model to lp, please remove the ctype field by:
    cplex.Model = rmfield(cplex.Model, 'ctype');
    

    then solve the model again.
    #CPLEXOptimizers
    #DecisionOptimization