Question: Hello everyone, when I execute this code in minizinc, it not working, please support me to correct it: % Parameters int: n _ employee; %

Hello everyone, when I execute this code in minizinc, it not working, please support me to correct it: % Parameters
int: n_employee; % number of technicians
int: n_turbine; % number of wind turbines
int: n_tasks; % number of tasks
int: n_week; % number of weeks
int: n_day; % number of days per week
int: n_period = n_day *3; % number of periods per day
% Productivity of each wind turbine during each period
array[1..n_turbine, 1..n_period] of float: productivity;
% Wind turbine assigned to each task
array[1..n_tasks] of int: on_turbine;
% Duration of each task in periods
array[1..n_tasks] of int: length;
% Skills of technicians
int: n_skills; % Number of available skills
array[1..n_employee, 1..n_skills] of int: skills;
% Skills required to perform each task
array[1..n_tasks] of int: skill_req;
% Decision Variables
array[1..n_tasks, 1..n_period] of var 0..1: exec; % Task execution
array[1..n_tasks, 1..n_period] of var 0..1: start; % Task start
array[1..n_tasks, 1..n_period] of var 0..1: end; % Task end
% Constraints
% Each task must start exactly once
constraint
forall(i in 1..n_tasks)(
sum(p in 1..n_period)(start[i, p])=1
);
% Each task must finish exactly once
constraint
forall(i in 1..n_tasks)(
sum(p in 1..n_period)(end[i, p])=1
);
% Each task must last for its specified duration across consecutive periods
constraint
forall(i in 1..n_tasks)(
sum(p in 1..n_period)(exec[i, p])= length[i]
);
% No overlapping tasks on the same turbine during a single period
constraint
forall(t in 1..n_turbine, p in 1..n_period)(
sum(i in 1..n_tasks where on_turbine[i]= t)(exec[i, p])<=1
);
+(exec[i, p-1]/\(end[i, p-1]=0))
);
% Initialization of the first period
constraint
forall(i in 1..n_tasks)(
exec[i,1]= start[i,1]
);
% Objective function: Maximize the total energy production
var float: total_energy = sum(i in 1..n_tasks, p in 1..n_period)(
exec[i, p]* productivity[on_turbine[i], p]
);
solve maximize total_energy;
here is the data value: %This first case is a very simple test on 2 days and 2 wind turbines
%You can solve it by hand to be sure of your result and modify the data for testing purposes
n_employee =1;
n_turbine =2;
n_tasks =3;
n_week =1;
n_day =2;
n_period = n_day*3; %3 periods per day
%productivity of an wind turbine at each period
productivity = array2d(1..n_turbine,1..n_period,[10,8,10,8,9,9,
10,5,6,7,9,9]);
%duration and location of each task
on_turbine = array1d(1..n_tasks,[1,1,2]);
length = array1d(1..n_tasks,[1,1,2]);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!