Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Aggregation operator FORALL not available for dexpr int

    Posted Sat June 02, 2018 01:26 PM

    Originally posted by: JMendes


    Hello, I've the following error: Aggregation operator FORALL not available for dexpr int

     

    I've defined this tuple,

    tuple T {
      int atual;
      int subs;
      int type;
    }
    {T} ternos = ...;
    dvar boolean x[ternos];
    

     

    So, I've the following constraint:

     

    subject to {
    forall(t in ternos : t.subs<43 && t.subs!=0)
         R1: sum(t1 in ternos : t1.subs == t.subs && t1.atual==0)x[t1] 
    + sum(t2 in ternos : t2.atual>42 && t2.subs==t.subs && t2.type==t.type)x[t2];
    }
    

    Thanks!

    Regards

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Aggregation operator FORALL not available for dexpr int

    Posted Sat June 02, 2018 05:07 PM

    What you have is not a constraint. You are just summing up x variables. What is that supposed to mean? You need these sums to be equal to, less than or equal to or greater than or equal to something. If you write for example

      forall(t in ternos : t.subs<43 && t.subs!=0) {
         R1: sum(t1 in ternos : t1.subs == t.subs && t1.atual==0) x[t1]
           + sum(t2 in ternos : t2.atual>42 && t2.subs==t.subs && t2.type==t.type) x[t2]
           == 0;
      }

    then you don't get any error.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Aggregation operator FORALL not available for dexpr int

    Posted Sat June 02, 2018 05:11 PM

    Originally posted by: JMendes


    Yes, you're right... I've forgot ==1. Thanks! what a lack of attention...


    #CPLEXOptimizers
    #DecisionOptimization