Questions tagged [gecode]

Gecode is a toolkit for developing constraint-based systems and applications. Gecode provides a constraint solver with state-of-the-art performance while being modular and extensible.

Gecode is a toolkit for developing constraint-based systems and applications. Gecode provides a constraint solver with state-of-the-art performance while being modular and extensible.

Gecode is a portable toolkit. It is implemented in C++ that carefully follows the C++ standard. It can be compiled with modern C++ compilers and runs on a wide range of machines (including 64bit machines).

Gecode is distributed under the MIT license.

See more:

54 questions
6
votes
1 answer

Cardinality constraints in MiniZinc

The MiniZinc constraint solver allows to express cardinality constraints very easily using the built-in sum() function: % This predicate is true, iff 2 of the array % elements are true predicate exactly_two_sum(array[int] of var bool: x) = …
Axel Kemper
  • 10,544
  • 2
  • 31
  • 54
6
votes
1 answer

Map upper triangular matrix on vector skipping the diagonal

I have a problem that could be boiled down to finding a way of mapping a triangular matrix to a vector skipping the diagonal. Basically I need to translate this C++ code using the Gecode libraries // implied constraints for (int k=0, i=0; i
Agostino
  • 2,723
  • 9
  • 48
  • 65
4
votes
1 answer

how to implement a 'nested' cost function in Gecode?

I am new to gecode and constraint programming in general. So far, I haven't had much trouble picking up gecode, it's great. But I was wondering what is the best way to perform a "nested" cost function. Specifically, I am looking to minimize X, but…
jda
  • 265
  • 2
  • 6
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
3
votes
2 answers

debugging minizinc (anyway, did I found a bug?)

I'm familiarizing with the basic of MiniZinc. So, armed with the MiniZinc IDE, I write snippets like solve satisfy; string: s1 = "hello"; string: s2 = "world"; function list of int: cdr(list of int: v) = [v[i] | i in 1..length(v)]; function list…
CapelliC
  • 59,646
  • 5
  • 47
  • 90
2
votes
1 answer

How to print values of variables in gecode

I am trying to solve linear equation 15 * x + y + 0.4*z == 100 using gecode. I want to print the values of x,y,z. But, when i run following code, class LinearEq1 : public Space { protected: IntVar x; IntVar y; IntVar z; public: …
2
votes
2 answers

How to maximize a var int that is larger than 32 bits?

I am using minizinc with built-in Gecode 6.1.1 and I want to maximize an objective function with values that are far greater than the max int 32. The maximum value of an integer with 32 bits is 2147483646. While not much information seems to be…
Spyros K
  • 2,480
  • 1
  • 20
  • 37
2
votes
1 answer

Gecode, error while compiling program with gecode.int.hh

I installed Gecode 6.0 for VS 2017. Added directories to /lib and /include. Then included gecode/int.hh to the Hello World program. During compilation got 3 strange errors: Error C2084 function "void Gecode::cmb_hash(size_t &,::size_t)" already…
Jakub Pawlak
  • 49
  • 1
  • 6
2
votes
1 answer

Alternate branching strategies in Gecode

I post here to ask if there is a way to alternate different strategies of branching. Let me explain, I have an efficient branching strategy which we'll call the strategy A. The biggest problem is that the strategy A cannot be used that often. So…
Missu
  • 505
  • 3
  • 15
2
votes
1 answer

How do I use a Merit function in Gecode?

I am trying to use a merit function for my branching in Gecode. In the MPG, the Gecode Manual, an example merit function is stated, and how to pass it to the branching. But I cannot figure out where to put the function. Should it be inside the…
Atonic
  • 509
  • 1
  • 5
  • 14
2
votes
1 answer

In Gecode, accessing home/space variables values from merit function

In Gecode, I am using a merit function to select variables when branching. In order to compute variable v's merit, I need to access some other variables values, but it looks like at the time the merit function is called, the space variables have not…
Silverspur
  • 891
  • 1
  • 12
  • 33
2
votes
1 answer

Minizinc, Gecode, how to get an identical solutions across distributed servers, with multi-solution model?

I am using minizinc and gecode to solve a minimization problem in a distributed fashion. I have multiple distributed servers that solve the same model with identical input and I want all the servers to get the same solution. The problem is that…
kirbo
  • 1,707
  • 5
  • 26
  • 32
2
votes
2 answers

Minizinc: Trivial equality unsatisfiable

I have the following minizinc model: include "globals.mzn"; var 0..9: A_1_1; var 0..9: A_2_1; var 0..9: A_3_1; constraint (A_3_1+A_2_1+A_1_1) = A_1_1; solve satisfy; The model should have the trivial solution 0=A_1_1=A_2_1=A_3_1. However, Gecode…
Martin
  • 35
  • 4
2
votes
2 answers

MiniZinc can not find a solution when output statement introduced

I have a simple model written in minizinc and I use gecode to solve it by compiling it into flat-zinc first. As an input, the model takes some constants, arrays, and matrices (in the form of 2-dimensional arrays). The output of the model is another…
kirbo
  • 1,707
  • 5
  • 26
  • 32
2
votes
0 answers

R interface to Gecode (open source constraint programming toolkit)

I'd like to use the open-source Gecode (gecode.org) framework for constraint programming within R. So far I did not found any direct route. I found lots of bindings and interfaces to Ruby, Python, Prolog but not a direct one for R. Any pointer to a…
user2030503
  • 3,064
  • 2
  • 36
  • 53
1
2 3 4