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
4
votes
1 answer

Longest subset of five-positions five-elements permutations, only one-element-position in common

I am trying to get the longest list of a set of five ordered position, 1 to 5 each, satisfying the condition that any two members of the list cannot share more than one identical position (index). I.e., 11111 and 12222 is permitted (only the 1 at…
rbenit68
  • 75
  • 3
4
votes
1 answer

Using forall() predicate in minizinc as assignment statement without 'constraint'

I have a Minizinc program for generating the optimal charge/discharge schedule for a grid-connected battery, given a set of prices by time-interval. My program works (sort of; subject to some caveats), but my question is about two 'constraint'…
Max Power
  • 8,265
  • 13
  • 50
  • 91
4
votes
1 answer

Understanding the input format of Minizincs geost constraint

I'm trying to understand MiniZincs geost constraint, which is described in the packing constraint section of the docs. I'm trying to implement 2D packing of rectangles with rotation: So I'd like to fit rectangles on a plate of given length and…
Phonolog
  • 6,321
  • 3
  • 36
  • 64
4
votes
1 answer

Why would more array accesses perform better?

I'm taking a course on coursera that uses minizinc. In one of the assignments, I was spinning my wheels forever because my model was not performing well enough on a hidden test case. I finally solved it by changing the following types of accesses in…
Jack
  • 155
  • 4
4
votes
1 answer

What is Channeling in MiniZinc? Can you provide an simple example to explain Channeling? Finally, What is Inverse?

What is Channeling in MiniZinc? Can you provide an simple example to explain Channeling? Finally, What is Inverse?
4
votes
1 answer

Why picat says that the model is unsatisfiable?

The picat solver (v. 2.6#2) states that the example model knights.mzn contained in the minizinc repository and hereby copy-and-pasted: % RUNS ON mzn20_fd % RUNS ON mzn-fzn_fd % RUNS ON mzn20_mip % knights.mzn % Ralph Becket % vim: ft=zinc ts=4 sw=4…
Patrick Trentin
  • 7,126
  • 3
  • 23
  • 40
4
votes
1 answer

MiniZinc: type error: no function or predicate with this signature found: `floor(var int)'

I'm trying to run the following code on Mac OS/X with Minizinc IDE 2.2.3 and Geocode 6.1.0 [built in]: var 1..10: x; var float: y = x div 4; constraint y == floor(y); solve minimize( (x - 7)^2 ); output ["\(x) \(y)"] The error I receive…
Chris Snow
  • 23,813
  • 35
  • 144
  • 309
4
votes
1 answer

Increment variable array elements in Minizinc

I would like to perform a simple increment operation on specific array elements: Minimal Not-Working Example: array[1..2] of var 0..1: a = [0, 0]; constraint forall (i in 1..2) ( a[i] = a[i] + 1 ); output ["\(a)"]; solve satisfy; This…
thruun
  • 461
  • 5
  • 15
4
votes
2 answers

Fill grid with colors following pattern rules

I'm trying to solve this problem. Unfortunately I don't have a name for this kind of puzzle so I'm not sure what to search for. The closest examples I can find are Nonogram and Tomography puzzles. Puzzle description: The player is given an empty…
Jaxe
  • 43
  • 4
4
votes
1 answer

MiniZinc - Array of (multidimensional) array

I would like to know if it’s possible to have array of (multidimensional) array in MiniZinc language. Indeed, I would like to resolve a timetabling problem with workers. My goal is to check if they are available at least 1 day per week. Each worker…
Nicolaz
  • 149
  • 1
  • 8
4
votes
1 answer

Minizinc nested output loop

I am trying to write an output statement with nested loops, and non-trivial output at the outer levels. If Minizinc had a top level for command, I would do something like for (f in Foo) ( output(["Foo: ", f]) for (b in Bar) ( for (q in Quz)…
Troy Daniels
  • 3,270
  • 2
  • 25
  • 57
4
votes
1 answer

Minizinc, how to create a map or a dictionary datastructure

I have a simple question regarding the Minizinc's syntax. My input .dzn file contain a set of 2 dimentional arrays (approximately up to 30 arrays), declared as follows: rates_index_0 = array2d(1..3, 1..501, [ 15, 20, 23, .... rates_index_12 =…
kirbo
  • 1,707
  • 5
  • 26
  • 32
4
votes
2 answers

Multiple output under minizinc

Try to learn minizinc but after going through examples, may I just confirm that I actually have to write some procedural language if I want to get multiple output or there is a more "natural to minizinc" way to get it. For example, suppose I want to…
Dennis Ng
  • 361
  • 3
  • 11
4
votes
4 answers

Index of string value in MiniZinc array

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…
Zero3
  • 594
  • 2
  • 11
  • 18
4
votes
1 answer

Parallel solving in Minizinc from the command line

The Minizinc IDE has a parallel solver option ("Number of threads") in the config section. When compiling from the commandline, however, the mzn2fzn binary doesn't seem to support a parallel option. Is it possible to solve in parallel from a…
beardc
  • 20,283
  • 17
  • 76
  • 94
1
2
3
28 29