Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  How to get ILPMatrix from Cplex object?

    Posted 03/09/20 02:29 AM

    Originally posted by: alamaranka


    Hi,

    I am working on an MIP problem using .NET API. What is I am looking for is to get the array of constraints I have already added to Cplex object as IConstraint[]. However, either it is not possible or I simply failed to find it. After reading and searching related documents I ended up nothing and decided to ask here. I know that:

    1. I can create a List<IConstraint>, add all constraints to it as adding them to Cplex object, and use list.ToArray() to get IConstraint[].
    2. I can import the model (assuming there is a model to be imported) and use GetLPMatrixEnumerator() to get the ILPMatrix.

    However, there is no model to be imported and I do not want to go with List<IConstraint> option since that means extra code. In fact, I would expect as simple as a method to do the job; GetConstraints() on Cplex object which returns IConstraint[]. Is there any?

    Regards.


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: How to get ILPMatrix from Cplex object?

    Posted 03/10/20 10:17 AM

    The method you are looking for is Cplex.GetEnumerator(). The returned enumerator iterates over all the things you added to the model. For each of these objects you can check whether it is an instance if IConstraint and if so then handle it appropriately.


    #CPLEXOptimizers
    #DecisionOptimization