Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Propagation is not complete

    Posted 07/15/19 10:09 AM

    Originally posted by: rakesh85


    from docplex.cp.model import *
    import numpy as np
    mdl = CpoModel(name="Propagation testing")
    # Variables of the model
    x={}
    x[1] = integer_var([1,2,3,4])
    x[2] = integer_var([1,2,3,4,5])
    mdl.add(x[1]+x[2]>3)
    mdl.add(x[2]>x[1])
     
    msol= mdl.propagate()

    After the domain reduction, the output domain of x[1] ={1,2,3,4} and x[2] ={3,4,5}. However, it should be x[1] = {1,2,3,4} and x[2] = {3,4,5}.


    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: Propagation is not complete

    Posted 07/16/19 01:21 PM

    Originally posted by: ChrisBr


    Hello Rakesh,

    The result of the propagation is:
    x[1] ={1,2,3,4} and x[2] ={2,3,4,5}
    all these values are OK with regard to the constraints one by one.
    We need to propagate a step forward to remove 2 from the domain of x[2] because
            (x[1]=1, x[2]=2) is in conflict with (x[1]+x[2]>3)
           and (x[2]=2 and x[1] = ( any of 2,3,4) ) is in conflict with (x[2]>x[1]).
    Such combination of several constraints cannot be done in the initial propagation.

    Regards,

    Chris.

     


    #CPOptimizer
    #DecisionOptimization


  • 3.  Re: Propagation is not complete

    Posted 07/16/19 08:48 PM

    Originally posted by: rakesh85


    Dear Chris, 

    Thanks for your reply. May I know how to execute the multiple propagation with IBM Cplex optimizer. Further, I also set DefaultInferenceLevel parameter to be extended but of no use. 

    Thanks and Regards, 

    Rakesh Prakash 


    #CPOptimizer
    #DecisionOptimization


  • 4.  Re: Propagation is not complete

    Posted 07/16/19 10:28 PM

    Originally posted by: rakesh85


    Also, I run the propagation second time with the reduced domain but not getting any further reduction. 

     

    Thanks & Regards,

    Rakesh Prakash


    #CPOptimizer
    #DecisionOptimization


  • 5.  Re: Propagation is not complete

    Posted 07/18/19 01:19 PM

    Originally posted by: ChrisBr


    Hello Rakesh,

    The initial propagation propagates every thing possible - taking constraints one by one.
    Calling it again without any change will not propagate anything else, domains are already reduced.
    A way to strengthen the initial propagation would be to reformulate the model.
    Of course you can try to remove some values before calling again propagate, but this is not very efficient and cannot be a good solution with bigger domains.

    msol= mdl.propagate()
    msol.print_solution()
    print("add(x[2]==2)")
    ct=x[2]==2
    mdl.add(ct)
    msol=mdl.propagate()
    msol.print_solution()
    OK=msol.is_solution()
    if not OK:
        print("remove(x[2]==2)")
        mdl.remove(ct)
    msol= mdl.propagate()
    msol.print_solution()
    ct=x[2]!=2
    mdl.add(ct)
    msol= mdl.propagate()
    msol.print_solution()
    

     


    What is your real problem? What do you want to model?



    Regards,

    Chris.

    (note: edited for more code sample)


    #CPOptimizer
    #DecisionOptimization