New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arithmetic Operation on Infinite Value Error - Option Types #51

Closed
markmanser opened this Issue Sep 10, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@markmanser

markmanser commented Sep 10, 2015

The following code from the paper "Modelling with Option Types in MiniZinc" throws the error:
MiniZinc: arithmetic error: arithmetic operation on infinite value

NOTE: Hopefully I haven't made a silly mistake with the allowable input parameter values.

Side note: It might also be a good time to point out that the arguments to a number of the scheduling global constraints are miss-specified. Several constrains list "var int" when it should only be "int". It would be worth giving the global constraints a review because I have encountered other mistakes as well.

include "globals.mzn";

% Example 11. A MINIZINC model for flexible job shop scheduling as discussed in Example
% 1 is shown below. Note that the optional variables are used to give start times for
% the version of the tasks starting on each machine. The disjunctive constraint is the
% version lifted for option types. The alternative constraints are directly defined on
% option types; they enforce the span constraint (see Example 10) as well as ensuring at
% most one optional task actually occurs. The redundant cumulative constraint ensures
% no more than k tasks run at one time. The aim is to minimize the latest end time.

int: horizon = 300; % time horizon
set of int: Time = 0..horizon;
int: n = 10; % number of tasks
set of int: Task = 1..n;
int: k = 10; % number of machines
set of int: Machine = 1..k;
array[Task,Machine] of int: d = [| 
1,2,3,4,5,6,7,8,9,10,|
1,2,3,4,5,6,7,8,9,10,|
1,2,3,4,5,6,7,8,9,10,|
1,2,3,4,5,6,7,8,9,10,|
1,2,3,4,5,6,7,8,9,10,|
1,2,3,4,5,6,7,8,9,10,|
1,2,3,4,5,6,7,8,9,10,|
1,2,3,4,5,6,7,8,9,10,|
1,2,3,4,5,6,7,8,9,10,|
1,2,3,4,5,6,7,8,9,10 |];
int: maxd = max([ d[t,m] | t in Task, m in Machine ]);
int: mind = min([ d[t,m] | t in Task, m in Machine ]);
array[Task] of var Time: S;
array[Task] of var mind..maxd: D;
array[Task,Machine] of var opt Time: O;

constraint 
forall(m in Machine)
(
  disjunctive([O[t,m] | t in Task], [d[t,m] | t in Task])
);

constraint 
forall(t in Task)(
    alternative(S[t], 
                D[t], 
                [O[t,m] | m in Machine], 
                [d[t,m] | m in Machine])
);

constraint cumulative(S, D, [1 | i in Task], k);

solve minimize max(t in Task)(S[t] + D[t]);
@guidotack

This comment has been minimized.

Member

guidotack commented Sep 14, 2015

Yes, that's a regression, I'll have to look into it more closely. Regarding the global constraints, the specifications are actually correct, they're simply the most general versions of these constraints (i.e. with flexible durations and capacities).

@guidotack

This comment has been minimized.

Member

guidotack commented Sep 21, 2015

I found the problem, it's fixed now in the develop branch.

@markmanser

This comment has been minimized.

markmanser commented Oct 13, 2015

The problem now begins running without reporting an error, but I ran the code included above for 48 hours on 2 cores without reaching an optimal solution. I then switched it to satisfy and ran it for 2 minutes and didn't achieve any satisfiable solution. Do you have a copy of the dataset that was used with the paper (to confirm the code will actually return the correct solution, as the above dataset may not be sensical)? I haven't yet been able to get a model to solve correctly using option types.

I also ran the following 2 examples from the same paper "Modelling with Option Types in MiniZinc":

Example1:

include "globals.mzn";

int: n = 10; % number of tasks
int: m = 15; % number of workers
array[1..m] of var opt 1..n: w; % task for each worker
constraint alldifferent(w);
solve satisfy;

Returns the following error:

MiniZinc: type error: no function or predicate with this signature found: `alldifferent(array[int] of var opt int)'

Example2:

include "globals.mzn";

int: n = 15; % number of tasks
int: m = 10; % number of workers
array[1..m,1..m] of bool: compatible;
array[1..m] of var 1..n: w; % task for each worker
array[1..n] of var opt 1..m: t; % worker for each task
constraint inverse(w,t);
constraint forall(j in 1..n-1)(compatible[t[j],t[j+1]]);
solve satisfy;

Returns the following error (yes, I realize the "compatible" param still needs to be populated) :

MiniZinc: type error: no function or predicate with this signature found: `inverse(array[int] of var int,array[int] of var opt int)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment