diff --git a/CHANGES.txt b/CHANGES.txt index 9a4b49dcc..498281e0f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,6 +5,17 @@ All bug numbers refer to the issue tracker at https://github.com/MiniZinc/libminizinc/issues +Version 2.2.3 +============= + +Bug fixes: + - Fix some typos in the library documentation. + - Fix solution checking. + - Fix line numbers in parsed locations on 64 bit platforms. Fixes #255. + - Fix bounds computation for calls. Partially fixes #255. + - Fix translation of var where clauses with more than 3 par components. + Fixes #253. + Version 2.2.2 ============= diff --git a/CMakeLists.txt b/CMakeLists.txt index c4115a8df..964b79b0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ endif() # The version number. set (libminizinc_VERSION_MAJOR 2) set (libminizinc_VERSION_MINOR 2) -set (libminizinc_VERSION_PATCH 2) +set (libminizinc_VERSION_PATCH 3) set (libminizinc_VERSION ${libminizinc_VERSION_MAJOR}.${libminizinc_VERSION_MINOR}.${libminizinc_VERSION_PATCH}) diff --git a/include/minizinc/ast.hpp b/include/minizinc/ast.hpp index 034d49632..a16ab87e3 100644 --- a/include/minizinc/ast.hpp +++ b/include/minizinc/ast.hpp @@ -92,8 +92,9 @@ namespace MiniZinc { inline unsigned int Location::LocVec::first_line(void) const { if (_size==2) { + static const unsigned int pointerBits = sizeof(IntLit*)*8; IntLit* il = static_cast(_data[1]); - long long unsigned int mask = 0xFF; + long long unsigned int mask = pointerBits<=32 ? 0xFF : 0xFFFFF; union { long long int i; unsigned long long int u; diff --git a/lib/eval_par.cpp b/lib/eval_par.cpp index 0d9025625..22e12f906 100644 --- a/lib/eval_par.cpp +++ b/lib/eval_par.cpp @@ -2138,10 +2138,12 @@ namespace MiniZinc { else _bounds.push_back(Bounds(0,std::max(-b0.first,b0.second))); } - } else if (c.decl() && c.decl()->ti()->domain()) { - assert(_bounds.size() >= c.n_args()); + } else if (c.decl() && c.decl()->ti()->domain() && !c.decl()->ti()->domain()->isa()) { for (int i=0; itype().isint()) { + assert(_bounds.size() > 0); + _bounds.pop_back(); + } } IntSetVal* isv = eval_intset(env, c.decl()->ti()->domain()); _bounds.push_back(Bounds(isv->min(),isv->max())); @@ -2494,10 +2496,12 @@ namespace MiniZinc { else _bounds.push_back(FBounds(0.0,std::max(-b0.first,b0.second))); } - } else if (c.decl() && c.decl()->ti()->domain()) { - assert(_bounds.size() >= c.n_args()); + } else if (c.decl() && c.decl()->ti()->domain() && !c.decl()->ti()->domain()->isa()) { for (int i=0; itype().isfloat()) { + assert(_bounds.size() > 0); + _bounds.pop_back(); + } } FloatSetVal* fsv = eval_floatset(env, c.decl()->ti()->domain()); _bounds.push_back(FBounds(fsv->min(),fsv->max())); @@ -2726,10 +2730,12 @@ namespace MiniZinc { IntSetVal* b0 = _bounds.back(); _bounds.pop_back(); _bounds.pop_back(); // don't need bounds of right hand side _bounds.push_back(b0); - } else if (c.decl() && c.decl()->ti()->domain()) { - assert(_bounds.size() >= c.n_args()); + } else if (c.decl() && c.decl()->ti()->domain() && !c.decl()->ti()->domain()->isa()) { for (int i=0; itype().isintset()) { + assert(_bounds.size() > 0); + _bounds.pop_back(); + } } IntSetVal* fsv = eval_intset(env, c.decl()->ti()->domain()); _bounds.push_back(fsv); diff --git a/lib/flatten.cpp b/lib/flatten.cpp index 2dded2930..0046b835d 100644 --- a/lib/flatten.cpp +++ b/lib/flatten.cpp @@ -4286,7 +4286,9 @@ namespace MiniZinc { break; default: { - Call* forall = new Call(c->where(i)->loc(), constants().ids.forall, parWhere); + ArrayLit* parWhereAl = new ArrayLit(c->where(i)->loc(), parWhere); + parWhereAl->type(Type::parbool(1)); + Call* forall = new Call(c->where(i)->loc(), constants().ids.forall, {parWhereAl}); forall->type(Type::parbool()); forall->decl(env.model->matchFn(env, forall, false)); orig_where[i] = forall; diff --git a/lib/solns2out.cpp b/lib/solns2out.cpp index 2c83a1e44..3e181796e 100644 --- a/lib/solns2out.cpp +++ b/lib/solns2out.cpp @@ -282,7 +282,7 @@ void Solns2Out::checkSolution(std::ostream& os) { MznSolver slv(oss_err,oss_err); slv.s2out._opt.solution_separator = ""; try { - std::vector args({"--solver","org.minizinc.gecode_presolver","-"}); + std::vector args({"--solver","org.minizinc.gecode_presolver"}); slv.run(args, checker.str(), "minizinc", "checker.mzc"); } catch (const LocationException& e) { oss_err << e.loc() << ":" << std::endl; diff --git a/lib/solver.cpp b/lib/solver.cpp index ef9fcf077..9f5ee61e8 100644 --- a/lib/solver.cpp +++ b/lib/solver.cpp @@ -629,7 +629,7 @@ SolverInstance::Status MznSolver::run(const std::vector& args0, con case OPTION_OK: break; } - if (!(!ifMzn2Fzn() && sf!=NULL && sf->getId() == "org.minizinc.mzn-mzn") && !flt.hasInputFiles()) { + if (!(!ifMzn2Fzn() && sf!=NULL && sf->getId() == "org.minizinc.mzn-mzn") && !flt.hasInputFiles() && model.empty()) { // We are in solns2out mode while ( std::cin.good() ) { string line; diff --git a/share/minizinc/std/int_set_channel.mzn b/share/minizinc/std/int_set_channel.mzn index 558c301f0..4757ff217 100644 --- a/share/minizinc/std/int_set_channel.mzn +++ b/share/minizinc/std/int_set_channel.mzn @@ -1,6 +1,6 @@ /** @group globals.channeling Requires that array of int variables \a x and array of set variables \a y - are related such that (\a x[\p i] = \p j) ↔ (\p i in \a y[\p j]). + are related such that (\a x[\p i] = \p j) if and only if (\p i in \a y[\p j]). */ predicate int_set_channel(array[int] of var int: x, array[int] of var set of int: y) = diff --git a/share/minizinc/std/link_set_to_booleans.mzn b/share/minizinc/std/link_set_to_booleans.mzn index 0374e0432..7a93f108c 100644 --- a/share/minizinc/std/link_set_to_booleans.mzn +++ b/share/minizinc/std/link_set_to_booleans.mzn @@ -1,6 +1,6 @@ /** @group globals.channeling Constrain the array of Booleans \a b to be a representation of the set \a s: - \p i in \a s ↔ \a b[\p i]. + \p i in \a s if and only if \a b[\p i]. The index set of \a b must be a superset of the possible values of \a s. */ diff --git a/share/minizinc/std/value_precede_chain.mzn b/share/minizinc/std/value_precede_chain.mzn index 8f7363eff..1c142dcfc 100644 --- a/share/minizinc/std/value_precede_chain.mzn +++ b/share/minizinc/std/value_precede_chain.mzn @@ -5,8 +5,8 @@ include "value_precede_chain_set.mzn"; Requires that \a c[\p i] precedes \a c[\p i +1] in the array \a x. Precedence means that if any element of \a x - is equal to \a \a c[\p i +1], then another element of \a x with a lower index is equal - to \a \a c[\p i]. + is equal to \a c[\p i +1], then another element of \a x with a lower index is equal + to \a c[\p i]. */ predicate value_precede_chain(array[int] of int: c, array[int] of var int: x) = value_precede_chain_int(c, x); @@ -15,8 +15,8 @@ predicate value_precede_chain(array[int] of int: c, array[int] of var int: x) = Requires that \a c[\p i] precedes \a c[\p i +1] in the array \a x. Precedence means that if an element of \a x - contains \a \a c[\p i +1] but not \a \a c[\p i], then another element of \a x with lower index contains - \a \a c[\p i] but not \a \a c[\p i +1]. + contains \a c[\p i +1] but not \a c[\p i], then another element of \a x with lower index contains + \a c[\p i] but not \a c[\p i +1]. */ predicate value_precede_chain(array[int] of int: c, array[int] of var set of int: x) = value_precede_chain_set(c, x);