GithubHelp home page GithubHelp logo

gecode / gecode Goto Github PK

View Code? Open in Web Editor NEW
275.0 24.0 76.0 29.05 MB

Generic Constraint Development Environment

Home Page: https://www.gecode.org

License: Other

CMake 0.20% Makefile 0.52% C++ 98.07% Shell 0.09% QMake 0.02% Perl 0.55% HTML 0.02% CSS 0.07% M4 0.47%
constraint-satisfaction-problem constraint-programming constraint-propagation constraint-solver constrained-optimization constraint-satisfaction

gecode's Introduction

Gecode - Generic Constraint Development Environment

Gecode

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

master: Build Status master

develop: Build Status develop

Getting All the Info You Need...

You can find lots of information on Gecode's webpages, including how to download, compile, install, and use it.

In particular, Gecode comes with extensive tutorial and reference documentation.

Download Gecode

Gecode packages (source, Apple MacOS, Microsoft Windows) can be downloaded from GitHub or Gecode's webpages.

Contributing to Gecode

We happily accept smaller contributions and fixes, please provide them as pull requests against the develop branch. For larger contributions, please get in touch.

Gecode License

Gecode is licensed under the MIT license.

gecode's People

Contributors

alinakelly avatar chschulte avatar dekker1 avatar guidotack avatar lokdlok avatar mewmew avatar sagagnon avatar zayenz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gecode's Issues

Inconsistence between gist search tree and search statistics

Hello,

I am working with the steelmillslab problem present in the minizinc-benchmarks. The nodes displayed by fzn-gecode-gist are more than what printed in the statistics from fzn-gecode for more than 1 solution.

To reproduce the problem is necessary:

  1. Create the FlatZinc:

    • Model: From minizinc-benchmarks.
    • Data: From minizinc-benchmarks
    • Command: minizinc --solver org.minizinc.globalizer -c steelmillslab.mzn bench_13_0.dzn -o steelmillslab13.fzn
  2. Launch GECODE:

    • Regular: fzn-gecode -s -n 2 steelmillslab13.fzn, 1550 nodes, 725 failure, 2 solutions.
    • Gist: fzn-gecode-gist steelmillslab13.fzn, 824+729+2=1555 nodes, 729 failures, 2 solutions.

I am using Gecode 6.2.0 present in the MiniZinc distribution 2.3.2 both in Ubuntu 18.04 LTS and Manjaro.

Building examples with CMake does not respect features

When building the examples using the CMake files, all examples are always built. This can be compared with the Makefile build, where examples are divided up into groups depending on their used features.

As a simple example of when this becomes a problem, if MPFR is not installed, then the sin, cos, and so on constraints for float variables are not available. However, the CMake build will still try to build the examples that require them (archimedean-spiraland golden-spiral) leading to a build error.

compilation error with Visual Studio 2015 and CMakeLists.txt

Hi, I am getting compilation errors using the Visual Studio 2015 compiler and the supplied CMakeLists.txt, e.g.:

1>C:\svn\gecode-release-6.2.0\gecode/kernel/branch/merit.hpp(193): error C2923: 'Gecode::VarBranch': 'Gecode::MeritFunction::Var' is not a valid template type argument for parameter 'Var'
1>C:\svn\gecode-release-6.2.0\gecode/kernel/branch/merit.hpp(193): note: see declaration of 'Gecode::MeritFunction::Var'

As you can see this is with gecode 6.2.0. I am actually using the MSVC 2017 IDE with the 2015 toolchain.

Do you support MSVC 2015?
Regards
John

Wrong handling of exp(0) in MiniModel for floats

Hi there,

here's a small issue:

Describe the bug

In minimodel/float-arith.cpp there is the following:

   case ANLFE_EXP:
     {
       assert(n == 1);
       FloatVar x = a[0].post(home);
       if (x.assigned() && (x.val() == 0.0))
         y = result(home,ret,x);
       else {
         y = result(home,ret);
         exp(home, x, y);
       }
     }
     break;

which in the if-branch says that exp(0) = 0 - but that should be 1.

To Reproduce

Should be possible to trigger.

Gecode and Platform Configuration

As seen in the dev-branch and older releases.

Makefile rule removes source files

The rule make distclean removes source files from the master branch. After calling it, this is (partially) the output of git status:

deleted:    Makefile.dep
deleted:    gecode/flatzinc/parser.tab.hh
deleted:    gecode/kernel/var-imp.hpp
deleted:    gecode/kernel/var-type.hpp

Calling make after make distclean ends up in an error, unless I reset the local repository (e.g. git reset --hard)

floating point rounding control changed by gecode -> search fails

Describe the bug

I noticed that one of my gecode models (using float variables) had a different result when running it twice in succession.
the first time the model finds a result, the second time it doesn't.
a lot of searching showed that after the first gecode search, the rounding control for floating point numbers was changed. (the _controlfp() or _control87() function can change this flag).
I noticed in the gecode sourcecode (some parts are really boost) that in most cases where
the rounding control is changed, it is reset to the original value again. (using the gecode_boost::numeric::interval_lib::save_state wrapper class).
in at least one case, this wrapper isn't used (float.hh):
typedef gecode_boost::numeric::interval_lib::rounded_arith_stdRoundingBase;

when I replaced the above line with this one:
typedef gecode_boost::numeric::interval_lib::save_state< gecode_boost::numeric::interval_lib::rounded_arith_std > RoundingBase;
my problem went away.

I don't know if this change fixes all cases, but it fixed my problem.

To Reproduce

I can't provide a gecode model that shows the problem. the model I have the problem with is very complex and I didn't succeed in making it simple enough to include here.

check the floating point control word before and after running a search on a model containing floating point variables. the result will be different.
unsigned int controlfp = _controlfp (0, 0);

Gecode and Platform Configuration

gecode 6.1.1 (and 5.1.0)
windows server 2016
visual studio 2017

Build failure for Gecode 6.1.0 on mips and mipsel architectures with gcc 8.2

