Hi,
my goal was to help.
The equation in the image can be written as
range I=1..3;
range J=1..4;
int B=10;
dvar int Y[I][J];
dvar int X;
subject to
{
X==sum(i in I,j in J) (Y[i][j]==B);
X==3;
}
which gives
X = 3;
Y = [[10 10 10 0]
[0 0 0 0]
[0 0 0 0]];
------------------------------
[Alex] [Fleischer]
[EMEA CPLEX Optimization Technical Sales]
[IBM]
------------------------------
Original Message:
Sent: Tue June 22, 2021 09:36 AM
From: Siwar Moumni
Subject: Re: Summation in post processing execute Block
Dear @ALEX FLEISCHER
in your solution , why did you use only the index (i) and where is it the second one (j) !! at the photo of the author it exist two summation ,can you explain more Dear Mr.
Regards.
------------------------------
Siwar
------------------------------
Original Message:
Sent: Tue June 22, 2021 09:36 AM
From: ALEX FLEISCHER
Subject: Re: Summation in post processing execute Block
Hi,
you can use logical expressions in OPL:
dvar int x[1..10];
subject to { forall(i in 1..10) x[i]==i mod 3; }
int y=sum(i in 1..10) (x[i]==2);
execute { writeln("y=",y); }
gives
y=3
regards
#DecisionOptimization