Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Problem with inverse Constraint

  • 1.  Problem with inverse Constraint

    Posted Sun July 14, 2019 12:35 PM

    Originally posted by: rakesh85


    Hi,

    I am trying to implement the inverse constraint in its most simplest form as given below but I am getting "None" solution. Appreciate for any help. 

     

    from docplex.cp.model import *
    import numpy as np
    mdl = CpoModel(name="Propagation testing")
    p={}
    s={}
    s[1] = integer_var([2])
    s[2] = integer_var([1])
    p[1] = integer_var([2])
    p[2] = integer_var([1])
    mdl.add(inverse(s,p))
    msol= mdl.propagate()
     

    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: Problem with inverse Constraint

    Posted Mon July 15, 2019 05:02 AM

    Originally posted by: Petr Vilím


    Hello,

    I believe the issue is that inverse function indexes arrays from 0, not from 1. So please try to replace values 1 and 2 by values 0 and 1.

    Best regards, Petr


    #CPOptimizer
    #DecisionOptimization


  • 3.  Re: Problem with inverse Constraint

    Posted Mon July 15, 2019 09:57 AM

    Originally posted by: rakesh85


    Dear Petr,

    Thanks for your response. I attempted and it is working prefecty.

     

    Thanks & Regards,

    Rakesh Prakash


    #CPOptimizer
    #DecisionOptimization