Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  need help in writing a linear contraint in PythonAPI of cplex

    Posted 04/21/12 05:15 AM

    Originally posted by: bindasmariner


    I am new to python/cplex and having a hard time coding my complicated MILP in this platform.
    Can anyone please show me the python code for writing such an MILP in python API of Cplex. I have shown a small part, but explaining this much would guide me enough

    Variable: X, Z are Binary and Q,l are Continuous.
    Coefficients marked bold.

    minimize sum(v in V, p in S1, q in S2) Cost_pqv * X_pqv
    + sum(p in S1, v in V, k in K) Cost1_pvk * Q_pvk

    1) sum(q in S)X_qv + Z_v = 0, for all v in V
    2) l_pvk + Q_qvk - l_qvk = 0, for all v in V,k in K, p,q in S

    Thanks in anticipation
    Saurabh
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: need help in writing a linear contraint in PythonAPI of cplex

    Posted 04/21/12 06:01 PM

    Originally posted by: Eumpfenbach


    You have two options:

    1) you can build the problem row by row (using for loops, for example)

    or

    2) write your model in ILOG OPL, save as an MPS or LP file, and read this file with the Python Cplex API:

    problem = cplex.Cplex('problem.mps');

    The syntax might not be exactly right, but it illustrates the idea. Option 2 is probably a much easier one.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: need help in writing a linear contraint in PythonAPI of cplex

    Posted 04/22/12 02:13 AM

    Originally posted by: bindasmariner


    Thanks a lot. The option 2 will save of lot of my time.
    #CPLEXOptimizers
    #DecisionOptimization