minizinc

Optimise multiple objectives in MiniZinc

耗尽温柔 提交于 2021-02-10 12:44:33
问题 I am newbie in CP but I want to solve problem which I got in college. I have a Minizinc model which minimize number of used Machines doing some Tasks. Machines have some resource and Tasks have resource requirements. Except minimize that number, I am trying to minimize cost of allocating Tasks to Machine (I have an array with cost). Is there any chance to first minimize that number and then optimizate the cost in Minizinc? For example, I have 3 Task and 2 Machines. Every Machine has enough

Optimise multiple objectives in MiniZinc

拜拜、爱过 提交于 2021-02-10 12:43:19
问题 I am newbie in CP but I want to solve problem which I got in college. I have a Minizinc model which minimize number of used Machines doing some Tasks. Machines have some resource and Tasks have resource requirements. Except minimize that number, I am trying to minimize cost of allocating Tasks to Machine (I have an array with cost). Is there any chance to first minimize that number and then optimizate the cost in Minizinc? For example, I have 3 Task and 2 Machines. Every Machine has enough

Optimization Problem of a Single Lessons Scheduling Model

风格不统一 提交于 2021-01-29 08:30:22
问题 I've written a Minizinc-Model that allows a teacher to schedule single lessons of his students. Teacher and students can prioritize their available time slots ( prioTeacher , respectively prio ). The model works fine for simple and small input sets, but with a realistic set of input data, i.e. 3 days, each having 44 time slots (== 15 minutes) and 11 students, didn't find the optimal solution after more than 24 hours. Model ( stupla-prio.mzn ) % enum of presence days enum DAY; int: num_days =

What is the use of minizinc fix function?

﹥>﹥吖頭↗ 提交于 2021-01-29 06:06:57
问题 i see that fix documentation says: http://www.minizinc.org/doc-lib/doc-builtins-reflect.html#Ifunction-dd-T-cl-fix-po-var-opt-dd-T-cl-x-pc function array [$U] of $T: fix(array [$U] of var opt $T: x) Check if the value of every element of the array x is fixedat this point in evaluation. If all are fixed, return an array of their values, otherwise abort. I am thinking it can be used to coerce a var to a par. Here is the code. array [1..num] of var int: value ; %% generate random numbers from 0.

Minizinc: generate a valid shift

本小妞迷上赌 提交于 2020-02-16 03:18:05
问题 Hope someone can help me with this! The original problem is to generate valid shifts like explained below: I have arrays like this [m,m,m,o,o,l,l,m,m,m,l,m,m,m] with a fixed length (S) where m is work, o is office and l free. What I need to make sure is that at least every 6m I have two l together (ll). The o does not count as work or as free. Examples: mmlmmlmmmll is not valid (7 ms without two ls) mmlmmlmmll is valid mmomomommll is valid What I was trying is to create an array with 0 (for

Minizinc. Count number of shifts in a cycle

拜拜、爱过 提交于 2020-01-24 12:17:27
问题 Continuing with the other post ( Minizinc: generate a valid shift ). I am trying to have a maximum of 2 im between double ls. Doing this with a regular constraint is quite hard as the transition table would be quite big (too many paths). Is there any way to solve it? I have tried this, but it is giving me errors: include "globals.mzn"; enum TypeOfShift = {l,m,o,im}; enum Staff = {John, Mike, Mary}; %array[1..30] of TypeOfShift: Roster=[m, m, m, l, l, o, im, m, m, m, l, l, l, im, m, m, m, m,

Map upper triangular matrix on vector skipping the diagonal

帅比萌擦擦* 提交于 2020-01-03 17:29:58
问题 I have a problem that could be boiled down to finding a way of mapping a triangular matrix to a vector skipping the diagonal. Basically I need to translate this C++ code using the Gecode libraries // implied constraints for (int k=0, i=0; i<n-1; i++) for (int j=i+1; j<n; j++, k++) rel(*this, d[k], IRT_GQ, (j-i)*(j-i+1)/2); Into this MiniZinc (functional) code constraint forall ( i in 1..m-1 , j in i+1..m ) ( (differences[?]) >= (floor(int2float(( j-i )*( j-i+1 )) / int2float(2)) )); And I

Constraint Programming: Scheduling with multiple workers

烂漫一生 提交于 2020-01-02 07:03:17
问题 I'm new to constraint programming. I imagine this is an easy problem but I can't wrap my head around it. Here's the problem: We have multiple machines (N), each with a limited resource (let's say memory, and it can be the same for all machines.) We have T tasks, each with a duration and each requiring some amount of the resource. A machine can work on multiple tasks at the same time as long as its resource isn't exceeded. A task cannot be split among machines and it has to be done in one shot

Projection of solutions

给你一囗甜甜゛ 提交于 2019-12-22 10:48:08
问题 Is there a possibility to tell MiniZinc to project solutions on a subset of the set of variables? Or is there any other way to enumerate all solutions that are unique wrt to evaluation of some subset of variables? I have tried to use FlatZinc annotations directly in MiniZinc, but it does not work, since the flattening process adds more defines_var annotations and my annotations are ignored. 回答1: I tried the following model in MiniZinc 2.0 (https://www.minizinc.org/2.0/index.html) and this

Index of string value in MiniZinc array

老子叫甜甜 提交于 2019-12-22 10:30:01
问题 The question Given a MiniZinc array of strings: int: numStats; set of int: Stats = 1..numStats; array[Stats] of string: statNames; ... with data loaded from a MiniZinc data file: numStats = 3; statNames = ["HEALTH", "ARMOR", "MANA"]; How can one look up the index of a specific string in the array? For example, that ARMOR is located at position 2. The context I need to find an optimal selection of items with regard to some constraints on their stats. This information is stored in a 2D array