Skip to content

Commit

Permalink
Merge branch 'release/2.2.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
guidotack committed Oct 31, 2018
2 parents 1d7c220 + d1beef6 commit 3d66971
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 20 deletions.
11 changes: 11 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
=============

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down
3 changes: 2 additions & 1 deletion include/minizinc/ast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<IntLit*>(_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;
Expand Down
24 changes: 15 additions & 9 deletions lib/eval_par.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<TIId>()) {
for (int i=0; i<c.n_args(); i++) {
_bounds.pop_back();
if (c.arg(i)->type().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()));
Expand Down Expand Up @@ -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<TIId>()) {
for (int i=0; i<c.n_args(); i++) {
_bounds.pop_back();
if (c.arg(i)->type().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()));
Expand Down Expand Up @@ -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<TIId>()) {
for (int i=0; i<c.n_args(); i++) {
_bounds.pop_back();
if (c.arg(i)->type().isintset()) {
assert(_bounds.size() > 0);
_bounds.pop_back();
}
}
IntSetVal* fsv = eval_intset(env, c.decl()->ti()->domain());
_bounds.push_back(fsv);
Expand Down
4 changes: 3 additions & 1 deletion lib/flatten.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/solns2out.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void Solns2Out::checkSolution(std::ostream& os) {
MznSolver slv(oss_err,oss_err);
slv.s2out._opt.solution_separator = "";
try {
std::vector<std::string> args({"--solver","org.minizinc.gecode_presolver","-"});
std::vector<std::string> args({"--solver","org.minizinc.gecode_presolver"});
slv.run(args, checker.str(), "minizinc", "checker.mzc");
} catch (const LocationException& e) {
oss_err << e.loc() << ":" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion lib/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ SolverInstance::Status MznSolver::run(const std::vector<std::string>& 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;
Expand Down
2 changes: 1 addition & 1 deletion share/minizinc/std/int_set_channel.mzn
Original file line number Diff line number Diff line change
@@ -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) &#8596; (\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) =
Expand Down
2 changes: 1 addition & 1 deletion share/minizinc/std/link_set_to_booleans.mzn
Original file line number Diff line number Diff line change
@@ -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 &#8596; \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.
*/
Expand Down
8 changes: 4 additions & 4 deletions share/minizinc/std/value_precede_chain.mzn
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);

0 comments on commit 3d66971

Please sign in to comment.