Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Get dual Values from imported *.lp model

    Posted 11/07/16 05:03 AM

    Originally posted by: a.teuffel


    Hi everybody,

    I am creating a Visual Basic application to import and solve a previously created .lp model.

    This works fine so far.

    Dim cplex As New Cplex()
    dim dual1 as double
    
    cplex.ImportModel("model.lp")
    If cplex.Solve() Then
       'do some stuff with the solution
       dual1 = cplex.GetDual(???)
    End If
    

    Now I want to get dual values of specific constraints.

    I've heard of the .GetDual() method but I have not figured out how to use it. GetDual needs an IRange object as input defining the contraint(s). Since I only import the model I have not so much experience with creating models and using cplex language in visual studio.

    The constraints have names c1, c2, ... from the lp-file.

    What do I have to do now?

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Get dual Values from imported *.lp model

    Posted 11/07/16 06:29 AM

    If you import  a model from a file then all the variables and constraints are stored in an instance of ILPMatrix. You can get a reference to this instance via cplex.GetLPMatrixEnumerator(). See for example the AdMIPex1.vb example that is shipped with CPLEX.  This example queries all the variables created from an imported file.


    #CPLEXOptimizers
    #DecisionOptimization