You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Quick note 1: the data input format for MiniZinc model is, in general, dictated by the model. Therefore, we cannot use a generic interface such as JSON or YAML.

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:

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

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

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, []);

Note that you may use a simpler syntax in other MiniZinc versions.


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):

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, []);


This request will represent the information gathered by the Scheduler Optimizer to be passed to the Mini Zinc schedule optimizer engine.

  • numElements the number elements to be scheduled
  • maxTime is the index of last possible time-slot for scheduling (total number of slots in the noConflict array)
  • noConflict reflects the availability of the elements within change window. Each row defines the availability of an element. Each column represents a time slot within the user provided change window. Each timeslot is equivelent to the max duration of a single change. 
  • slotCapacity represents the concurrency limit for each of the time slots. In Dublin, for VNFs, each entry will be equal to the concurrency limit provided in the create schedule request. 

The optimizer engine will support the following constraint inputs, The definition of these constraints will be determined by policy???.

  • numLoaders is 1 (scheduler)
  • loaderCapacity is unlimited (scheduler must be able to support the slotCapacity)
  • numAttributes, attributeRange, attributes and attributeConcurrencyLimit - From policy / templates.


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

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

where:

  • --solver OSICBC: uses the Coin CBC solver, with is the preferable solver in the most cases. For cases it does not work, we recommend to use Google OR tools;
  • --time-limit 60000: 60 seconds of time limit. If the input is big, the solver may require more time to deploy a solution;
  • --soln-sep '': avoid to print "----" between solutions;
  • --search-complete-msg '': avoid to print "====" between solutions in the end.

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

results:
  -
    num_scheduled: 3
    total_completion_time: 5
    element_slot_loader: |
      1,2,1
      2,1,1
      3,2,1

This request will represent the information returned to the Scheduler Optimizer from the Mini Zinc schedule optimizer engine.

Multiple "schedules" may be returned the objective being to schedule the most changes in the least amount of time. 


Other important notes:



  • No labels