2

I have a working model with its associated dzn files. I have tried different solvers (Gurobi, ORTools & Chuffed). All solvers can find a solution (for now, I'm only using solve satisfy;. However, if I increase the problem size, Gurobi & ORTools cannot find a solution in a reasonable amount of time (> 25 min) whereas Chuffed find a solution within 1 to 2 min. For ORTools I have these stats, but cannot find a solution within 25 min.

Flattening ...
CompilePass: Flatten with /Applications/MiniZincIDE.app/Contents/Resources/share/minizinc//' library ...
    MIP domains ... done (298.16 s)
    Optimizing ... done (314.31 s)
    Converting to old FlatZinc ... done (352.18 s)
     done (352.18 s)
     done (352.38 s), max stack depth 32

I am using default settings for solvers. What would you recommend ? What could explain such big differences between Chuffed & Gurobi/ORTools ? Thanks for your hints.

PS: here is the model

include "globals.mzn";

%-----------------------------------------------------------------------------%
% MODEL PARAMETERS

% Tasks
int: n_tasks;                           % The number of tasks
set of int: Tasks = 1..n_tasks;         % The set of all tasks
array[Tasks] of int : duration  ;       % The task durations
array[Tasks] of set of int: predecessor;  % The task successors
array [Tasks, 1..2] of int: early_late_start;  % early late start bouding information

% Resources
int: n_resources;
set of int: Resources = 1..n_resources; 
array[Tasks] of set of int: resource_needed;  % The resource requirements
array[Tasks] of set of int: resource_forbidden;  % The resource requirements
array[Tasks] of int: number_resource_needed;  % The resource requirements

% Maximum duration
int: t_max;


%-----------------------------------------------------------------------------%
%~~~~~~~~~~~~~~~~~
% MODEL VARIABLES.
%~~~~~~~~~~~~~~~~~
array [Tasks] of var 1..t_max: start;  % The start times
array[Tasks, Resources] of var 0..1: resource_allocation; %Selection of resources per task.
%-----------------------------------------------------------------------------%

%-----------------------------------------------------------------------------%
%~~~~~~~~~~~~~~~~~
% CONSTRAINTS
%~~~~~~~~~~~~~~~~~

%~~~~~~~~~~~~~~~~~
% Resource Allocation Constraints
%~~~~~~~~~~~~~~~~~
% Mandatory & Forbidden constraint allocation
constraint forall(t in Tasks, r in resource_needed[t])(resource_allocation[t,r]=1);
constraint forall(t in Tasks, r in resource_forbidden[t])(resource_allocation[t,r]=0);
% Number of Resources per Task constraint
constraint forall(t in Tasks) (
  sum(r in Resources) (resource_allocation[t, r]) = number_resource_needed[t]
  );
  
% Constraint allocated to only one task at a time
constraint forall(r in Resources)(
    cumulative(start, duration, [resource_allocation[t, r] | t in Tasks], 1)
);


%constraint cumulative(start, duration, [ sum(r in Resources)(resource_allocation[t,r]) | t in Tasks ],
%  1 );

%~~~~~~~~~~~~~~~~~
% Task Scheduling
%~~~~~~~~~~~~~~~~~
 % Early Start / Late Start
 constraint forall(i in Tasks)(
    early_late_start[i, 1]<= start[i] /\ start[i] <= early_late_start[i, 2] 
);

 % Precedence constraint
 constraint
 forall(i in Tasks, j in predecessor[i])(
    start[j]+duration[j]<= start[i]
);
 
 % Max Time constraint 
constraint forall(i in Tasks)(
    start[i] + duration[i] <= t_max
);
 
 solve satisfy;
Yop
  • 23
  • 4
  • Did you find the solution for the problem? – Jan Koekepan Nov 01 '22 at 13:39
  • Unfortunately, no. I transformed my code directly into OR Tools format. I have read that some times, the preprocessing can be super long, haven't find anyone proposing a solution. – Yop Nov 09 '22 at 08:43

0 Answers0