Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Quick note 2: depending on the MiniZinc version, we can describe enpty matrices like "M = []". On version 2.2.1, we have to build an empty matrices explicitly: "M = array2d(0..0, 1..10, [])". The dimensions must agree with the model. So, for example, if you have in the model file:

Code Block
linenumberstrue
int: numElements;
int: numAttributes;
array[1..numElements, 1..numAttributes] of int: attributes;

but we have no attributes, the data file should look like this:

Code Block
linenumberstrue
numElements = 4;
numAttributes = 0;

% attributes = []; does not work on version 2.2.1
attributes = array2d(1..numElements, 1..numAttributes, []);

% attributeConcurrencyLimit = []; does not work on version 2.2.1
attributeConcurrencyLimit = array2d(1..numAttributes, 1..maxTime, []);

...

For generic model model generic_attributes.mzn, this is one possible data input file (lines starting with % are comments, and they are not needed in the file):

Code Block
linenumberstrue
numElements = 3;
numLoaders = 1;
maxTime = 5;

noConflict = [|
  true  , true  , true  , true  , true
| true  , true  , true  , true  , true
| false , true  , false , true  , false
|];

elementSlotCapacity = [1, 2, 1, 3, 3];

% Since the (unique) loader has virtually
% infinity capacity, we assign the number
% of elements as capacity.
% We can also do:
% loaderCapacity = [|
% numElements, numElements, numElements, numElements, numElements
% |];
loaderCapacity = [|
 3, 3, 3, 3, 3
|];

numAttributes = 0;
attributesRange = [];

% attributes = []; does not work on version 2.2.1.
% We must built it explicitly
attributes = array2d(1..numElements, 1..numAttributes, []);

% attributeConcurrencyLimit = []; does not work on version 2.2.1.
% We must built it explicitly
attributeConcurrencyLimit = array2d(1..numAttributes, 1..maxTime, []);

...

To solve the problem, we use the following command line:

Code Block
languagebash
$ minizinc --solver OSICBC --time-limit 60000 --soln-sep '' --search-complete-msg '' generic_attributes.mzn generic_attributes_3.dzn 

...

This is the result output when using the command line (it may varies if using IDE or underline solver):

Code Block
languageyml
linenumberstrue
results:
  -
    num_scheduled: 3
    total_completion_time: 5
    element_slot_loader: |
      1,2,1
      2,1,1
      3,2,1

...