minizinc

In MiniZinc how can I resolve this error?

北战南征 提交于 2019-12-10 20:55:51
问题 In MiniZinc how can I get this code to compile without the error "no function or predicate with this signature found: `round(var float)'"? var int: D = 1; var int: F; constraint F = round (D / 2); 回答1: The message simply mean that MiniZinc don't have any support for round() with decision variables i.e. "round(var float)". It only support "round(float)" i.e. fixed float values. It's the same with ceil() and floor(), there is only support fixed float values. MiniZinc 2.0 automatically converts

Optimizing working scheduling MiniZinc code - constraint programming

◇◆丶佛笑我妖孽 提交于 2019-12-08 02:53:46
问题 Please can you help optimize this working MiniZinc code: Task: There is a conference which has 6x time slots. There are 3 speakers attending the conference who are each available at certain slots. Each speaker will present for a predetermined number of slots. Objective: Produce the schedule that has the earliest finish of speakers. Example: Speakers A, B & C. Talk durations = [1, 2, 1] Speaker availability: +---+------+------+------+ | | Sp.A | Sp.B | Sp.C | +---+------+------+------+ | 1 | |

Easy way to print full solution (all decision variables) in minizinc

不想你离开。 提交于 2019-12-06 05:22:15
问题 The zinc spec says this: If no output item is present, the implementation should print all the global variables and their values in a readable format. However this does not appear to work with minizinc version 1.6.0: G12 MiniZinc evaluation driver, version 1.6.0 I've tried the default command (minizinc) and mzn-gecode. I'd really like to avoid repeating all the variable names in the output expression. What I really want is to have all decision variables output in some structured format (e.g.

Index of string value in MiniZinc array

落花浮王杯 提交于 2019-12-06 02:56:08
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 declared as follows: int: numItems; set of int: Items = 1..numItems; array[Items, Stats] of float:

Projection of solutions

偶尔善良 提交于 2019-12-06 01:59:44
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. I tried the following model in MiniZinc 2.0 ( https://www.minizinc.org/2.0/index.html ) and this seems to work as you expect, i.e. that just x1 and x2 are projected (printed) in the result. int: n = 3; var

Easy way to print full solution (all decision variables) in minizinc

强颜欢笑 提交于 2019-12-04 10:47:57
The zinc spec says this: If no output item is present, the implementation should print all the global variables and their values in a readable format. However this does not appear to work with minizinc version 1.6.0: G12 MiniZinc evaluation driver, version 1.6.0 I've tried the default command (minizinc) and mzn-gecode. I'd really like to avoid repeating all the variable names in the output expression. What I really want is to have all decision variables output in some structured format (e.g. YAML), but I'd settle for some way to avoid this repetition. To clarify: my model doesn't match the

Convert Boolean FlatZinc to CNF DIMACS

假如想象 提交于 2019-12-03 14:24:27
To solve a set of Boolean equations , I am experimenting with the Constraint-Programming Solver MiniZinc using the following input: % Solve system of Brent's equations modulo 2 % Matrix dimensions int: aRows = 3; int: aCols = 3; int: bCols = 3; int: noOfProducts = 23; % Dependent parameters int: bRows = aCols; int: cRows = aRows; int: cCols = bCols; set of int: products = 1..noOfProducts; % Corefficients are stored in arrays array[1..aRows, 1..aCols, products] of var bool: A; array[1..bRows, 1..bCols, products] of var bool: B; array[1..cRows, 1..cCols, products] of var bool: C; constraint