Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Finding Knapsack Constraints using the C API Functions of CPLEX

    Posted 05/06/20 09:19 AM
    Hello,

    Does anyone know if there is an easy way to determine whether a constraint from a CPLEX problem object is a knapsack constraint using the C API functions of CPLEX? My current thought process would be to use CPXgetrows() along with CPXgetctype() to determine if all variables of a particular constraint are binary variables. If so, then I would consider it a knapsack constraint.

    I thought I would ask if there is an easier way before I go ahead and try to implement this strategy. Basically, I am trying to test some cutting planes to the knapsack polyhedra using some problems from MIPLIB (https://miplib.zib.de/). But I need to identify the knapsack constraints of the problem first so I can correctly implement my cuts.

    Any suggestions are appreciated. Thank you for your time.

    Best,
    Fabio


    ------------------------------
    Fabio Vitor
    ------------------------------

    #DecisionOptimization


  • 2.  RE: Finding Knapsack Constraints using the C API Functions of CPLEX

    Posted 05/06/20 09:36 AM
    I don't think there is a better way to check.

    Depending on how many binary variables you have in your model in relation to other variables, you could pre-filter the rows: Call CPXXgetctype() to find the binary columns. Then use CPXXgetcols() to find the rows that intersect with at least one binary variable.

    ------------------------------
    Daniel Junglas
    ------------------------------



  • 3.  RE: Finding Knapsack Constraints using the C API Functions of CPLEX

    Posted 05/06/20 05:59 PM
    That makes sense too. Thank you Daniel.

    ------------------------------
    Fabio Vitor
    ------------------------------



  • 4.  RE: Finding Knapsack Constraints using the C API Functions of CPLEX

    Posted 05/06/20 04:14 PM
    I think you would also want to check whether the nonzero coefficients all have the same sign, right?

    ------------------------------
    Paul Rubin
    ------------------------------



  • 5.  RE: Finding Knapsack Constraints using the C API Functions of CPLEX

    Posted 05/06/20 06:00 PM
    I think that's right too. Thank you Paul.

    ------------------------------
    Fabio Vitor
    ------------------------------