Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  an "exist" constraint in opl

    Posted 11/30/09 06:09 AM

    Originally posted by: SystemAdmin


    Hi,
    I try to model an “Exist” constraint that we haven’t in opl. For example how to implement in opl the following constraint?

    
    dvar 
    
    int x[1..10] in 1..10; subject to
    { 
    //(exists i in 1..10, exists j in i+1..10) 
    //    x[i]==x[j]; 
    }
    


    Thanks in advance

    NL
    #ConstraintProgramming-General
    #DecisionOptimization


  • 2.  Re: an "exist" constraint in opl

    Posted 11/30/09 01:29 PM

    Originally posted by: Didier Vidal


    Hi,

    I think that an aggregated or, available in CP, does exactly what you need.
    Do other users have a different approach to implement this constraint ?

    using CP;

    dvar int x[1..10] in 1..10;
    maximize sum(i in 1..10) (x[i] == i);
    subject to{
    or (ordered i,j in 1..10) (x[i]==x[j]) == 1;
    //(exists i in 1..10, exists j in i+1..10)
    // x[i]==x[j];
    }

    Didier.
    #ConstraintProgramming-General
    #DecisionOptimization


  • 3.  Re: an "exist" constraint in opl

    Posted 12/01/09 12:07 PM

    Originally posted by: SystemAdmin


    thanks Diddier,
    it's what I searched, thank you again.

    NL
    #ConstraintProgramming-General
    #DecisionOptimization


  • 4.  Re: an "exist" constraint in opl

    Posted 12/11/09 08:53 AM

    Originally posted by: SystemAdmin


    A slightly simpler, and probably more efficient model is found below.

    {code]
    using CP;

    dvar int xhttp://1..10 in 1..10;
    maximize sum(i in 1..10) (x[i] == i);
    subject to{
    or(ordered i,j in 1..10) (x[i]==x[j]);
    }
    code
    #ConstraintProgramming-General
    #DecisionOptimization


  • 5.  Re: an "exist" constraint in opl

    Posted 12/11/09 08:55 AM

    Originally posted by: SystemAdmin


    The previous post is unreadable. here it is again.

    
    using CP;   dvar 
    
    int x[1..10] in 1..10; maximize sum(i in 1..10) (x[i] == i); subject to
    { or(ordered i,j in 1..10) (x[i]==x[j]); 
    }
    

    #ConstraintProgramming-General
    #DecisionOptimization


  • 6.  Re: an "exist" constraint in opl

    Posted 12/11/09 09:06 AM

    Originally posted by: SystemAdmin


    Hi every body,
    can we have a discussion about the difference between:
    
    or(ordered i,j in 1..10) (x[i]==x[j]);
    


    and:
    
    or (ordered i,j in 1..10) (x[i]==x[j]) == 1;
    


    is it really more efficient ?

    NL
    #ConstraintProgramming-General
    #DecisionOptimization