Originally posted by: Mahmoud Fayek
I am trying to formulate a constrain that forces the successors activities to have the same "Mode Id" as their predecessors, if anyone of the predecessors has a particular "Mode Id".
I got " Expecting a tuple type, found int." error for the red part of the code.
Here's the part of the model that concerns:
-
tuple Activity {
-
key int id;
-
string name;
-
{int} succs;
-
}
-
{Activity} Activities = ...;
-
-
tuple Mode {
-
key int activityId;
-
key int id;
-
int Accomplishment;
-
int pt;
-
int dmdRenewable [RRs];
-
int dmdNonRenewable[NRs];
-
}
-
{Mode} Modes = ...;
-
-
subject to {
-
forall (a1 in Activities, a2 in a1.succs)
forall ( m1, m2 in Modes : m1.activityId==a1.id && m2.activityId==a2.id && m1.Accomplishment=="Mode Id" )
m2.Accomplishment=="same Mode Id";
-
}
I got the same error " Expecting a tuple type, found int." after simplification :
-
forall (a1 in Activities, a2 in a1.succs)
forall ( m1 in Modes : m1.activityId==a1.id && m1.Accomplishment==0 )
forall ( m2 in Modes : m2.activityId==a2.id)
m2.Accomplishment==0;
#DecisionOptimization#OPLusingCPOptimizer