Decision Optimization

Decision Optimization

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

 View Only
  • 1.  How to add 280K constraints quickly and efficiently?

    Posted Fri May 09, 2025 07:20 AM

    Hello, 

    So assume I have 140K variables of the form y_ijkl. These are binary variables and represent order between 2 jobs on a single machine. 

    I need to write 140K*2 = 280K constraints of the form:

    s_ik + d_ik <= s_jl + M(1-y_ijkl)  ->(1)
    s_jl + d_jl  <= s_ik + M*y_ijkl  -->(2)

    So 140K constraints of type 1 and another 140K of type2. 

    Is there any way I can make the addition of these constraints much faster. ?
    I am sure there are ways to do it. There is some structure or method I am not employing.

    Thanks
    Hariharan



    ------------------------------
    HARIHARAN SUBRAMANIAN
    ------------------------------


  • 2.  RE: How to add 280K constraints quickly and efficiently?

    Posted Tue May 13, 2025 09:34 AM

    What interface are you using ? 
    In docplex (Python) you can improve constraint addition by adding blocks of constraints using add_constraints() instead of adding them one by one. 
    An example of usage is in the example workflow/lagrangian_relaxation.py : 
    https://github.com/IBMDecisionOptimization/docplex-examples/blob/master/examples/mp/workflow/lagrangian_relaxation.py

    Regards,

    Philippe