Newest 'minizinc' Questions (original) (raw)
0 votes
1 answer
45 views
Error parsing json while running Minizinc from python using OR-tools as solver
I am running minizinc from python, using minizinc python library with: model = Model() _solver = Solver.lookup(solver) inst = Instance(_solver, model) if len(model_file) > 0: ...
- 3,781
asked Jan 7 at 20:30
0 votes
3 answers
196 views
MiniZinc - Optimizing Script for Scheduling Problem
The following code generates a schedule that fits the following scenario: An event is taking place with 8 stations and 24 teams. There are 3 teams at a station at a time. There are exactly 8 rotations,...
- 1
asked Jan 4 at 9:05
0 votes
1 answer
26 views
MiniZinc: syntax error: syntax error, unexpected [, expecting end of file
I am trying to solve a puzzle for my sporting event in which i want to equally place all matchups that variate enough without playing the sport more than twice (14 games per team in total) and also as ...
- 11
asked Jan 1 at 0:41
minizinc logic to ortools CP
I created a model in minizinc that I am translating to ortools CP (sat). My main variable is q_shifts[starts_at][length] which is an array of 2D, first is starts_at and 2nd is length, thus is the ...
- 3,781
asked Dec 27, 2024 at 22:00
declaring a MiniZinc array of variables where each variable has a specific domain given by a formula
I would like to declare an array x of 2n+1 domain variables, where the domain of the i-th variable of the array (with in in [1,2n+1]) is given by the following interval min(i-n,0)..max(i-n,0). For ...
- 113
asked Nov 26, 2024 at 19:06
0 votes
1 answer
57 views
Max 2d-Array Size in minizinc with or-tools CP-SAT
define 2d-array as following in minizinc : array[1..400,1..400] of var int : en_b ; run with Or-tools CP-SAT 9.11 as backend , get error with "=====UNKNOWN=====" . PS. 9.11 is default with ...
- 43
asked Nov 14, 2024 at 7:08
Creating the maximum number of brackets
I've taken on running brackets on my bowling league. It's small league, just 60 people (12 teams). Every week we bowl three games. Each person can be in multiple brackets as their scores are not, to a ...
- 836
asked Oct 7, 2024 at 17:46
1 vote
2 answers
68 views
How to Sort an array on descending order with minizinc
In minizinc there is an inbuild sort function to sort a 1d array which sorts the elements by their ascending order. How do I do the opposite? I could not find a function directly associated with it. ...
- 1,625
asked Oct 5, 2024 at 10:04
Efficiency of MiniZinc + CP-SAT (from OR-Tools) compared to CP-SAT alone
I'd be interested to use MiniZinc for its in-browser experience & its support of many solvers, but at the same time I find CP-SAT (from OR-Tools) really efficient and I'd like to be sure that by ...
- 2,362
asked Sep 16, 2024 at 14:48
0 votes
2 answers
73 views
Suggestion on which constraint to adds to optimize Minizinc's model
I've recently started using Minizinc to solve this simple problem: Problem definition: I have grid of dimensions H and W of boolean variables. The only constraint is that if a variable is false then ...
- 21
asked Sep 15, 2024 at 17:25
1 vote
0 answers
75 views
Custom conditional stop in Minizinc (Python)
I am trying to implement a way to stop a minizinc solver after a certain amount of time has passed since the last solution (I'm working with an optimization problem). I've tried doing so using the ...
- 11
asked Aug 27, 2024 at 14:32
-1 votes
1 answer
164 views
Minzinc does not return optimal solution
Main question Context: I specified an ILP encoding like the following: constraint >= c; ...
- 123
asked Jul 19, 2024 at 8:35
Use MiniSearch with Lastest Minizinc
Just try to use MiniSearch with Minizinc 2.8.3 Maybe std in MiniSearch is out of date , when using MiniSearch with --stdlib-dir , error coming with "MiniZinc: internal error: Error occurred when ...
- 43
asked Jul 18, 2024 at 3:56
MiniZinc: Getting two outputs for an optimal path in a simple TSP model
I am a student starting with the basics of optimization. Basically when I run my TSP model in MiniZinc (IDE 2.8.5, Gecode 6.3.0), I got two "optimal" paths, but it should be only one, right? ...
- 23
asked Jun 24, 2024 at 12:55
How to use arg_sort on array[int] of var int in MiniZinc?
I am using MiniZinc and want to find the order (low to high) of numbers in an array of var ints. When using an array of int I have no issue. When using an array of var int, MiniZinc gives me the error:...
- 182
asked May 2, 2024 at 15:46
0 votes
1 answer
72 views
miniznc how to force at least n number of occurrences of an element in an array
The problem statement is that I need to ensure there are at least 2 subsequent occurrences of some element in an array For understanding let's assume we pick the number 1 therefore, this implies if ...
- 61
asked Apr 21, 2024 at 0:44
0 votes
1 answer
107 views
Search the minimum number of swaps to order an array in minizinc
I'm following a course in constraint programming and the professor assigned me this job: Let us consider a n element vector of numbers v = [v_1, ... , v_n], where v_i ∈ N. For i, j ∈ {1, ... , n} a ...
- 1
asked Apr 18, 2024 at 18:48
0 votes
0 answers
73 views
How do I handle or prevent nonfixed variables in MiniZinc
I have a MiniZinc model of placing character sequences, or "words", on a crossword-like grid. This is really a packing problem where the positions and orientations of the "words" ...
- 57
asked Feb 4, 2024 at 17:41
3 votes
0 answers
229 views
Adding at most k and at least k constraints to a word puzzle
I'm toying around with Minizinc trying to learn to be more proficient with it. I'm trying to place letters into the 3x3 grid with the middle cell unassignable, so that the words intersect like in a ...
- 45
asked Jan 20, 2024 at 18:41
2 votes
2 answers
107 views
Running MiniZInc with 2 Dzn file at the same time
Currently, I'm doing some project for college scheduling using MiniZinc. I use 2 dzn files which are A.dzn and B.dzn, these dzn file are filled with college data such as student_groups, subject, num ...
- 21
asked Dec 27, 2023 at 8:28
0 votes
0 answers
44 views
minizinc - create unit tests
I want to create unit test of minizinc (for specific data inputs, I want to get specific results I know are ok). Let's assume I have a model in unit_tests_program.mzn: %data int: total_multip; %...
- 3,781
asked Dec 19, 2023 at 15:24
Constraint solver that can handle floating point exponentiation
Are there any constraint solvers that can understand exponentiation of potentially unbounded floats aka. real numbers? Given this simple program, var float: x; constraint x^x = 27; solve satisfy; I ...
- 20.2k
asked Dec 18, 2023 at 6:01
Unrecognized option or bad format `--writeModel' with command line
Just want to write .mzn to .mps , with following the command-line: minizinc --writeModel test.mps test.mzn but the error comming : minizinc: Unrecognized option or bad format `--writeModel' minizinc: ...
- 43
asked Nov 25, 2023 at 14:27
How to define solver parameters in minizinc for CP-SAT from Google or-tools
Using the CP-SAT solver from Google OR-Tools for backend CP-Solver , and want to define the solver parameters in minizinc. Define the solver config as following : { "backend-flags": { ...
- 43
asked Nov 15, 2023 at 15:29
-1 votes
2 answers
74 views
Minizinc syntax errors? requesting help/advice
I have the following model, which is giving syntax errors. Any help greatly appreciated. int: N = 8; % Number of participants int: M = 2; % Team size int: S = 4; % Number of sessions int: A = 4; % ...
- 71
asked Nov 2, 2023 at 1:25
0 votes
1 answer
38 views
Using minizinc on wampserver
I'm trying to display a schedule on my local web page using minizinc as soon as I press a submit button. To do this, I run minizinc from the command line using: if (isset($_POST["submit"])) {...
- 1
asked Oct 30, 2023 at 13:05
Minizinc: inconsistent constraint reformulation
I'm developing a Minizinc model and I ran into this issue: given this model enum req_type = {roads, rivers}; enum cities = {city1, city2, city3} array[cities, cities] of var bool: are_connected; % ...
- 11
asked Oct 11, 2023 at 17:04
PyQt cannot execute a minizinc process
I am trying to run minizinc from a pyqt application. Instead of producing a result it will just return ====ERROR=== What is happening here I have tried to use pythons minizinc package as well as ...
- 121
asked Oct 11, 2023 at 12:51
how to input null set inside a array with json to minizinc
Thanks a lot . I am trying on input data with json to minizinc . In the mzn file , defined the array : array[1..14] of set of 1..100 : stationCalendarOffPeriod ; and input data in json , but error ...
- 43
asked Sep 1, 2023 at 12:58
MiniZinc: simplify a parameter array almost full of zero
I'm working on a model about timetables, and i have a question about a constraint. Here is the model (i deleted all the not necessary part for the question). include "globals.mzn"; enum ...
- 15
asked Aug 26, 2023 at 10:31
Computing wasted hours in MiniZinc (how many 0 in an array of var 0..1 between first and last 1)
I'm working on a model about timetables and i have to minimize the total wasted hours. For every day from Monday to Saturday i have an array of var, for example [0, 1, 0, 0, 1, 1], meaning than a ...
- 15
asked Aug 17, 2023 at 13:28
MiniZinc: type error: invalid type for comprehension: `array[int] of var opt string'
I use MiniZinc 2.7.6 and Gecode 6.3.0 when I run the below block of code: int: user_property_1 = 1; % user_property_1-parameter int: user_property_2 = 2; % user_property_2-parameter int: ...
- 319
asked Aug 17, 2023 at 7:42
0 votes
1 answer
89 views
MiniZinc: type error: no function or predicate with this signature found: `all_equal(array[int] of var opt int)'
I'm not understanding this error, this code works: include "all_different.mzn"; include "all_equal.mzn"; int: DIMENSION = 3; int: MAX_DIGIT = DIMENSION * DIMENSION; set of int: ...
- 1,740
asked Aug 2, 2023 at 15:08
0 votes
0 answers
170 views
Minizinc Gecode parse_error(stderr)
I'm trying to rum my minizinc model through python but it seem to be a problem with the solver Gecode. I've tryed using a simpler model but the result is the same. If i use another solver like chuffed ...
- 1
asked Jul 5, 2023 at 22:07
Cumulative constraint not working with variable size arrays of variables in Minizinc?
I have a Constraint Programming model in Minizinc 2.7.5 (with Gecode 6.3.0) and I want to use the Cumulative constraint on a subset of variables. It seems like the constraint does not work when the ...
- 290
asked Jun 21, 2023 at 14:24
Minizinc if-else statement with multiple expressions
The syntaxis of if-else statement in minizinc is if 〈boolexp〉 then 〈exp1〉 else 〈exp2〉 endif But i need to use more than just one exp for example var int: a; var int: b; if 5==abs(5) then a = 5, b >...
- 11
asked Jun 11, 2023 at 22:05
1 vote
0 answers
81 views
MiniZinc confused by derived enums
I am trying to extend the SEND+MORE=MONEY model from section 2.2.2 of the MiniZinc tutorial to solve cryptarithms of variable length (both in terms of how many things are being summed and in the words ...
- 163
asked Jun 6, 2023 at 1:38
how to generate relationship between two enumerate with double cycle
Thanks a lot in advance . trouble in how to generate relationship between two enumerate . %------------------------------- enum weeks = {w1,w2,w3,w4}; array[weeks] of 1..10 : weekShiftQty = [4,5,7,4];...
- 43
asked Jun 2, 2023 at 16:15
How can I fold an array in MiniZinc?
The way that value of summands of cryptarithms are defined in MiniZinc tutorial look like follows: constraint 1000 * S + 100 * E + 10 * N + D + 1000 * M + 100 * O + 10 * R ...
- 108
asked May 24, 2023 at 13:04
MiniZinc -- can someone please fix my code?
I try to create a work management system. Overall, I try to develop a daily movement strategy, during which the car would end up in the last place at the beginning of the day and collect the people in ...
- 3
asked May 22, 2023 at 15:08
0 votes
0 answers
51 views
Why do I get an 'unsatisfiable' error when solving a 9x9 Sudoku puzzle?
I am new to minizinc problem-solving. I tried the 9x9 sudoku puzzle problem but can someone kindly explain to me why I get the "unsatisfiable" error here in the below code. in the beginning, ...
- 1
asked May 18, 2023 at 18:14
MiniZinc Constraint Programming: optimize parallel task scheduling model
I started learning constraint programming in MiniZinc, and would like to write a model which schedules t tasks on m machines for parallel execution (nothing difficult, a task needs to be executed only ...
- 3
asked Apr 15, 2023 at 19:38
how to coercion from type string to enum
Thanks for help . I have define a enum ,and then define record with this enum . pls refer to the code . enum tasks ; int : recordNumberOfTaskData ; type taskDataType = record(int: id, tasks:task , ...
- 43
asked Mar 21, 2023 at 8:49
Minimizing the sum of an array as exponent to the base 2
I have a problem that roughly does the following set of int: SIZE = 1..3; array[SIZE] of int: bound; array[SIZE] of var int: cost; constraint forall(i in SIZE) (cost[i] > bound[i]); solve ...
- 3
asked Mar 13, 2023 at 22:06
2 votes
0 answers
65 views
How to create grid-connectivity constraint in Minizinc
I have a grid NxN where each cell can be "water" or "land", and I want to count for each land cell the number of connected land cell. Eventually, it may be okay just to check if 2 ...
- 31
asked Mar 4, 2023 at 13:38
0 votes
0 answers
80 views
Using Constraint Programming to model preemptive task with energy allocation over periods
I have a linear model that works fine but has a huge amount of time of resolution that I want to reduce. One approach is that I convert it to constraint programming. Supposing that I have a specific ...
- 90
asked Mar 4, 2023 at 5:42
0 votes
1 answer
295 views
MiniZinc: slicing an array using changing indices in a for all
I want to do the following in Minizinc: set a constraint on a slice of an array, taking 7 indices and moving one further each time. I tried doing it this way: constraint forall(i in 0..length(schedule)...
- 1
asked Mar 3, 2023 at 9:59
0 votes
1 answer
39 views
How to fix part of a variable of type array of set var in a data file for a Minizinc model?
I have a Minizinc model and I have a data file. I would like to feed part of a solution to my model, but it keeps giving my an error. Here is a simplified version of my model. enum pieces; enum beams; ...
- 290
asked Feb 14, 2023 at 14:02
1 vote
1 answer
165 views
MiniZinc: build a connectivity matrix
In MiniZinc, I have an array of boolean representing an oriented connection between nodes of a graph: array[Variants,Variants] of bool : VariantIsDirectlyUpwardOf; VariantIsDirectlyUpwardOf[v1,v2] = ...
- 11
asked Jan 26, 2023 at 16:47
0 votes
1 answer
85 views
How to create a deterministic finite automata for the "regular" function where states lead to more than one state depending on the value of an int
the manual of Minizinc says that we can pass an array to the "regular" function that represent the transitions between states of a DFA. For this state machine: It puts this example: array[...
- 29
asked Jan 18, 2023 at 2:30