Hi,
I have a question on how to declare a conditional-optional decision variable in CP. I have a decision variable (i.e.,
activity) which is declared over two tuples (i.e.,
allActivities_tri &
allActivities_2). These tuples are as follow:
tuple ActivityInfo {
key string activity;
string activity_type;
string export_string;
int duration;
int lb_duration;
int ub_duration;
int wait;
int lb_wait;
int ub_wait;
float mu_p;
float sigma_p;
float mu_w;
float sigma_w;
{string} precedences;
float slope_p;
float intercept_p;
float error_p;
float slope_w;
float intercept_w;
float error_w;
};
{ActivityInfo} activities[ProductTypes] = ...;
tuple BatchActivityMatch {
ActivityInfo activity;
string ProductTypes;
int nOrders;
};
{BatchActivityMatch} allActivities = {<a,c,j> | c in ProductTypes,
a in activities[c],
j in 1..requiredQuantities[c]};
tuple R{
BatchActivityMatch allActivities;
int trig_process;
int trig_wait;
int trig_process_energy;
int trig_wait_energy;
}
{R} allActivities_tri={<a,c,e,f,g> | a in allActivities,c in tringular_processing[a]..tringular_processing[a],e in tringular_waiting[a]..tringular_waiting[a],f in tringular_processing_energy[a]..tringular_processing_energy[a],g in tringular_waiting_energy[a]..tringular_waiting_energy[a]};
tuple Y{
string ProductTypes ;
int requiredQuantities;
};
{Y} allActivities_2 = {<c,j> | c in ProductTypes,
j in 1..requiredQuantities[c]};
The decision variable is declared as follows:
dvar interval activity[a in allActivities_tri][b in allActivities_2] optional size 5;
The problem that there are many ProductTypes with different requiredQuantities/nOrders. When I declare the decision variable in that way, the number of variables and their associated constraints increases exponentially. I would like to make the activity decision variable present if:
a.allActivities.ProductTypes==b.ProductTypes && a.allActivities.nOrders==b.requiredQuantities
and absent if:
a.allActivities.ProductTypes!=b.ProductTypes || a.allActivities.nOrders!=b.requiredQuantities
I would like to do that to decrease the number of the variables in the model to avoid running out of memory. Is it possible to do that?
Best regards,
Mohamed
------------------------------
Mohamed Awad
------------------------------
#DecisionOptimization