Building Gecode 6.1.0 fails on mips and mipsel arches on Debian. Gecode 6.0.1 built on both successfully.

gcc version had changed between the build attempts of Gecode releases. 6.0.1 got built with gcc 7.3 but 6.1.0 got built with gcc 8.2. I didn't yet try building 6.0.1 with a newer gcc version or 6.1.0 with the older one.

Both architectures saw the failure while running the test suite on the same test.

Search::PBS::SEB::DFS+LDS::Solve::3::1 ++
Search::PBS::SEB::DFS+LDS::Solve::3::2 ++
Search::PBS::SEB::DFS+LDS::Solve::3::3 ++
Search::PBS::SEB::DFS+LDS::Solve::3::4 ++
Search::PBS::SEB::DFS+LDS::Solve::3::5 ++
Search::PBS::SEB::DFS+LDS::Solve::3::6 ++
Search::PBS::SEB::DFS+LDS::Solve::3::7 Operating system error: Mutex::~Mutex[pthread_mutex_destroy]terminate called without an active exception
make[1]: *** [Makefile:1271: check] Aborted

This may well be some bug in gcc and/or some other dependency but I'd love to hear your thoughts before I explore this further.

Clock keeps running when Windows is "resting"

On Windows, when the process gets suspended the clock (when inheriting from Script) keeps counting.

The following is the report from an experiment with 10 runs:

run failures size runtime

1 1527988 123 60022.0
2 1525638 123 60022.0
3 1524347 123 60022.0
4 1525846 123 60022.0
5 1526807 123 60023.0
6 1524908 123 60022.0
7 1507045 123 60023.0
8 1525250 123 60021.0
9 1525695 123 60021.0
10 584070 123 31298851.0

I had this running all night. When I got up the process was suspended on the run 10.
Check out the difference between the runtime of run 10 and the rest.

Build fails on 32 bit architectures (gecode/support/hash.hpp)

size_t is same as unsigned int on 32 bit architectures. I tried renaming the size_t version of cmb_hash and Gecode compiled successfully with it.

$ make
make[1]: Entering directory '/home/kaol/src/gecode-6.0.0'
make[1]: 'gecode/kernel/var-type.hpp' is up to date.
make[1]: 'gecode/kernel/var-imp.hpp' is up to date.
g++ -I. -fcx-limited-range -fno-signaling-nans -fno-rounding-math -ffinite-math-only -fno-math-errno -fno-strict-aliasing  -fvisibility=hidden -ggdb -std=c++11 -pipe -Wall -Wextra -fPIC -pthread -DNDEBUG -g -O2 -fdebug-prefix-map=/home/kaol/src/gecode-6.0.0=. -fstack-protector-strong -Wformat -Werror=format-security -O3 -D_REENTRANT -Wdate-time -D_FORTIFY_SOURCE=2   \
-c -o gecode/support/exception.o  gecode/support/exception.cpp
In file included from ./gecode/support.hh:105:0,
                 from gecode/support/exception.cpp:38:
