38 #ifndef __GECODE_FLATZINC_HH__
39 #define __GECODE_FLATZINC_HH__
45 #ifdef GECODE_HAS_SET_VARS
56 #if !defined(GECODE_STATIC_LIBS) && \
57 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
59 #ifdef GECODE_BUILD_FLATZINC
60 #define GECODE_FLATZINC_EXPORT __declspec( dllexport )
62 #define GECODE_FLATZINC_EXPORT __declspec( dllimport )
67 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
69 #define GECODE_FLATZINC_EXPORT __attribute__ ((visibility("default")))
73 #define GECODE_FLATZINC_EXPORT
79 #ifndef GECODE_BUILD_FLATZINC
80 #define GECODE_LIBRARY_NAME "FlatZinc"
99 namespace Gecode {
namespace FlatZinc {
108 void printElem(std::ostream& out,
121 void print(std::ostream& out,
124 #ifdef GECODE_HAS_SET_VARS
133 std::map<int,int>& iv, std::map<int,int>& bv,
134 std::map<int,int>& sv);
136 void shrinkArrays(
Space& home,
140 #ifdef GECODE_HAS_SET_VARS
186 _solutions(
"-n",
"number of solutions (0 = all)",1),
187 _allSolutions(
"-a",
"return all solutions (equal to -solutions 0)"),
188 _threads(
"-p",
"number of threads (0 = #processing units)",
189 Gecode::Search::Config::
threads),
190 _free(
"--free",
"no need to follow search-specification"),
192 _c_d(
"-c-d",
"recomputation commit distance",Gecode::Search::Config::
c_d),
193 _a_d(
"-a-d",
"recomputation adaption distance",Gecode::Search::Config::
a_d),
194 _node(
"-node",
"node cutoff (0 = none, solution mode)"),
195 _fail(
"-fail",
"failure cutoff (0 = none, solution mode)"),
196 _time(
"-time",
"time (in ms) cutoff (0 = none, solution mode)"),
197 _seed(
"-r",
"random seed",0),
199 _stat(
"-s",
"emit statistics"),
200 _output(
"-o",
"file to send output to") {
217 void parse(
int& argc,
char* argv[]) {
227 std::cerr <<
"Gecode FlatZinc interpreter" << std::endl
229 << std::endl << std::endl;
284 template<
template<
class>
class Engine>
286 runEngine(std::ostream& out,
const Printer& p,
301 #ifdef GECODE_HAS_SET_VARS
314 void init(
int intVars,
int boolVars,
int setVars);
319 void aliasBool2Int(
int iv,
int bv);
321 int aliasBool2Int(
int iv);
333 void minimize(
int var,
AST::Array* annotation);
335 void maximize(
int var,
AST::Array* annotation);
338 void run(std::ostream& out,
const Printer& p,
355 Meth method(
void)
const;
358 int optVar(
void)
const;
372 std::ostream& err = std::cerr);
378 virtual void constrain(
const Space& s);
386 const std::string msg;
388 Error(
const std::string& where,
const std::string& what)
389 : msg(where+
": "+what) {}
390 const std::string&
toString(
void)
const {
return msg; }
399 FlatZincSpace*
parse(
const std::string& fileName,
400 Printer& p, std::ostream& err = std::cerr,
401 FlatZincSpace* fzs=NULL);
409 FlatZincSpace*
parse(std::istream& is,
410 Printer& p, std::ostream& err = std::cerr,
411 FlatZincSpace* fzs=NULL);