Question: this is the data value and the objective function must be 6 8 : % This first case is a very simple test on 2

this is the data value and the objective function must be 68: %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]);
here is the minizinc code: include "globals.mzn";
% Parameters
int: n_tasks; % Number of tasks
int: n_turbine; % Number of turbines
int: n_employee; % Number of employees
int: n_period; % Number of time periods
int: n_week; % Number of weeks
int: n_day; % Number of days
% Input Data
array[1..n_turbine, 1..n_period] of int: productivity; % Productivity of each turbine per period
array[1..n_tasks] of int: on_turbine; % Turbine assigned to each task
% Decision Variables
array[1..n_tasks] of var 1..n_period: start_time; % Start time of each task
array[1..n_tasks] of var 1..n_period: end_time; % End time of each task
array[1..n_tasks] of var 1..n_period: length; % Duration of each task
array[1..n_turbine] of var int: loss_turbine; % Productivity loss for each turbine
% Derived Variables
array[1..n_turbine] of var int: total_productivity =[
sum(p in 1..n_period)(productivity[t, p])| t in 1..n_turbine
];
% Constraints
%1. No two tasks on the same turbine can overlap
constraint forall(t in 1..n_turbine)(
cumulative(
[start_time[i]| i in 1..n_tasks where on_turbine[i]= t],
[length[i]| i in 1..n_tasks where on_turbine[i]= t],
[1| i in 1..n_tasks where on_turbine[i]= t],
1
)
);
%2. Duration calculation
constraint forall(i in 1..n_tasks)(
length[i]= end_time[i]- start_time[i]+1
);
%3. Each employee handles only one task at a time
constraint cumulative(start_time, length, [1|_ in 1..n_tasks], n_employee);
%4. Calculation of productivity losses for each turbine
constraint forall(t in 1..n_turbine)(
loss_turbine[t]= sum(p in 1..n_period)(
sum(i in 1..n_tasks where on_turbine[i]= t)(
bool2int(start_time[i]<= p /\ p <= end_time[i])* productivity[t, p]
)
)
);
% Objective Function
var int: actual_productivity = sum(t in 1..n_turbine)(
total_productivity[t]- loss_turbine[t]
);
solve maximize actual_productivity;
please correct the code for me in order to get 68 as objective function value.

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!