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

Can more than one 'solve' be applied in MiniZinc?

I tried to applied a structure as follow in a single mzn file: define Variables; %% first set of constraints constraint ...; constraint ...; solve satisfy; %% second set of constraints constraint ...; constraint ...; solve satisfy; where second…
GabrielChu
  • 6,026
  • 10
  • 27
  • 42
0
votes
1 answer

MiniZinc Assign Different Domain to Each Var in Array

I have an array: array[backpacks] of int: capacity specifying the capacity of each backpack. Now I want to create an array of variables which the constraint solver will have to satisfy. I want each variable to take values in domain 1..capacity where…
Silver
  • 1,327
  • 12
  • 24
0
votes
1 answer

Minizinc modelling: Vars as coordinate sets

I am modelling a constraint satisfaction program in minizinc where the solution is an assignment of points on a 3D grid. One of the constraints is that only one point can occupy any given position, so the points must be pairwise different in at…
Tall Man
  • 13
  • 3
0
votes
1 answer

Why is this MiniZinc declaration "unexpected"?

I'm a MiniZinc newbie trying to generalize the toy program in the MiniZinc tutorial for coloring the map of Australia, by using arrays. Here is the program with my 2 array declarations: % Colouring Australia using nc colours int: nc = 3; /*…
user1067305
  • 3,233
  • 7
  • 24
  • 29
0
votes
1 answer

Extract column as set from a matrix

In MiniZinc, I need to extract a column from a matrix, in order to have a set composed by the values of the column. For example if I have a table like that: 1 0 0 6 4 6 3 5 8 I would like to extract the set of int 1 6 3, in order to have an index…
Bernheart
  • 607
  • 1
  • 8
  • 17
0
votes
1 answer

Stuck making a Tetris solver in Minizinc

I'm trying to implement a Tetris solver in Minizinc, which is also known as the "packing" problem I suppose. I'm brand new to Minizinc and have barely any idea what I'm doing, but I'm currently stuck on a particular constraint in my code. I am…
0
votes
1 answer

Provide start solution in MiniZinc

How can one provide a start solution for an optimization problem formulated in MiniZinc in the IDE or via a data file to, e.g., speed up the solution process of the corresponding fd solver (in this case Gecode)?
Ale
  • 11
0
votes
0 answers

Solving system of non-linear equations in Minizinc

I'm working on a Fluids Mechanics toy problem, the Three Reservoirs Problem and I want to solve it using Minizinc. I have three pipes and I use three equations for each pipe, the result of using them in a pipe is a fluid velocity in that pipe. The…
Manuel
  • 478
  • 8
  • 20
0
votes
2 answers

Minizinc "var set of int: x" instead of "set of int: x"

I have an array of set in the Golfers problem (in each week there should be formed groups, such that no two players play together more than once, and everybody plays exactly one time each week): int: gr; %number of groups set of int: G=1..gr; int:…
Kuba
  • 291
  • 2
  • 5
  • 14
0
votes
1 answer

Return text when conditions are unsatisfiable

I am writing a code that should solve a solitaire in MiniZinc. I have been asked to return a message "This solitaire cannot be solved" if the conditions are unsatisfiable. Unfortunately, I could not find a solution to this problem in the Internet.…
Kuba
  • 291
  • 2
  • 5
  • 14
0
votes
1 answer

Cardinality constraint type failure; how to use minizinc `card` correctly

The following model works for langfords problem int: m = 2; int: n = 3; set of int: DOM = 1..m*n; set of int: RAN = 1..n; array [DOM] of var 1..n: nos; constraint forall(j in DOM, k in j+1..m*n) (nos[j] = nos[k] /\ forall(l in j + 1 .. k -…
kasterma
  • 4,259
  • 1
  • 20
  • 27
0
votes
2 answers

Task scheduling on multiple facilities - cumulative 'var opt error'

I'm having trouble with an implementation of the following CP formulation (full formulation of the problem can be found here (page 4/16)) My implementation seems like code below, but I'm having struggle with following error: MiniZinc: type error:…
mrtn
  • 331
  • 2
  • 12
0
votes
1 answer

Minizinc, counting occurrences in array of pairs

I'm new to constraint programming and toying around with some basic operations. I want to count the number of occurrences of an arbitrary element x in an array of pairs. For instance, the following array has 2 eights, and 1 of every other element.…
user5951413
0
votes
2 answers

Minizinc program complains of failed assertion in global_cardinality

I was trying to solve this problem in Minizinc, taken from Puzzle taken from Gardner : Ten cells numbered 0,...,9 inscribe a 10-digit number such that each cell, say i, indicates the total number of occurrences of the digit i in this number.…
siritinga
  • 4,063
  • 25
  • 38
0
votes
0 answers

Minizinc large array dimension

Am generating a large 2d array in Minizinc(for instance, 250000X300) as I'm searching for solutions in this array. However, Minizinc seems not to be able to handle such large arrays and keeps stop working. Is there any way to solve this problem so…
jan06
  • 79
  • 2
  • 9