Questions tagged [minizinc]

MiniZinc is a solver-independent Constraint-Programming modelling language.

MiniZinc as modelling language is high-level enough to express most constraint problems easily, but low-level enough that it can be mapped onto existing solvers easily and consistently. This is done by converting the MiniZinc model to a lower-level language, FlatZinc. It is a subset of the higher-level language Zinc.

Around MiniZinc, several FlatZinc solvers and an IDE for development are freely available.

The MiniZinc home is here: http://www.minizinc.org

Hakan Kjellerstrand's MiniZinc page has lots of MiniZinc models and global constraint definitions.

426 questions
0
votes
1 answer

Assigning times to events

include "globals.mzn"; %Data time_ID = [11,12,13,14,15]; eventId = [0011, 0012, 0013, 0021, 0022, 0031, 0041, 0051, 0061, 0071]; int:ntime = 5; int:nevent = 10; set of int: events =1..nevent; set of int: time = 1..ntime; …
fenimi
  • 21
  • 4
0
votes
1 answer

Call Minizinc model from Java

How to call a Minizinc model from a Java program with arrays as passed-on parameters? Is there any special command for doing this?
jan06
  • 79
  • 2
  • 9
0
votes
1 answer

minizinc: find element in arrray

I have two arrays(type: int) of different length. How could I find the closest number in array b for each number in array a(the following does not work though probably because of syntax error): int: m; int: n; array [1..m] of int: a; array [1..n] of…
jan06
  • 79
  • 2
  • 9
0
votes
1 answer

Declaring multiple variables with one statement in MiniZinc

When writing MiniZinc models, I often declare multiple variables like this: var int: dog; var int: cat; var int: bird; var int: mammal; var int: horse; I tried to declare all of these variables on one line, but it produced a syntax error: var int:…
Anderson Green
  • 30,230
  • 67
  • 195
  • 328
0
votes
1 answer

How can Minizinc be used to solve a weighted constraint satisfaction problem_?

Given a weighted constraint satisfaction problem (X, C, k) where X is a set of variables, C is a set of soft constraints and k > 0 is an integer or infinity; how can this be translated into a minizinc source file? Each constraint in C is a function…
0
votes
1 answer

Large arrays with default values in Minizinc data file?

How to model a large array e.g. "array[1..10000000] of int: A;" which has a lot of 0 as default value. Is there a way to specify "default" value to MiniZinc in order to reduce the data file size?
Umar
  • 111
  • 3
0
votes
1 answer

Switch statements in MiniZinc

In the MiniZinc tutorial, I noticed that the endif keyword was repeated many times at the end of a series of conditional statements. Is it possible to write switch statements in MiniZinc as an alternative to this verbose syntax? For example, I'd…
Anderson Green
  • 30,230
  • 67
  • 195
  • 328
0
votes
1 answer

How can I calculate an intermediate sum of a subset of array elements to use in a downstream constraint in MiniZinc?

I have an array a of type int [0,0,0,0,0] of length l I want to calculate a sum of all elements with odd indexes to use in a downstream constraint, here some "pseudo" MiniZinc code: s = sum(i in 1..l | i mod 2 == 0) (a[i]); solve maximize(s); How…
Romeo Kienzler
  • 3,373
  • 3
  • 36
  • 58
0
votes
1 answer

MiniZinc 2.0.5: "in array comprehension...cannot determine bounds"

In a model that I've written in MiniZincIDE 0.9.9, the following constraint throws a "cannot determine bounds" error during array comprehension: constraint forall(i in Layers)( layDists[i] == sum( [Dists[find(a,b,c,d)] | a in Coords, c in Layers,…
user123403
  • 31
  • 4
0
votes
1 answer

Optimization with constraint programming

I want to express and solve below equations in a constraint programming language. I have variables t and trying to find best multipliers k which minimizes my objective function. Time: t1, t2, t3... given in input Multipler k1, k2, k3... (This is…
0
votes
1 answer

Schedule minizinc no overlapping

I want to do a schedule with no overlapping only 1 teacher can be booked at 1 timeslot. I want to create a 2darray like teachers a rows and timeslot is coloumns.
user3664730
  • 45
  • 1
  • 8
0
votes
0 answers

Minizinc soft constraint issue

i'm facing an issue with a Minizinc code that have to schedule some exams in available rooms and periods. I skip the entire problem and code, because i've just a problem in the definition of this soft constraint: some exams are targeted as…
0
votes
0 answers

Simplifying MiniZinc constraints

I would like to simplify a group of repetitive constraints that appear in a model. The aim is to ensure that a group of experts is staffed with a quantity of skills, each expert having 0..n skills. Currently, I have to repeat the constraint for each…
user1454590
  • 71
  • 1
  • 3
0
votes
0 answers

How to setup a data file in MiniZinc?

In Config tab Additional arguments I put: C:\data\j.dzn Which cryptically replies: Error: cannot handle file extension dzn". Usage: mzn2fzn [] [-I ] .mzn [.dzn ...]
Jim Lewis
  • 349
  • 2
  • 14
0
votes
1 answer

How can I make this MiniZinc output statement compile?

How do I revise this to compile in MiniZinc: output [[show (P[j,p]) ++ "\n" | p in 1 .. 4] | j in 1 .. 4]; I tried several ways.
Jim Lewis
  • 349
  • 2
  • 14