Skip to content

Commit

Permalink
Merge branch 'release/2.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
guidotack committed Dec 14, 2016
2 parents bf8d2d2 + 50f3703 commit d9a4e6f
Show file tree
Hide file tree
Showing 10 changed files with 225 additions and 54 deletions.
19 changes: 18 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,28 @@
All bug numbers refer to the issue tracker at
https://github.com/MiniZinc/libminizinc/issues

Version 2.1.0
Version 2.1.1
=============

Changes:
- Add missing min/max functions for set variables. Can be redefined to solver
builtins using the new redefinitions-2.1.1.mzn library file.
- Add support for option type expressions as objective functions.
- Automatically coerce arrays constructed using ++ to any enum index set
(in addition to array literals and comprehensions).

Bug fixes:
- Include cmath header to fix compilation issues with some compilers. Fixes #125.
- Fix a garbage collection bug in the type checking for enumerated types that would
sometimes lead to crashes or incorrect error messages.
- Fix type checking of comprehensions that involve enumerated types.
- Fix bounds computation for var sets of enumerated types.
- Support anon_enum function as documented.

Version 2.1.0
=============

Changes:
- MiniZinc now supports enumerated types.
- Solvers can be interfaced directly to the MiniZinc library, and MiniZinc
comes with direct support for the CBC, Gurobi and CPLEX MIP solvers.
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ endif()
# The version number.
set (libminizinc_VERSION_MAJOR 2)
set (libminizinc_VERSION_MINOR 1)
set (libminizinc_VERSION_PATCH 0)
set (libminizinc_VERSION_PATCH 1)

if (ADDITIONAL_DATE_STRING)
set (libminizinc_VERSION_PATCH "${libminizinc_VERSION_PATCH}.${ADDITIONAL_DATE_STRING}")
Expand Down
1 change: 1 addition & 0 deletions include/minizinc/iter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#define __MINIZINC_ITER_HH__

#include <minizinc/values.hh>
#include <cmath>

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
Expand Down
2 changes: 1 addition & 1 deletion include/minizinc/typecheck.hh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace MiniZinc {
/// Add a variable declaration
void add(EnvI& env, VarDecl* vd, bool unique);
/// Add a variable declaration item
void add(EnvI& env, VarDeclI* vd, bool unique, bool handleEnums, std::vector<Item*>& enumItems);
void add(EnvI& env, VarDeclI* vd, bool unique, bool handleEnums, Model* enumItems);
/// Remove a variable declaration
void remove(EnvI& env, VarDecl* vd);
/// Get variable declaration from identifier \a id
Expand Down
2 changes: 1 addition & 1 deletion lib/eval_par.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2363,7 +2363,7 @@ namespace MiniZinc {
}
/// Visit identifier
void vId(const Id& id) {
if (id.decl()->ti()->domain()) {
if (id.decl()->ti()->domain() && !id.decl()->ti()->domain()->isa<TIId>()) {
_bounds.push_back(eval_intset(env,id.decl()->ti()->domain()));
} else {
if (id.decl()->e()) {
Expand Down
10 changes: 7 additions & 3 deletions lib/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ namespace MiniZinc {
EnvI& env;
Decls(EnvI& env0) : env(env0) {}
void vCall(Call& c) {
if (c.id()=="format" || c.id()=="show") {
if (c.id()=="format" || c.id()=="show" || c.id()=="showDzn") {
int enumId = c.args()[c.args().size()-1]->type().enumId();
if (enumId != 0 && c.args()[c.args().size()-1]->type().dim() != 0) {
const std::vector<unsigned int>& enumIds = env.getArrayEnum(enumId);
Expand All @@ -182,7 +182,7 @@ namespace MiniZinc {
if (enumId > 0) {
Id* ti_id = env.getEnum(enumId)->e()->id();
GCLock lock;
std::vector<Expression*> args(1);
std::vector<Expression*> args(2);
args[0] = c.args()[c.args().size()-1];
if (args[0]->type().dim() > 1) {
Call* array1d = new Call(Location().introduce(),ASTString("array1d"),args);
Expand All @@ -191,10 +191,14 @@ namespace MiniZinc {
array1d->type(array1dt);
args[0] = array1d;
}
args[1] = constants().boollit(c.id()=="showDzn");
std::string enumName = createEnumToStringName(ti_id, "_toString_");
c.id(ASTString(enumName));
c.args(args);
}
if (c.id()=="showDzn") {
c.id(constants().ids.show);
}
}
c.decl(env.orig->matchFn(env,&c,false));
}
Expand Down Expand Up @@ -401,7 +405,7 @@ namespace MiniZinc {

std::vector<Expression*> showArgs(1);
showArgs[0] = vd->id();
Call* show = new Call(Location().introduce(),constants().ids.show,showArgs);
Call* show = new Call(Location().introduce(),ASTString("showDzn"),showArgs);
show->type(Type::parstring());
FunctionI* fi = e.orig->matchFn(e, show, false);
assert(fi);
Expand Down
Loading

0 comments on commit d9a4e6f

Please sign in to comment.