./gecode/support/hash.hpp: In function 'void Gecode::cmb_hash(std::size_t&, unsigned int)':
./gecode/support/hash.hpp:61:3: error: redefinition of 'void Gecode::cmb_hash(std::size_t&, unsigned int)'
   cmb_hash(std::size_t& seed, unsigned int h) {
   ^~~~~~~~
./gecode/support/hash.hpp:51:3: note: 'void Gecode::cmb_hash(std::size_t&, std::size_t)' previously defined here
   cmb_hash(std::size_t& seed, std::size_t h) {
   ^~~~~~~~
Makefile:1333: recipe for target 'gecode/support/exception.o' failed
make[1]: *** [gecode/support/exception.o] Error 1
make[1]: Leaving directory '/home/kaol/src/gecode-6.0.0'
Makefile:1256: recipe for target 'compilelib' failed
make: *** [compilelib] Error 2

Usage of copy constructor of Gecode::Space causes "Conditional jump or move depends on uninitialised value(s)" in destructor

Describe the bug

After raw usage of Gecode::Space copy constructor valgrind spotted "Conditional jump or move depends on uninitialised value(s)" in ~Gecode::Space which may lead to segfault.

To Reproduce

#include <gecode/kernel.hh>
class MySpace : public Gecode::Space
{
public:
    MySpace() = default;
    MySpace(MySpace& other) :
        Gecode::Space(other)
    {
    }

    Gecode::Space* copy() override
    {
        return new MySpace(*this);
    }
};

int main()
{
    MySpace s1;
    MySpace s2(s1);
}

Compiled with:

gcc main.cpp -o out -lgecodesupport -lgecodekernel --std=c++11 -lstdc++ -g -O0

Valgrind ran with command:

valgrind  ./out

Valgrind output:

==32653== Memcheck, a memory error detector
==32653== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==32653== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==32653== Command: ./out
==32653== 
==32653== Conditional jump or move depends on uninitialised value(s)
==32653==    at 0x489C823: Gecode::Space::~Space() (in /usr/lib/libgecodekernel.so.49.0)
==32653==    by 0x10AA39: MySpace::~MySpace() (main.cpp:3)
==32653==    by 0x10A29A: main (main.cpp:22)
==32653== 
==32653== 
==32653== HEAP SUMMARY:
==32653==     in use at exit: 0 bytes in 0 blocks
==32653==   total heap usage: 6 allocs, 6 frees, 209,016 bytes allocated
==32653== 
==32653== All heap blocks were freed -- no leaks are possible
==32653== 
==32653== Use --track-origins=yes to see where uninitialised values come from
==32653== For lists of detected and suppressed errors, rerun with: -s
==32653== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

Gecode and Platform Configuration

Gecode 6.2.0
gcc 10.2.0
Valgrind 3.16.1
Linux Manjaro 20.1 kernel 5.7.17-2

warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>

clang8 prints many warnings like this on FreeBSD 12:

In file included from ./gecode/flatzinc/lexer.lxx:54:
In file included from /usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/flatzinc/parser.hh:65:
In file included from /usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/flatzinc/symboltable.hh:42:
/usr/include/c++/v1/ext/hash_map:213:5: warning: Use of the header <ext/hash_map> is deprecated.  Migrate to <unordered_map> [-W#warnings]
#   warning Use of the header <ext/hash_map> is deprecated.  Migrate to <unordered_map>
    ^
1 warning generated.

Investigate if rewriting to `cumulatives` is good for zero-length tasks when posting MiniZinc constraints `gecode_cumulatives`

In the registry function for gecode_cumulatives the case where the tasks may have zero-length duration and the bound is not assigned is currently decomposed into basic constraints.

An alternative re-write strategy would be to rewrite to cumulatives using multiple machines, where zero-length tasks are on a different machine with an "unlimited" bound.

If #81 has been implemented, this should be tested in the new MiniZinc rewriting, otherwise in the current C++ code.

MiniZinc binding hides standard definitions of reified global constraints

The current MiniZinc binding of Gecode hides the definitions of reified global constraints as provided by the MiniZinc standard library. For example, cumulative_reif is not available because Gecode defines the predicate cumulative in cumulative.mzn instead of fzn_cumulative in fzn_cumulative.mzn.

tests fail (test/test executable)

Describe the bug

===>  Testing for gecode-6.3.0
AFC +++++
Array::Iterator::SharedArray +++++
Array::Iterator::VarArgs +++++
Array::Iterator::VarArray +++++
Array::Iterator::ViewArray +++++
Bool::Assign::3 +++++
Bool::Assign::5 +++++
Bool::Assign::7 +++++
Bool::Branch::3 +++++
Bool::Branch::5 +++++
Bool::Branch::7 +++++
FlatZinc::2DPacking +++++
FlatZinc::SharedArrayElement -
Options: -seed 812278110 -test FlatZinc::SharedArrayElement
*** Error code 1

6.3.0 is from the corresponding branch
OS: FreeBSD 12.2
clang-10

Failure on a FZN example

Describe the bug

Reports UNSAT while OR-Tools says SAT

To Reproduce

fzn-gecode ../challenge_from_2012/mznc12-problems/tpp/tpp.fzn

tpp.fzn.tar.gz

Gecode and Platform Configuration

Please describe which version of Gecode you use, on which operating system, and with which C++ compiler (including its version).

Using current Gecode develop, Ubuntu 19.10, GCC 8.3.0

PropagatorGroup::size(..) returns a wrong value - OR??

When I run the following program:

/*
g++ -o bug1 =1/bug1.cpp -L/usr/local/lib -lgecodekernel -lgecodesupport -lgecodeint -lgecodesearch
setenv LD_LIBRARY_PATH /usr/local/lib
./bug1

*/

#include <gecode/int.hh>
#include <gecode/search.hh>

using namespace Gecode;

class Sp0 : public Space {
public:
IntVar iv0;
IntVar iv1;

public:
Sp0() :
iv0(*this, 0, 1),
iv1(*this, 0, 1)
{}
Sp0(Sp0 &s) :
Space(s),
iv0(*this, 0, 1),
iv1(*this, 0, 1)
{}

virtual Space* copy(void) {
return new Sp0(*this);
}

IntVar getIV0() { return (iv0); }
IntVar getIV1() { return (iv1); }
};

//
int main(int argc, char* argv[])
{
PropagatorGroup pg;

Sp0* sp = new Sp0();
Home spg = (*sp)(pg);
rel(spg, sp->getIV0(), IRT_EQ, sp->getIV1());
(void) sp->status();
std::cout << "pg.size(*sp) = " << pg.size(*sp) << std::endl;

Sp0* sp1 = dynamic_cast<Sp0 *>(sp->clone());
(void) sp1->status();
std::cout << "pg.size(*sp1) = " << pg.size(*sp1) << std::endl;

rel(*sp1, sp->getIV0(), IRT_EQ, 1);
(void) sp1->status();
std::cout << "sp1->iv1 = " << sp1->getIV1() << std::endl;
std::cout << "pg.size(*sp1) = " << pg.size(*sp1) << std::endl;

rel(*sp, sp->getIV0(), IRT_EQ, 1);
(void) sp->status();
std::cout << "sp->iv1 = " << sp->getIV1() << std::endl;
std::cout << "pg.size(*sp) = " << pg.size(*sp) << std::endl;

return (0);
}

the output is (gecode 6.1.1, (up-to-date) gentoo on an x86_64):

pg.size(*sp) = 1
pg.size(*sp1) = 1
sp1->iv1 = [0..1]
pg.size(*sp1) = 1
sp->iv1 = 1
pg.size(*sp) = 0

Note that the space cloning is no cloning here - purposefully for the sake of a lean example. Instead, new variables are created, and so should the propagator in '*sp' be missing in '*sp1' - which it does, according to the observed behaviour, yet it somehow remains counted.

Did I miss anything?

Cheers,
--- Kostja.

gist/standalone-example fails to build: error: no matching function for call to 'branch'

Describe the bug

clang-10 fails to compile it:

mygist.cpp:47:5: error: no matching function for call to 'branch'
    branch(*this, x, INT_VAR_NONE, INT_VAL_MIN);
    ^~~~~~
../../../gecode/int.hh:5071:3: note: candidate function not viable: no known conversion from 'Gecode::IntVarBranch ()' to 'Gecode::IntVarBranch' for 3rd argument
  branch(Home home, const IntVarArgs& x,
  ^
../../../gecode/int.hh:5081:3: note: candidate function not viable: no known conversion from 'Gecode::IntVarBranch ()' to 'TieBreak<Gecode::IntVarBranch>' for 3rd argument
  branch(Home home, const IntVarArgs& x,
  ^

gecode-6.2.0
clang-10
FreeBSD 12.2

Add Search Options to Script::run

I am trying to add Stop object to limit the running time of the GraphColor model. I read other examples and even documentation and I don't know to both use SizeOption and Search Option on this problem. I am a newbie, Could you help me do this?

https://github.com/Gecode/gecode/blob/master/examples/graph-color.cpp

opt.parse(argc,argv);
Search::Stop* stop = Search::Stop::time(10000);
Search::Options search_opt;
search_opt.stop = stop;
Script::run<GraphColor,BAB,SizeOptions>(opt);

Try moving the decomposition of the MiniZinc `gecode_cumulatives` constraint into MiniZinc

The gecode_cumulatives MiniZinc constraint is used for implementing fzn_cumulative. The registry post function does a lot of inspection of the arguments, posting different variants of the constraint.

This requires first fixing #80 so that the relevant Gecode scheduling constraints are available in MiniZinc.

One potential benefit of this, is that the required start[i] + duration[i] = end[i] constraints would be available for common subexpression elimination for MiniZinc.

C2244 Visual Studio error

Hello,

I want to use GeCode for a research purpose and I don't succeed to handle it.

As operating system for GeCode libraries I'm using Microsoft Visual Studio 2017 (15.7.1) under Windows 10 exploitation system.

GeCode libraries linking
Step 1 : I installed it to C:\Program Files\Gecode
Step 2 : Set up the include directories:
Right click on the project –> Properties
Open the Configuration Properties –> C/C++ –> General Tab
Set the option Additional Include Directories to the value “C:\Program Files\Gecode\include”
Step 3 : Set up the library directories:
Right click on the project –> Properties
Open the Configuration Properties –> Linker –> General Tab
Set the option Additional Library Directories to the value “C:\Program Files\Gecode\lib”
Step 4 : Right click on the project –> Properties
Open the Configuration Properties –> C/C++ –> Precompiled Headers Tab
Set the option Create/Use Precompiled Header to the value Not Using Precompiled Headers

When I try to run a pre-defined exemples of programs that are already developped in the GeCode exemple folder (like "money" or "all-intervalle"), we meet each time the same following error C2244:

« 1>c:\program files\gecode\include\gecode\kernel\branch\merit.hpp(193): error C2244: 'Gecode::MeritFunction::MeritFunction' : Can not match function definition with an existing declaration »

Do you know how to fix my problem ? Or do you have advices ?

Autotools installs include/examples

Describe the bug
These files are installed:

include/examples/job-shop-instances.hpp
include/examples/scowl.hpp

with --disable examples.

cmake doesn't install them Nothing should be installed into include/examples.

Issue w/ standard int tracer?

Hi there,

we maybe found an issue with the standard int tracer. The below example terminates with a -1 using gcc 6.2 or 7.2 on Linux. When disabling the call to "trace" the program finishes successfully. In more complicated examples we also got the error "pure virtual method called". Possibly this issue has to do with using inheritance in combination with templates and not using *this for inherited methods - but we're not sure. Or are we overlooking something?

The overall goal is to use our own tracer, we're using the StdIntTracer just for the sake of illustration.

Many thanks for your help!

Best regards,
Conrad

#include <gecode/driver.hh>
#include <gecode/int.hh>
#include <gecode/minimodel.hh>
#include <gecode/search.hh>
#include <gecode/kernel.hh>
#include <gecode/support.hh>
using namespace Gecode;

class GecodeTest : public Script {

protected:
IntVarArray intvars;
public:

GecodeTest(const Options& opt) : Script(opt), intvars(*this,6,Int::Limits::min,Int::Limits::max){

    rel(*this,intvars[0] == 1);
    StdIntTracer trc;
    int traceEvtMask= TE_PRUNE | TE_FAIL | TE_FIX;
    trace(*this,intvars,traceEvtMask,trc);

}

GecodeTest(bool share, GecodeTest& s) : Script(share, s)
{
    intvars.update(*this, share, s.intvars);
}

virtual Space* copy(bool share) {
	return new GecodeTest(share,*this);
}

void print(std::ostream& os) const {
    os << "intvars: " << intvars << std::endl;
}

};

// main function
int main(int argc, char* argv[]) {
Options opt("GecodeTest");
GecodeTest* m = new GecodeTest(opt);
m->status();
m->print(std::cout);
}

no viable overloaded '=' in weights.hpp:127:14

Hi folks,

I'm working on a port of Gecode to Wasm using Mscripten. Mscripten generates a static library.
While building the library, I get the following error :
`set/int/weights.hpp:127:14: error: no viable overloaded '='

elements = elements0; weights = weights0;

kernel/data/shared-array.hpp:53:9: note: candidate function (the implicit copy assignment operator) not viable: 'this' argument has type 'const SharedArray', but method is not marked const
directly followed by :set/int/weights.hpp:127:35: error: no viable overloaded '='

elements = elements0; weights = weights0;

kernel/data/shared-array.hpp:53:9: note: candidate function (the implicit copy assignment operator) not viable: 'this' argument has type 'const SharedArray', but method is not marked const
`
And thus the build stops

To Reproduce

I followed this How to for Emscripen (built from the github repo) :
https://willowtreeapps.com/ideas/how-to-use-native-libraries-on-node-js-with-emscripten

Gecode and Platform Configuration
Gecode 6.2.0
Linux Mint 19.2
Kernel : 4.15.0-96-generic
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.39.13
clang version 11.0.0 (/b/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-llvm-llvm--project 9a39d5a2ecf7c9290d334f2697c3a4e533aa4bea)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/moi/ST/emsdk/upstream/bin
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected multilib: .;@m64

** Solution (Good or not) I have found **
The problem is located in the init method that tries to override a const SharedArray. Removing the const in the definition of both elements and weights allows the build to go on. I'm not good enough in C++ to know if this solution is good or not.

can't use gecode after installing it on macOS

Hi, I have installed gecode following the MPG 2.6 but still can't use it.

  • gcc -c queens.cpp queens.cpp:42:10: fatal error: 'gecode/driver.hh' file not found #include <gecode/driver.hh>

  • g++ -stdlib=libstdc++ -framework gecode -o queen queens.cpp clang: warning: libstdc++ is deprecated; move to libc++ [-Wdeprecated] warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found] queens.cpp:42:10: fatal error: 'gecode/driver.hh' file not found #include <gecode/driver.hh> ^~~~~~~~~~~~~~~~~~ 1 warning and 1 error generated.

  • Using Makefile:

SRCS = $(EXECUTABLES:%=%.cpp)
OBJS = $(EXECUTABLES:%=%.o)

CXX = g++
CXX_FLAGS = -std=c++11 -Wall -O3
LIBS = -framework gecode
RM = rm -f

all: $(EXECUTABLES)

$(EXECUTABLES): %: %.o
	$(CXX) $(CXX_FLAGS) -o $@ $^ $(LIBS)

%.o: %.cpp
	$(CXX) $(CXX_FLAGS) -c -o $@ $^

# You can run your experiments from the Makefile like this (requires queens01 to run)
res.tex: queens queens01
	./gather_stats.py --range 8:_:15 --timeout 10 \
	--model queens --model queens01 > res.tex

clean:
	$(RM) $(OBJS) $(EXECUTABLES)

Output:
make queens g++ -std=c++11 -Wall -O3 -c -o queens.o queens.cpp queens.cpp:42:10: fatal error: 'gecode/driver.hh' file not found #include <gecode/driver.hh> ^~~~~~~~~~~~~~~~~~ 1 error generated. make: *** [queens.o] Error 1

Error: Gecode: Float::linear: Number out of limits

Reposting from MiniZinc/libminizinc#246

I have a Minizinc model where my objective function is a combination of floats and it triggers the following error: Error: Gecode: Float::linear: Number out of limits.

Here's a simplified version of the model to reproduce the bug. hostCost in this example could very well be an integer instead, but my actual model requires 'hostCost' to be a float.

int: numVms = 3;
array[1..numVms] of int : vmId = [1, 2, 3];
array[1..numVms] of var int : vmHost;
array[1..numVms] of int : vmRequest = [1, 1, 1];

int: numHosts = 3;
array[1..numHosts] of int : hostId = [1, 2, 3];
array[1..numHosts] of int : hostCapacity = [3, 3, 3];

array[1..numHosts] of var float : hostCost = 
            [hostCapacity[host] - sum([vmRequest[v] | h in 1..numHosts, v in 1..numVms where vmHost[v] == hostId[h]   /\ hostId[h] == hostId[host]]) | host in hostId];
                                              
solve maximize min(hostCost) - max(hostCost);

I don't see why this model should be running into floating point issues?

MiniModel pow for FloatVar does not fail space for base assigned to zero and negative exponent

The following test case will fail:

FloatVar x {home, 0, 0};
int const n {-1};
FloatVar y {home, Float::Limits::min, Float::Limits::max};

rel (home, y == pow (x, n));
home.status();

EXPECT_TRUE (home.failed());

The origin seems to be the special treatment in minimodel/float-arith.cpp which does not take into account the exponent:

if (x.assigned() && ((x.val() == 0.0) || (x.val() == 1.0)))

PropagatorGroup::kill(..) makes subsequent Space::status() to crash

Dear Gecode developers,

it looks like If one "PropagatorGroup::kill(..)"s the only propagator in a space, the subsequent Space::status() segfault"s. In particular, The following program:

/*
g++ -o bug0 =1/bug0.cpp -L/usr/local/lib -lgecodekernel -lgecodesupport -lgecodeint -lgecodesearch
setenv LD_LIBRARY_PATH /usr/local/lib
./bug0

*/

#include <gecode/int.hh>
#include <gecode/search.hh>

using namespace Gecode;

const int iv0ds = 10;

class Sp0 : public Space {
public:
const char *name;
IntVar iv0;

public:
Sp0(const char *n) : name(n), iv0(*this, 0, iv0ds) {}
Sp0(const char *n, IntSet is) : name(n), iv0(*this, is) {}
Sp0(Sp0 &s) : Space(s), name(s.name) {
iv0.update(*this, s.iv0);
}

virtual Space* copy(void) {
return new Sp0(*this);
}

IntVar getIV0() { return (iv0); }

void print() {
std::cout << name << "=";
for (IntVarRanges ri(iv0); ri(); ++ri) {
std::cout << ri.min() << ".." << ri.max() << " ";
}
std::cout << std::endl;
}

void status() {
switch (Space::status()) {
case SS_FAILED:
std::cout << "space " << name << " failed." << std::endl;
break;
case SS_SOLVED:
std::cout << "space " << name << " is solved." << std::endl;
break;
case SS_BRANCH:
std::cout << "space " << name << " must be branched." << std::endl;
break;
}
}
};

//
int main(int argc, char* argv[])
{
IntVar iv0l;

{
std::cout << std::endl << "sp = new Sp0("sp", IntSet(0, 20))"
<< std::endl;
Sp0* sp = new Sp0("sp", IntSet(0, 20));
PropagatorGroup pg;
sp->print();
std::cout << "pg.size(*sp) = " << pg.size(*sp) << std::endl;
iv0l = sp->getIV0();
BoolVar cv(*sp, 0, 1);
std::cout << "dom((*sp)(pg), iv0l, IntSet(0, 10), cv)"
<< std::endl;
dom((*sp)(pg), iv0l, IntSet(0, 10), cv);
std::cout << "pg.size(*sp) = " << pg.size(*sp) << std::endl;
std::cout << "pg.kill(*sp)" << std::endl;
pg.kill(*sp);
std::cout << "pg.size(*sp) = " << pg.size(*sp) << std::endl;
sp->print();
std::cout << cv << std::endl;

/*
BoolVar cv2(*sp, 0, 1);
std::cout << "dom((*sp)(pg), iv0l, IntSet(0, 10), cv2)"
<< std::endl;
dom((*sp)(pg), iv0l, IntSet(0, 10), cv2);
*/

std::cout << "dom(*sp, iv0l, IntSet(15, 20))"
          << std::endl;
dom(*sp, iv0l, IntSet(15, 20));
std::cout << "pg.size(*sp) = " << pg.size(*sp) << std::endl;
(void) sp->status();
std::cout << "ok??" << std::endl;
std::cout << "pg.size(*sp) = " << pg.size(*sp) << std::endl;
sp->print();
std::cout << cv << std::endl;

}

return (0);
}

crashes for me with Gecode 6.1.1 (and I do not see a relevant bug fix in the 6.2.0 changelog) as follows:

kost (286) ./bug0
sp = new Sp0("sp", IntSet(0, 20))
sp=0..20
pg.size(*sp) = 0
dom((*sp)(pg), iv0l, IntSet(0, 10), cv)
pg.size(*sp) = 1
pg.kill(*sp)
pg.size(*sp) = 0
sp=0..20
[0..1]
dom(*sp, iv0l, IntSet(15, 20))
pg.size(*sp) = 0
Segmentation fault (core dumped)

.. however, if one enables the commented out code near the end of the program - with another 'dom()' progagator post, the program runs fine:

kost (284) ./bug0
sp = new Sp0("sp", IntSet(0, 20))
sp=0..20
pg.size(*sp) = 0
dom((*sp)(pg), iv0l, IntSet(0, 10), cv)
pg.size(*sp) = 1
pg.kill(*sp)
pg.size(*sp) = 0
sp=0..20
[0..1]
dom((*sp)(pg), iv0l, IntSet(0, 10), cv2)
dom(*sp, iv0l, IntSet(15, 20))
pg.size(*sp) = 1
space sp is solved.
ok??
pg.size(*sp) = 0
sp=15..20
[0..1]

Did I miss something??

Cheers,

--- Kostja.

Build fails with Bison 3.7

Debian updated to Bison 3.7 and building Gecode 6.2.0 fails with it. The gecode/flatzinc/parser.tab.cpp file it generates has an #include "parser.tab.hpp" directive in it and since make renames parser.tab.hpp as parser.tab.hh, that fails.

I fixed it for Debian by adding this to the gecode/flatzinc/parser.tab.cpp target in Makefile.in:

sed -i 's/^#include "parser.tab.hpp"/#include "parser.tab.hh"/' gecode/flatzinc/parser.tab.cpp

Maximum/Minimun solution searching

Hello Christian,

I want to find the maximum and minimum value associated to a solution space. The functions .min() and .max() seem not to work with a two variable equation. The program returns the good solutions but the function .min() and .max() return the initial maximum and minimum value of the domain definition without taking care of the equation.
Do you find any error on our code ?

Here our program
We are using GeCode version 6.0.1 2017
#include <gecode/minimodel.hh>
#include <gecode/driver.hh>
#include <gecode/search.hh>
#include <gecode/float.hh>
#include <gecode/int.hh>
#include
#include
#include
#include

using namespace std;
using namespace Gecode;

class plan : public Script {

protected:
IntVar x,y;

public:
plan(const Options& opt) : Script(opt), x(*this, 0,20) , y(*this, 0, 20) {

rel(*this, (x+y)<=13);

branch(*this, x, INT_VAL_MAX());
branch(*this, y, INT_VAL_MAX());

std::cout << "\n\nxmin : " << x.min() << " xmax : " << x.max()
<< "\nymin : " << y.min() << " ymax : " << y.max()<<endl;
}

virtual void
print(std::ostream& os) const {

os << "\nx: " << x << " y: " << y;
}

plan(plan& s) : Script(s) {

x.update(*this, s.x);
y.update(*this, s.y);
}

virtual Space* copy(void) {
return new plan(*this);
}
};

int main(int argc, char* argv[])
{
Options opt("Plan");
opt.solutions(0);
Script::run<plan, BAB, Options>(opt);

return 0;

}`

Thank you for your time.

Anthony.

table_int_reif for

Hello Christian,
The current table constraint in a reified context hits this assert when array length(x) > 5.
"'table' constraints in a reified context are only supported for 1..5 variables."
I wrote a version that works for any length of "x".
There is one issue though, the mzn2fzn binary consumes 3Gig memory when length(x) = 6, dom_size(x[]) = 7, may be because the generated table has large number of rows. (6^7 rows).

Pl. see attached file.

table_int_reif.txt
table_int_reif.txt

Thanks,
Satish Majhee

Missing "post" event in trace

Describe the bug

Hi there,

when posting constraints in a space after having already called status() on that space I am missing the post-events, but get the propagate-events once status() is called a second time.

Many thanks and all the best
Conrad

To Reproduce

Gecode::IntVarArray x(*this, 3);
for(int i=0; i<3; ++i)
    x[i] = Gecode::IntVar(*this, -25, 25);

Gecode::Home home(*this);

Gecode::trace(home, (Gecode::TE_PROPAGATE | Gecode::TE_POST));

Gecode::PropagatorGroup pba, pbb;

Gecode::rel(pba(home),  x[0] == x[1]);
Gecode::rel(pba(home),  x[1] == x[2]);

// comment out this call and the post-events for pbb go missing
// this->status();

// make the space fail
Gecode::rel(pbb(home), x[0] == 1);
Gecode::rel(pbb(home), x[2] == 2);

this->status();

Gecode and Platform Configuration

Please describe which version of Gecode you use, on which operating system, and with which C++ compiler (including its version).

Gecode 6.1.1 on Linux with gcc 7.3

Error when looking for Qt during configure

The configure code looking for Qt can malfunction in some cases. The following happened during configure

checking for moc... moc
checking whether to build with Qt support... qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
./configure: line 12403: test: -lt: unary operator expected
./configure: line 12404: test: too many arguments
yes
./configure: line 12420: test: -eq: unary operator expected
qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
grep: Makefile: No such file or directory

This has to do with the part in configure that does if test ${ac_gecode_qt_major} -lt 4; then ac_gecode_qt_ok="no"; (from line 1336 in gecode.m4) where if an error occured ac_gecode_qt_major can be undefined and thus the comparison errors.

clang-10: warning: array index 1 is past the end of the array

This warning appears to indicate a serious problem:

In file included from /usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/set/cardinality.cpp:38:
In file included from /usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/set.hh:43:
In file included from /usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/kernel.hh:150:
/usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/kernel/core.hpp:4584:7: warning: array index 1 is past the end of the array (which contains 1 element) [-Warray-bounds]
      x->u.idx[1] = u.idx[1];
      ^        ~
/usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/kernel/core.hpp:4659:49: note: in instantiation of member function 'Gecode::VarImp<Gecode::Int::BoolVarImpConf>::update' requested here
      VarImp<VIC>* n = x->next(); x->forward()->update(x,sub); x = n;
                                                ^
/usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/kernel/var-imp.hpp:487:50: note: in instantiation of member function 'Gecode::VarImp<Gecode::Int::BoolVarImpConf>::update' requested here
    Gecode::VarImp<Gecode::Int::BoolVarImpConf>::update(*this,sub);
                                                 ^
/usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/kernel/core.hpp:273:7: note: array 'idx' declared here
      unsigned int idx[pc_max+1];
      ^
/usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/kernel/core.hpp:4584:21: warning: array index 1 is past the end of the array (which contains 1 element) [-Warray-bounds]
      x->u.idx[1] = u.idx[1];
                    ^     ~
/usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/kernel/core.hpp:273:7: note: array 'idx' declared here
      unsigned int idx[pc_max+1];
      ^

Memory leak with INT_VAR_RND(..)

If one runs the program attached below, valgrind reports the data associated with the 'rndLocal' object as 'definitely lost'.

Unfortunately I do not have the time to scan the issue thoroughly, but it looks like the ViewSelRnd object - created on gecode-managed "space" memory arena - retains a shared 'Rnd' handle but the Rnd's destructor - which would take care of managing the shared handle the right way - is never executed (because, apparently - and very understandably - the "space" memory area is "bulk-discarded).

/*
g++ -o bug5 =1/bug5.cpp -L/usr/local/lib -lgecodekernel -lgecodesupport -lgecodeint -lgecodesearch
g++ -ggdb -o bug5 =1/bug5.cpp -L/usr/local/lib -lgecodekernel -lgecodesupport -lgecodeint -lgecodesearch
setenv LD_LIBRARY_PATH /usr/local/lib
./branching0
valgrind -s --leak-check=full --track-origins=yes --read-var-info=yes ./bug5

*/

#include <gecode/int.hh>
#include <gecode/search.hh>

using namespace Gecode;

Rnd rndGlobal(0);

class VarsSpace : public Space {
protected:
IntVarArray vars;
public:
VarsSpace(void) : vars(*this, 2, 0, 0) {}
void branchRnd(Rnd &rnd) {
branch(*this, vars, INT_VAR_RND(rnd), INT_VAL_MIN());
}
VarsSpace(VarsSpace& s) : Space(s) {
vars.update(this, s.vars);
}
virtual Space
copy(void) {
return new VarsSpace(*this);
}
};

// main function
int main(int argc, char* argv[])
{
Rnd rndLocal(0);
// create model and search engine
VarsSpace* m = new VarsSpace;
// m->branchRnd(rndGlobal);
m->branchRnd(rndLocal);
DFS e(m);
delete m;
VarsSpace* s = e.next();
delete s;
return (0);
}

FloatMinimizeSpace::constrain

Description

I have a problem with a FloatVar objective. I'm not sure the details are relevant, but here it goes:

FloatVar totalCost = expr(*this, 
  overstaffing/FloatVal(c1)+
  unhappiness*FloatVal(c2)+FloatVal(c3))/FloatVal(c4)+
  understaffing/FloatVal(c5)
);

where c1,..,c5 are constants (doubles), and overstaffing, understaffing, and unhappiness are also FloatVar.

I'm doing branch and bound (using BAB), but I'm getting a

Gecode::Float::ValOfUnassignedVar

when trying to read totalCost of one of the solutions found along the way, even when all the other involved variables are assigned. When printing the value of totalCost, it shows something like:

totalCost: [[1.69614..1.69614]]

but totalCost.max()-totalCost.min() is 4.4409e-16.

My model subclasses FloatMinimizeSpace without any parameters. I'm not linking with GMP, but there are no transcendental functions involved.

I understand that the fact that all variables in a float expression are assigned does not guarantee that the result of the expression can be represented by a single float value. The problem here is that gecode will throw an exception on the constrain() method since it is trying to access the val() method as well there (why not just max()?).

Likely solution (?)

I believe the calls to objective.val() should be replaced by objective.max() (in case of minimization), for example here:

rel(*this, cost(), FRT_LE, best->cost().val()-step);

This will mean that for a very very small step the BAB may get stucked, but at least is safe.

To Reproduce

This might not be easy to reproduce it as this happens with some particular combination of floating point numbers.

Gecode and Platform Configuration

Gecode/[email protected]
Linux 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64 GNU/Linux

fzn_table_bool and fzn_table_bool_reif are broken

The FlatZinc predicates fzn_table_bool and fzn_table_bool_reif are broken. When used, Gecode reports:

Error: Type error: bool literal expected

The bindings in gecode/flatzinc/mznlib/ require the table to be represented as integer array, but the implementation in gecode/flatzinc/registry.cpp seems to expect a Boolean array.

Fails to build with ENABLE_GIST=ON: undefined reference to vtable for Gecode::Gist::GistMainWindow

[241/241] : && /usr/bin/c++ -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -std=c++11 -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -fstack-protector-strong CMakeFiles/fzn-gecode.dir/fzn-gecode_autogen/mocs_compilation.cpp.o CMakeFiles/fzn-gecode.dir/tools/flatzinc/fzn-gecode.cpp.o -o bin/fzn-gecode  -Wl,-rpath,/usr/ports/devel/gecode/work/.build:/usr/local/lib/qt5:/usr/local/lib:  libgecodeflatzinc.so  libgecodeminimodel.so  libgecodedriver.so  libgecodeset.so  libgecodesearch.so  libgecodefloat.so  libgecodeint.so  libgecodekernel.so  libgecodesupport.so  -pthread  libgecodegist.so  /usr/local/lib/qt5/libQt5PrintSupport.so.5.15.0  /usr/local/lib/qt5/libQt5Widgets.so.5.15.0  /usr/local/lib/qt5/libQt5Gui.so.5.15.0  /usr/local/lib/qt5/libQt5Core.so.5.15.0  -Wl,-rpath-link,/usr/local/lib && :
FAILED: bin/fzn-gecode 
: && /usr/bin/c++ -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -std=c++11 -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -fstack-protector-strong CMakeFiles/fzn-gecode.dir/fzn-gecode_autogen/mocs_compilation.cpp.o CMakeFiles/fzn-gecode.dir/tools/flatzinc/fzn-gecode.cpp.o -o bin/fzn-gecode  -Wl,-rpath,/usr/ports/devel/gecode/work/.build:/usr/local/lib/qt5:/usr/local/lib:  libgecodeflatzinc.so  libgecodeminimodel.so  libgecodedriver.so  libgecodeset.so  libgecodesearch.so  libgecodefloat.so  libgecodeint.so  libgecodekernel.so  libgecodesupport.so  -pthread  libgecodegist.so  /usr/local/lib/qt5/libQt5PrintSupport.so.5.15.0  /usr/local/lib/qt5/libQt5Widgets.so.5.15.0  /usr/local/lib/qt5/libQt5Gui.so.5.15.0  /usr/local/lib/qt5/libQt5Core.so.5.15.0  -Wl,-rpath-link,/usr/local/lib && :
ld: error: libgecodegist.so: undefined reference to vtable for Gecode::Gist::GistMainWindow
ld: error: libgecodegist.so: undefined reference to vtable for Gecode::Gist::TextOutputI
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::TreeCanvas::contextMenu(QContextMenuEvent*)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::TreeCanvas::scaleChanged(int)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::TreeCanvas::addedBookmark(QString const&)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::TreeCanvas::statusChanged(Gecode::Gist::VisualNode*, Gecode::Gist::Statistics const&, bool)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::TreeCanvas::autoZoomChanged(bool)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::TreeCanvas::removedBookmark(int)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::TreeCanvas::staticMetaObject
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::TreeCanvas::solution(Gecode::Space const*)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::SearcherThread::moveToNode(Gecode::Gist::VisualNode*, bool)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::SearcherThread::statusChanged(bool)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::SearcherThread::searchFinished()
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::SearcherThread::update(int, int, int)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::SearcherThread::solution(Gecode::Space const*)
ld: error: libgecodegist.so: undefined reference to vtable for Gecode::Gist::TreeCanvas
ld: error: libgecodegist.so: undefined reference to vtable for Gecode::Gist::SearcherThread
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::Gist::statusChanged(Gecode::Gist::Statistics const&, bool)
ld: error: libgecodegist.so: undefined reference to vtable for Gecode::Gist::Gist
ld: error: libgecodegist.so: undefined reference to vtable for Gecode::Gist::NodeStatInspector
ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
c++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

clang-10
FreeBSD 12.2

Shared libraries lost versions in 6.2.0

For example:

lib/libgecodeset.so
lib/libgecodeset.so.%%SHLIB_VERSION%%
lib/libgecodeset.so.%%SHLIB_VERSION%%.0
lib/libgecodesupport.so
lib/libgecodesupport.so.%%SHLIB_VERSION%%
lib/libgecodesupport.so.%%SHLIB_VERSION%%.0

became

lib/libgecodeset.so
lib/libgecodesupport.so

clang-10: error: no viable overloaded '='

/usr/bin/c++ -DGECODE_HAS_CPPROFILER -Dgecodeset_EXPORTS -Igecodeset_autogen/include -I/usr/ports/devel/gecode/work/gecode-release-6.2.0 -I. -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -std=c++11 -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -fPIC -std=gnu++11 -MD -MT CMakeFiles/gecodeset.dir/gecode/set/cardinality.cpp.o -MF CMakeFiles/gecodeset.dir/gecode/set/cardinality.cpp.o.d -o CMakeFiles/gecodeset.dir/gecode/set/cardinality.cpp.o -c /usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/set/cardinality.cpp
In file included from /usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/set/cardinality.cpp:39:
In file included from /usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/set/int.hh:296:
/usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/set/int/weights.hpp:127:14: error: no viable overloaded '='
    elements = elements0; weights = weights0;
    ~~~~~~~~ ^ ~~~~~~~~~
/usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/kernel/data/shared-array.hpp:53:9: note: candidate function (the implicit copy assignment operator) not viable: 'this' argument has type 'const SharedArray<int>', but method is not marked const
  class SharedArray : public SharedHandle {
        ^
In file included from /usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/set/cardinality.cpp:39:
In file included from /usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/set/int.hh:296:
/usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/set/int/weights.hpp:127:35: error: no viable overloaded '='
    elements = elements0; weights = weights0;
                          ~~~~~~~ ^ ~~~~~~~~
/usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/kernel/data/shared-array.hpp:53:9: note: candidate function (the implicit copy assignment operator) not viable: 'this' argument has type 'const SharedArray<int>', but method is not marked const
  class SharedArray : public SharedHandle {
        ^

FreeBSD 12.2

Flatzinc float_times leads to unsatisfiable model

Gecode 6.0.1 (and possibly previous versions) indicate that the following FlatZinc model
is unsatisfiable even though it clearly shouldn't be (V14=0.288, V29=0.0864, V30=0.01728).

float: C1 = 0.8;
float: C2 = 0.36;
float: C3 = 0.2;
float: C4 = 0.3;
var 0.0 .. 1.0: V14 :: output_var;
var 0.0 .. 1.0: V29 :: output_var;
var 0.0 .. 1.0: V30 :: output_var;
constraint float_times(C1, C2, V14);
constraint float_times(C4, V14, V29);
constraint float_times(C3, V29, V30);
solve satisfy;

faulty_model.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.