support for gecode 4, reification, initial floats

This commit is contained in:
vsc 2013-09-04 04:50:32 -05:00
parent 76ca8c31df
commit 6ab396ee85
18 changed files with 15685 additions and 15417 deletions

18463
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -133,6 +133,8 @@ return 0;
;;
esac
fi
GECODE_MAJOR=`echo $GECODE_VERSION| sed 's/\(^.\).*/\1/'`
AC_SUBST(GECODE_MAJOR)
AC_ARG_ENABLE(tabling,
[ --enable-tabling support tabling ],

View File

@ -0,0 +1 @@
4.2.0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
// -*- c++ -*-
//=============================================================================
// Copyright (C) 2011 by Denys Duchier
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//=============================================================================
static RestartMode gecode_RestartMode_from_term(YAP_Term);
static FloatRelType gecode_FloatRelType_from_term(YAP_Term);
static ReifyMode gecode_ReifyMode_from_term(YAP_Term);
static IntRelType gecode_IntRelType_from_term(YAP_Term);
static BoolOpType gecode_BoolOpType_from_term(YAP_Term);
static IntConLevel gecode_IntConLevel_from_term(YAP_Term);
static TaskType gecode_TaskType_from_term(YAP_Term);
static ExtensionalPropKind gecode_ExtensionalPropKind_from_term(YAP_Term);
static SetRelType gecode_SetRelType_from_term(YAP_Term);
static SetOpType gecode_SetOpType_from_term(YAP_Term);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,630 @@
// -*- c++ -*-
//=============================================================================
// Copyright (C) 2011 by Denys Duchier
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//=============================================================================
{ YAP_Atom X= YAP_LookupAtom("RM_NONE");
gecode_RM_NONE = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("RM_CONSTANT");
gecode_RM_CONSTANT = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("RM_LINEAR");
gecode_RM_LINEAR = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("RM_LUBY");
gecode_RM_LUBY = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("RM_GEOMETRIC");
gecode_RM_GEOMETRIC = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("FRT_EQ");
gecode_FRT_EQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("FRT_NQ");
gecode_FRT_NQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("FRT_LQ");
gecode_FRT_LQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("FRT_LE");
gecode_FRT_LE = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("FRT_GQ");
gecode_FRT_GQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("FRT_GR");
gecode_FRT_GR = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("RM_EQV");
gecode_RM_EQV = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("RM_IMP");
gecode_RM_IMP = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("RM_PMI");
gecode_RM_PMI = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("IRT_EQ");
gecode_IRT_EQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("IRT_NQ");
gecode_IRT_NQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("IRT_LQ");
gecode_IRT_LQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("IRT_LE");
gecode_IRT_LE = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("IRT_GQ");
gecode_IRT_GQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("IRT_GR");
gecode_IRT_GR = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("BOT_AND");
gecode_BOT_AND = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("BOT_OR");
gecode_BOT_OR = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("BOT_IMP");
gecode_BOT_IMP = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("BOT_EQV");
gecode_BOT_EQV = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("BOT_XOR");
gecode_BOT_XOR = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("ICL_VAL");
gecode_ICL_VAL = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("ICL_BND");
gecode_ICL_BND = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("ICL_DOM");
gecode_ICL_DOM = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("ICL_DEF");
gecode_ICL_DEF = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("TT_FIXP");
gecode_TT_FIXP = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("TT_FIXS");
gecode_TT_FIXS = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("TT_FIXE");
gecode_TT_FIXE = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("EPK_DEF");
gecode_EPK_DEF = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("EPK_SPEED");
gecode_EPK_SPEED = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("EPK_MEMORY");
gecode_EPK_MEMORY = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_EQ");
gecode_SRT_EQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_NQ");
gecode_SRT_NQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_SUB");
gecode_SRT_SUB = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_SUP");
gecode_SRT_SUP = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_DISJ");
gecode_SRT_DISJ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_CMPL");
gecode_SRT_CMPL = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_LQ");
gecode_SRT_LQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_LE");
gecode_SRT_LE = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_GQ");
gecode_SRT_GQ = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SRT_GR");
gecode_SRT_GR = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SOT_UNION");
gecode_SOT_UNION = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SOT_DUNION");
gecode_SOT_DUNION = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SOT_INTER");
gecode_SOT_INTER = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
{ YAP_Atom X= YAP_LookupAtom("SOT_MINUS");
gecode_SOT_MINUS = YAP_MkAtomTerm(X);
YAP_AtomGetHold(X); }
YAP_UserCPredicate("gecode_constraint_unary_448", gecode_constraint_unary_448, 6);
YAP_UserCPredicate("gecode_constraint_unary_444", gecode_constraint_unary_444, 6);
YAP_UserCPredicate("gecode_constraint_nvalues_335", gecode_constraint_nvalues_335, 5);
YAP_UserCPredicate("gecode_constraint_nvalues_337", gecode_constraint_nvalues_337, 5);
YAP_UserCPredicate("gecode_constraint_nvalues_331", gecode_constraint_nvalues_331, 5);
YAP_UserCPredicate("gecode_constraint_nvalues_333", gecode_constraint_nvalues_333, 5);
YAP_UserCPredicate("gecode_constraint_max_292", gecode_constraint_max_292, 4);
YAP_UserCPredicate("gecode_constraint_max_290", gecode_constraint_max_290, 4);
YAP_UserCPredicate("gecode_constraint_max_291", gecode_constraint_max_291, 4);
YAP_UserCPredicate("gecode_constraint_max_295", gecode_constraint_max_295, 4);
YAP_UserCPredicate("gecode_constraint_dom_200", gecode_constraint_dom_200, 6);
YAP_UserCPredicate("gecode_constraint_dom_209", gecode_constraint_dom_209, 6);
YAP_UserCPredicate("gecode_constraint_convex_91", gecode_constraint_convex_91, 3);
YAP_UserCPredicate("gecode_constraint_nooverlap_319", gecode_constraint_nooverlap_319, 5);
YAP_UserCPredicate("gecode_constraint_assign_15", gecode_constraint_assign_15, 3);
YAP_UserCPredicate("gecode_constraint_assign_6", gecode_constraint_assign_6, 3);
YAP_UserCPredicate("gecode_constraint_assign_3", gecode_constraint_assign_3, 3);
YAP_UserCPredicate("gecode_constraint_assign_1", gecode_constraint_assign_1, 3);
YAP_UserCPredicate("gecode_constraint_assign_9", gecode_constraint_assign_9, 3);
YAP_UserCPredicate("gecode_constraint_assign_17", gecode_constraint_assign_17, 3);
YAP_UserCPredicate("gecode_constraint_assign_12", gecode_constraint_assign_12, 3);
YAP_UserCPredicate("gecode_constraint_assign_19", gecode_constraint_assign_19, 3);
YAP_UserCPredicate("gecode_constraint_element_220", gecode_constraint_element_220, 4);
YAP_UserCPredicate("gecode_constraint_element_224", gecode_constraint_element_224, 4);
YAP_UserCPredicate("gecode_constraint_element_214", gecode_constraint_element_214, 4);
YAP_UserCPredicate("gecode_constraint_element_212", gecode_constraint_element_212, 4);
YAP_UserCPredicate("gecode_constraint_element_219", gecode_constraint_element_219, 4);
YAP_UserCPredicate("gecode_constraint_element_227", gecode_constraint_element_227, 4);
YAP_UserCPredicate("gecode_constraint_element_230", gecode_constraint_element_230, 4);
YAP_UserCPredicate("gecode_constraint_element_236", gecode_constraint_element_236, 4);
YAP_UserCPredicate("gecode_constraint_element_228", gecode_constraint_element_228, 4);
YAP_UserCPredicate("gecode_constraint_sequence_427", gecode_constraint_sequence_427, 2);
YAP_UserCPredicate("gecode_constraint_notMax_325", gecode_constraint_notMax_325, 3);
YAP_UserCPredicate("gecode_constraint_ite_246", gecode_constraint_ite_246, 5);
YAP_UserCPredicate("gecode_constraint_unary_441", gecode_constraint_unary_441, 3);
YAP_UserCPredicate("gecode_constraint_nroot_329", gecode_constraint_nroot_329, 5);
YAP_UserCPredicate("gecode_constraint_circuit_85", gecode_constraint_circuit_85, 4);
YAP_UserCPredicate("gecode_constraint_circuit_76", gecode_constraint_circuit_76, 4);
YAP_UserCPredicate("gecode_constraint_dom_199", gecode_constraint_dom_199, 5);
YAP_UserCPredicate("gecode_constraint_dom_198", gecode_constraint_dom_198, 5);
YAP_UserCPredicate("gecode_constraint_dom_202", gecode_constraint_dom_202, 5);
YAP_UserCPredicate("gecode_constraint_dom_194", gecode_constraint_dom_194, 5);
YAP_UserCPredicate("gecode_constraint_dom_185", gecode_constraint_dom_185, 5);
YAP_UserCPredicate("gecode_constraint_dom_181", gecode_constraint_dom_181, 5);
YAP_UserCPredicate("gecode_constraint_dom_187", gecode_constraint_dom_187, 5);
YAP_UserCPredicate("gecode_constraint_dom_208", gecode_constraint_dom_208, 5);
YAP_UserCPredicate("gecode_constraint_dom_210", gecode_constraint_dom_210, 5);
YAP_UserCPredicate("gecode_constraint_dom_206", gecode_constraint_dom_206, 5);
YAP_UserCPredicate("gecode_constraint_channel_66", gecode_constraint_channel_66, 4);
YAP_UserCPredicate("gecode_constraint_channel_62", gecode_constraint_channel_62, 4);
YAP_UserCPredicate("gecode_constraint_channel_60", gecode_constraint_channel_60, 4);
YAP_UserCPredicate("gecode_constraint_nooverlap_321", gecode_constraint_nooverlap_321, 8);
YAP_UserCPredicate("gecode_constraint_nooverlap_324", gecode_constraint_nooverlap_324, 8);
YAP_UserCPredicate("gecode_constraint_element_222", gecode_constraint_element_222, 7);
YAP_UserCPredicate("gecode_constraint_element_216", gecode_constraint_element_216, 7);
YAP_UserCPredicate("gecode_constraint_element_218", gecode_constraint_element_218, 7);
YAP_UserCPredicate("gecode_constraint_element_226", gecode_constraint_element_226, 7);
YAP_UserCPredicate("gecode_constraint_element_234", gecode_constraint_element_234, 7);
YAP_UserCPredicate("gecode_constraint_element_232", gecode_constraint_element_232, 7);
YAP_UserCPredicate("gecode_constraint_max_288", gecode_constraint_max_288, 3);
YAP_UserCPredicate("gecode_constraint_max_289", gecode_constraint_max_289, 3);
YAP_UserCPredicate("gecode_constraint_max_294", gecode_constraint_max_294, 3);
YAP_UserCPredicate("gecode_constraint_unshare_453", gecode_constraint_unshare_453, 2);
YAP_UserCPredicate("gecode_constraint_unshare_451", gecode_constraint_unshare_451, 2);
YAP_UserCPredicate("gecode_constraint_path_348", gecode_constraint_path_348, 5);
YAP_UserCPredicate("gecode_constraint_path_347", gecode_constraint_path_347, 5);
YAP_UserCPredicate("gecode_constraint_branch_34", gecode_constraint_branch_34, 7);
YAP_UserCPredicate("gecode_constraint_branch_28", gecode_constraint_branch_28, 7);
YAP_UserCPredicate("gecode_constraint_branch_40", gecode_constraint_branch_40, 7);
YAP_UserCPredicate("gecode_constraint_mult_315", gecode_constraint_mult_315, 4);
YAP_UserCPredicate("gecode_constraint_mult_314", gecode_constraint_mult_314, 4);
YAP_UserCPredicate("gecode_constraint_clause_89", gecode_constraint_clause_89, 6);
YAP_UserCPredicate("gecode_constraint_clause_87", gecode_constraint_clause_87, 6);
YAP_UserCPredicate("gecode_constraint_precede_356", gecode_constraint_precede_356, 5);
YAP_UserCPredicate("gecode_constraint_distinct_160", gecode_constraint_distinct_160, 2);
YAP_UserCPredicate("gecode_constraint_member_302", gecode_constraint_member_302, 4);
YAP_UserCPredicate("gecode_constraint_member_301", gecode_constraint_member_301, 4);
YAP_UserCPredicate("gecode_constraint_member_298", gecode_constraint_member_298, 4);
YAP_UserCPredicate("gecode_constraint_member_297", gecode_constraint_member_297, 4);
YAP_UserCPredicate("gecode_constraint_mod_313", gecode_constraint_mod_313, 5);
YAP_UserCPredicate("gecode_constraint_cardinality_57", gecode_constraint_cardinality_57, 3);
YAP_UserCPredicate("gecode_constraint_atmostOne_53", gecode_constraint_atmostOne_53, 3);
YAP_UserCPredicate("gecode_constraint_channelSorted_73", gecode_constraint_channelSorted_73, 3);
YAP_UserCPredicate("gecode_constraint_linear_262", gecode_constraint_linear_262, 4);
YAP_UserCPredicate("gecode_constraint_linear_260", gecode_constraint_linear_260, 4);
YAP_UserCPredicate("gecode_constraint_linear_248", gecode_constraint_linear_248, 4);
YAP_UserCPredicate("gecode_constraint_linear_252", gecode_constraint_linear_252, 4);
YAP_UserCPredicate("gecode_constraint_linear_280", gecode_constraint_linear_280, 4);
YAP_UserCPredicate("gecode_constraint_linear_284", gecode_constraint_linear_284, 4);
YAP_UserCPredicate("gecode_constraint_circuit_82", gecode_constraint_circuit_82, 2);
YAP_UserCPredicate("gecode_constraint_rel_396", gecode_constraint_rel_396, 5);
YAP_UserCPredicate("gecode_constraint_rel_398", gecode_constraint_rel_398, 5);
YAP_UserCPredicate("gecode_constraint_rel_412", gecode_constraint_rel_412, 5);
YAP_UserCPredicate("gecode_constraint_rel_410", gecode_constraint_rel_410, 5);
YAP_UserCPredicate("gecode_constraint_rel_382", gecode_constraint_rel_382, 5);
YAP_UserCPredicate("gecode_constraint_rel_378", gecode_constraint_rel_378, 5);
YAP_UserCPredicate("gecode_constraint_rel_376", gecode_constraint_rel_376, 5);
YAP_UserCPredicate("gecode_constraint_rel_373", gecode_constraint_rel_373, 5);
YAP_UserCPredicate("gecode_constraint_rel_372", gecode_constraint_rel_372, 5);
YAP_UserCPredicate("gecode_constraint_rel_369", gecode_constraint_rel_369, 5);
YAP_UserCPredicate("gecode_constraint_rel_368", gecode_constraint_rel_368, 5);
YAP_UserCPredicate("gecode_constraint_rel_365", gecode_constraint_rel_365, 5);
YAP_UserCPredicate("gecode_constraint_rel_363", gecode_constraint_rel_363, 5);
YAP_UserCPredicate("gecode_constraint_rel_392", gecode_constraint_rel_392, 5);
YAP_UserCPredicate("gecode_constraint_rel_394", gecode_constraint_rel_394, 5);
YAP_UserCPredicate("gecode_constraint_rel_388", gecode_constraint_rel_388, 5);
YAP_UserCPredicate("gecode_constraint_rel_401", gecode_constraint_rel_401, 5);
YAP_UserCPredicate("gecode_constraint_rel_400", gecode_constraint_rel_400, 5);
YAP_UserCPredicate("gecode_constraint_rel_405", gecode_constraint_rel_405, 5);
YAP_UserCPredicate("gecode_constraint_rel_404", gecode_constraint_rel_404, 5);
YAP_UserCPredicate("gecode_constraint_rel_409", gecode_constraint_rel_409, 5);
YAP_UserCPredicate("gecode_constraint_rel_420", gecode_constraint_rel_420, 5);
YAP_UserCPredicate("gecode_constraint_rel_422", gecode_constraint_rel_422, 5);
YAP_UserCPredicate("gecode_constraint_rel_362", gecode_constraint_rel_362, 5);
YAP_UserCPredicate("gecode_constraint_rel_360", gecode_constraint_rel_360, 5);
YAP_UserCPredicate("gecode_constraint_min_308", gecode_constraint_min_308, 4);
YAP_UserCPredicate("gecode_constraint_min_306", gecode_constraint_min_306, 4);
YAP_UserCPredicate("gecode_constraint_min_307", gecode_constraint_min_307, 4);
YAP_UserCPredicate("gecode_constraint_min_311", gecode_constraint_min_311, 4);
YAP_UserCPredicate("gecode_constraint_cardinality_56", gecode_constraint_cardinality_56, 4);
YAP_UserCPredicate("gecode_constraint_cardinality_58", gecode_constraint_cardinality_58, 4);
YAP_UserCPredicate("gecode_constraint_count_109", gecode_constraint_count_109, 4);
YAP_UserCPredicate("gecode_constraint_count_106", gecode_constraint_count_106, 4);
YAP_UserCPredicate("gecode_constraint_count_100", gecode_constraint_count_100, 4);
YAP_UserCPredicate("gecode_constraint_count_99", gecode_constraint_count_99, 4);
YAP_UserCPredicate("gecode_constraint_count_96", gecode_constraint_count_96, 4);
YAP_UserCPredicate("gecode_constraint_sqrt_437", gecode_constraint_sqrt_437, 3);
YAP_UserCPredicate("gecode_constraint_sqrt_436", gecode_constraint_sqrt_436, 3);
YAP_UserCPredicate("gecode_constraint_cumulatives_157", gecode_constraint_cumulatives_157, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_155", gecode_constraint_cumulatives_155, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_153", gecode_constraint_cumulatives_153, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_151", gecode_constraint_cumulatives_151, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_149", gecode_constraint_cumulatives_149, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_147", gecode_constraint_cumulatives_147, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_145", gecode_constraint_cumulatives_145, 9);
YAP_UserCPredicate("gecode_constraint_cumulatives_143", gecode_constraint_cumulatives_143, 9);
YAP_UserCPredicate("gecode_constraint_nvalues_334", gecode_constraint_nvalues_334, 4);
YAP_UserCPredicate("gecode_constraint_nvalues_336", gecode_constraint_nvalues_336, 4);
YAP_UserCPredicate("gecode_constraint_nvalues_330", gecode_constraint_nvalues_330, 4);
YAP_UserCPredicate("gecode_constraint_nvalues_332", gecode_constraint_nvalues_332, 4);
YAP_UserCPredicate("gecode_constraint_binpacking_54", gecode_constraint_binpacking_54, 4);
YAP_UserCPredicate("gecode_constraint_linear_275", gecode_constraint_linear_275, 7);
YAP_UserCPredicate("gecode_constraint_linear_279", gecode_constraint_linear_279, 7);
YAP_UserCPredicate("gecode_constraint_linear_267", gecode_constraint_linear_267, 7);
YAP_UserCPredicate("gecode_constraint_linear_271", gecode_constraint_linear_271, 7);
YAP_UserCPredicate("gecode_constraint_abs_52", gecode_constraint_abs_52, 4);
YAP_UserCPredicate("gecode_constraint_convex_90", gecode_constraint_convex_90, 2);
YAP_UserCPredicate("gecode_constraint_div_163", gecode_constraint_div_163, 4);
YAP_UserCPredicate("gecode_constraint_div_162", gecode_constraint_div_162, 4);
YAP_UserCPredicate("gecode_constraint_rel_402", gecode_constraint_rel_402, 6);
YAP_UserCPredicate("gecode_constraint_rel_406", gecode_constraint_rel_406, 6);
YAP_UserCPredicate("gecode_constraint_rel_385", gecode_constraint_rel_385, 6);
YAP_UserCPredicate("gecode_constraint_rel_386", gecode_constraint_rel_386, 6);
YAP_UserCPredicate("gecode_constraint_rel_374", gecode_constraint_rel_374, 6);
YAP_UserCPredicate("gecode_constraint_rel_370", gecode_constraint_rel_370, 6);
YAP_UserCPredicate("gecode_constraint_rel_366", gecode_constraint_rel_366, 6);
YAP_UserCPredicate("gecode_constraint_rel_364", gecode_constraint_rel_364, 6);
YAP_UserCPredicate("gecode_constraint_rel_415", gecode_constraint_rel_415, 6);
YAP_UserCPredicate("gecode_constraint_rel_416", gecode_constraint_rel_416, 6);
YAP_UserCPredicate("gecode_constraint_rel_417", gecode_constraint_rel_417, 6);
YAP_UserCPredicate("gecode_constraint_rel_418", gecode_constraint_rel_418, 6);
YAP_UserCPredicate("gecode_constraint_weights_455", gecode_constraint_weights_455, 5);
YAP_UserCPredicate("gecode_constraint_max_293", gecode_constraint_max_293, 5);
YAP_UserCPredicate("gecode_constraint_path_343", gecode_constraint_path_343, 9);
YAP_UserCPredicate("gecode_constraint_unary_449", gecode_constraint_unary_449, 4);
YAP_UserCPredicate("gecode_constraint_unary_445", gecode_constraint_unary_445, 4);
YAP_UserCPredicate("gecode_constraint_unary_439", gecode_constraint_unary_439, 4);
YAP_UserCPredicate("gecode_constraint_unary_442", gecode_constraint_unary_442, 4);
YAP_UserCPredicate("gecode_constraint_nroot_328", gecode_constraint_nroot_328, 4);
YAP_UserCPredicate("gecode_constraint_nroot_327", gecode_constraint_nroot_327, 4);
YAP_UserCPredicate("gecode_constraint_sorted_430", gecode_constraint_sorted_430, 5);
YAP_UserCPredicate("gecode_constraint_circuit_80", gecode_constraint_circuit_80, 5);
YAP_UserCPredicate("gecode_constraint_circuit_77", gecode_constraint_circuit_77, 5);
YAP_UserCPredicate("gecode_constraint_circuit_74", gecode_constraint_circuit_74, 5);
YAP_UserCPredicate("gecode_constraint_dom_189", gecode_constraint_dom_189, 4);
YAP_UserCPredicate("gecode_constraint_dom_186", gecode_constraint_dom_186, 4);
YAP_UserCPredicate("gecode_constraint_dom_172", gecode_constraint_dom_172, 4);
YAP_UserCPredicate("gecode_constraint_dom_170", gecode_constraint_dom_170, 4);
YAP_UserCPredicate("gecode_constraint_dom_168", gecode_constraint_dom_168, 4);
YAP_UserCPredicate("gecode_constraint_dom_180", gecode_constraint_dom_180, 4);
YAP_UserCPredicate("gecode_constraint_dom_179", gecode_constraint_dom_179, 4);
YAP_UserCPredicate("gecode_constraint_dom_177", gecode_constraint_dom_177, 4);
YAP_UserCPredicate("gecode_constraint_dom_175", gecode_constraint_dom_175, 4);
YAP_UserCPredicate("gecode_constraint_dom_197", gecode_constraint_dom_197, 4);
YAP_UserCPredicate("gecode_constraint_dom_201", gecode_constraint_dom_201, 4);
YAP_UserCPredicate("gecode_constraint_dom_196", gecode_constraint_dom_196, 4);
YAP_UserCPredicate("gecode_constraint_dom_204", gecode_constraint_dom_204, 4);
YAP_UserCPredicate("gecode_constraint_dom_193", gecode_constraint_dom_193, 4);
YAP_UserCPredicate("gecode_constraint_dom_192", gecode_constraint_dom_192, 4);
YAP_UserCPredicate("gecode_constraint_dom_184", gecode_constraint_dom_184, 4);
YAP_UserCPredicate("gecode_constraint_dom_183", gecode_constraint_dom_183, 4);
YAP_UserCPredicate("gecode_constraint_dom_207", gecode_constraint_dom_207, 4);
YAP_UserCPredicate("gecode_constraint_dom_205", gecode_constraint_dom_205, 4);
YAP_UserCPredicate("gecode_constraint_abs_51", gecode_constraint_abs_51, 3);
YAP_UserCPredicate("gecode_constraint_abs_50", gecode_constraint_abs_50, 3);
YAP_UserCPredicate("gecode_constraint_channel_68", gecode_constraint_channel_68, 5);
YAP_UserCPredicate("gecode_constraint_channel_63", gecode_constraint_channel_63, 5);
YAP_UserCPredicate("gecode_constraint_assign_8", gecode_constraint_assign_8, 5);
YAP_UserCPredicate("gecode_constraint_assign_5", gecode_constraint_assign_5, 5);
YAP_UserCPredicate("gecode_constraint_assign_11", gecode_constraint_assign_11, 5);
YAP_UserCPredicate("gecode_constraint_assign_14", gecode_constraint_assign_14, 5);
YAP_UserCPredicate("gecode_constraint_rel_389", gecode_constraint_rel_389, 3);
YAP_UserCPredicate("gecode_constraint_rel_379", gecode_constraint_rel_379, 3);
YAP_UserCPredicate("gecode_constraint_path_346", gecode_constraint_path_346, 4);
YAP_UserCPredicate("gecode_constraint_branch_45", gecode_constraint_branch_45, 4);
YAP_UserCPredicate("gecode_constraint_branch_29", gecode_constraint_branch_29, 4);
YAP_UserCPredicate("gecode_constraint_branch_23", gecode_constraint_branch_23, 4);
YAP_UserCPredicate("gecode_constraint_branch_22", gecode_constraint_branch_22, 4);
YAP_UserCPredicate("gecode_constraint_branch_35", gecode_constraint_branch_35, 4);
YAP_UserCPredicate("gecode_constraint_branch_47", gecode_constraint_branch_47, 4);
YAP_UserCPredicate("gecode_constraint_branch_41", gecode_constraint_branch_41, 4);
YAP_UserCPredicate("gecode_constraint_branch_49", gecode_constraint_branch_49, 4);
YAP_UserCPredicate("gecode_constraint_mult_316", gecode_constraint_mult_316, 5);
YAP_UserCPredicate("gecode_constraint_circuit_81", gecode_constraint_circuit_81, 6);
YAP_UserCPredicate("gecode_constraint_circuit_78", gecode_constraint_circuit_78, 6);
YAP_UserCPredicate("gecode_constraint_circuit_75", gecode_constraint_circuit_75, 6);
YAP_UserCPredicate("gecode_constraint_clause_88", gecode_constraint_clause_88, 5);
YAP_UserCPredicate("gecode_constraint_clause_86", gecode_constraint_clause_86, 5);
YAP_UserCPredicate("gecode_constraint_precede_358", gecode_constraint_precede_358, 4);
YAP_UserCPredicate("gecode_constraint_precede_355", gecode_constraint_precede_355, 4);
YAP_UserCPredicate("gecode_constraint_precede_354", gecode_constraint_precede_354, 4);
YAP_UserCPredicate("gecode_constraint_channel_69", gecode_constraint_channel_69, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_126", gecode_constraint_cumulative_126, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_129", gecode_constraint_cumulative_129, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_122", gecode_constraint_cumulative_122, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_125", gecode_constraint_cumulative_125, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_119", gecode_constraint_cumulative_119, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_138", gecode_constraint_cumulative_138, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_141", gecode_constraint_cumulative_141, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_134", gecode_constraint_cumulative_134, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_137", gecode_constraint_cumulative_137, 7);
YAP_UserCPredicate("gecode_constraint_cumulative_131", gecode_constraint_cumulative_131, 7);
YAP_UserCPredicate("gecode_constraint_distinct_161", gecode_constraint_distinct_161, 3);
YAP_UserCPredicate("gecode_constraint_distinct_158", gecode_constraint_distinct_158, 3);
YAP_UserCPredicate("gecode_constraint_member_303", gecode_constraint_member_303, 5);
YAP_UserCPredicate("gecode_constraint_member_299", gecode_constraint_member_299, 5);
YAP_UserCPredicate("gecode_constraint_mod_312", gecode_constraint_mod_312, 4);
YAP_UserCPredicate("gecode_constraint_sqr_434", gecode_constraint_sqr_434, 3);
YAP_UserCPredicate("gecode_constraint_sqr_433", gecode_constraint_sqr_433, 3);
YAP_UserCPredicate("gecode_constraint_sequence_426", gecode_constraint_sequence_426, 7);
YAP_UserCPredicate("gecode_constraint_sequence_424", gecode_constraint_sequence_424, 7);
YAP_UserCPredicate("gecode_constraint_path_344", gecode_constraint_path_344, 7);
YAP_UserCPredicate("gecode_constraint_path_341", gecode_constraint_path_341, 7);
YAP_UserCPredicate("gecode_constraint_path_338", gecode_constraint_path_338, 7);
YAP_UserCPredicate("gecode_constraint_divmod_166", gecode_constraint_divmod_166, 6);
YAP_UserCPredicate("gecode_constraint_sorted_431", gecode_constraint_sorted_431, 3);
YAP_UserCPredicate("gecode_constraint_circuit_84", gecode_constraint_circuit_84, 3);
YAP_UserCPredicate("gecode_constraint_circuit_83", gecode_constraint_circuit_83, 3);
YAP_UserCPredicate("gecode_constraint_channel_71", gecode_constraint_channel_71, 3);
YAP_UserCPredicate("gecode_constraint_channel_61", gecode_constraint_channel_61, 3);
YAP_UserCPredicate("gecode_constraint_channel_64", gecode_constraint_channel_64, 3);
YAP_UserCPredicate("gecode_constraint_channel_59", gecode_constraint_channel_59, 3);
YAP_UserCPredicate("gecode_constraint_channel_67", gecode_constraint_channel_67, 3);
YAP_UserCPredicate("gecode_constraint_channel_65", gecode_constraint_channel_65, 3);
YAP_UserCPredicate("gecode_constraint_channel_72", gecode_constraint_channel_72, 3);
YAP_UserCPredicate("gecode_constraint_channel_70", gecode_constraint_channel_70, 3);
YAP_UserCPredicate("gecode_constraint_count_92", gecode_constraint_count_92, 5);
YAP_UserCPredicate("gecode_constraint_count_94", gecode_constraint_count_94, 5);
YAP_UserCPredicate("gecode_constraint_count_110", gecode_constraint_count_110, 5);
YAP_UserCPredicate("gecode_constraint_count_112", gecode_constraint_count_112, 5);
YAP_UserCPredicate("gecode_constraint_count_102", gecode_constraint_count_102, 5);
YAP_UserCPredicate("gecode_constraint_count_104", gecode_constraint_count_104, 5);
YAP_UserCPredicate("gecode_constraint_count_101", gecode_constraint_count_101, 5);
YAP_UserCPredicate("gecode_constraint_count_97", gecode_constraint_count_97, 5);
YAP_UserCPredicate("gecode_constraint_count_107", gecode_constraint_count_107, 5);
YAP_UserCPredicate("gecode_constraint_count_114", gecode_constraint_count_114, 5);
YAP_UserCPredicate("gecode_constraint_count_116", gecode_constraint_count_116, 5);
YAP_UserCPredicate("gecode_constraint_cumulatives_156", gecode_constraint_cumulatives_156, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_154", gecode_constraint_cumulatives_154, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_152", gecode_constraint_cumulatives_152, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_150", gecode_constraint_cumulatives_150, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_148", gecode_constraint_cumulatives_148, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_146", gecode_constraint_cumulatives_146, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_144", gecode_constraint_cumulatives_144, 8);
YAP_UserCPredicate("gecode_constraint_cumulatives_142", gecode_constraint_cumulatives_142, 8);
YAP_UserCPredicate("gecode_constraint_binpacking_55", gecode_constraint_binpacking_55, 5);
YAP_UserCPredicate("gecode_constraint_linear_283", gecode_constraint_linear_283, 6);
YAP_UserCPredicate("gecode_constraint_linear_287", gecode_constraint_linear_287, 6);
YAP_UserCPredicate("gecode_constraint_linear_251", gecode_constraint_linear_251, 6);
YAP_UserCPredicate("gecode_constraint_linear_255", gecode_constraint_linear_255, 6);
YAP_UserCPredicate("gecode_constraint_linear_259", gecode_constraint_linear_259, 6);
YAP_UserCPredicate("gecode_constraint_linear_257", gecode_constraint_linear_257, 6);
YAP_UserCPredicate("gecode_constraint_linear_274", gecode_constraint_linear_274, 6);
YAP_UserCPredicate("gecode_constraint_linear_273", gecode_constraint_linear_273, 6);
YAP_UserCPredicate("gecode_constraint_linear_278", gecode_constraint_linear_278, 6);
YAP_UserCPredicate("gecode_constraint_linear_277", gecode_constraint_linear_277, 6);
YAP_UserCPredicate("gecode_constraint_linear_266", gecode_constraint_linear_266, 6);
YAP_UserCPredicate("gecode_constraint_linear_265", gecode_constraint_linear_265, 6);
YAP_UserCPredicate("gecode_constraint_linear_270", gecode_constraint_linear_270, 6);
YAP_UserCPredicate("gecode_constraint_linear_269", gecode_constraint_linear_269, 6);
YAP_UserCPredicate("gecode_constraint_nooverlap_323", gecode_constraint_nooverlap_323, 7);
YAP_UserCPredicate("gecode_constraint_nooverlap_318", gecode_constraint_nooverlap_318, 7);
YAP_UserCPredicate("gecode_constraint_div_164", gecode_constraint_div_164, 5);
YAP_UserCPredicate("gecode_constraint_sqr_435", gecode_constraint_sqr_435, 4);
YAP_UserCPredicate("gecode_constraint_path_345", gecode_constraint_path_345, 8);
YAP_UserCPredicate("gecode_constraint_path_342", gecode_constraint_path_342, 8);
YAP_UserCPredicate("gecode_constraint_path_339", gecode_constraint_path_339, 8);
YAP_UserCPredicate("gecode_constraint_unary_447", gecode_constraint_unary_447, 5);
YAP_UserCPredicate("gecode_constraint_unary_450", gecode_constraint_unary_450, 5);
YAP_UserCPredicate("gecode_constraint_unary_443", gecode_constraint_unary_443, 5);
YAP_UserCPredicate("gecode_constraint_unary_446", gecode_constraint_unary_446, 5);
YAP_UserCPredicate("gecode_constraint_unary_440", gecode_constraint_unary_440, 5);
YAP_UserCPredicate("gecode_constraint_sorted_429", gecode_constraint_sorted_429, 4);
YAP_UserCPredicate("gecode_constraint_sorted_432", gecode_constraint_sorted_432, 4);
YAP_UserCPredicate("gecode_constraint_element_223", gecode_constraint_element_223, 8);
YAP_UserCPredicate("gecode_constraint_element_217", gecode_constraint_element_217, 8);
YAP_UserCPredicate("gecode_constraint_element_235", gecode_constraint_element_235, 8);
YAP_UserCPredicate("gecode_constraint_element_233", gecode_constraint_element_233, 8);
YAP_UserCPredicate("gecode_constraint_assign_16", gecode_constraint_assign_16, 4);
YAP_UserCPredicate("gecode_constraint_assign_7", gecode_constraint_assign_7, 4);
YAP_UserCPredicate("gecode_constraint_assign_4", gecode_constraint_assign_4, 4);
YAP_UserCPredicate("gecode_constraint_assign_2", gecode_constraint_assign_2, 4);
YAP_UserCPredicate("gecode_constraint_assign_10", gecode_constraint_assign_10, 4);
YAP_UserCPredicate("gecode_constraint_assign_18", gecode_constraint_assign_18, 4);
YAP_UserCPredicate("gecode_constraint_assign_13", gecode_constraint_assign_13, 4);
YAP_UserCPredicate("gecode_constraint_assign_20", gecode_constraint_assign_20, 4);
YAP_UserCPredicate("gecode_constraint_element_221", gecode_constraint_element_221, 5);
YAP_UserCPredicate("gecode_constraint_element_225", gecode_constraint_element_225, 5);
YAP_UserCPredicate("gecode_constraint_element_215", gecode_constraint_element_215, 5);
YAP_UserCPredicate("gecode_constraint_element_213", gecode_constraint_element_213, 5);
YAP_UserCPredicate("gecode_constraint_element_244", gecode_constraint_element_244, 5);
YAP_UserCPredicate("gecode_constraint_element_242", gecode_constraint_element_242, 5);
YAP_UserCPredicate("gecode_constraint_element_240", gecode_constraint_element_240, 5);
YAP_UserCPredicate("gecode_constraint_element_238", gecode_constraint_element_238, 5);
YAP_UserCPredicate("gecode_constraint_element_231", gecode_constraint_element_231, 5);
YAP_UserCPredicate("gecode_constraint_element_237", gecode_constraint_element_237, 5);
YAP_UserCPredicate("gecode_constraint_element_229", gecode_constraint_element_229, 5);
YAP_UserCPredicate("gecode_constraint_sequence_428", gecode_constraint_sequence_428, 3);
YAP_UserCPredicate("gecode_constraint_branch_30", gecode_constraint_branch_30, 5);
YAP_UserCPredicate("gecode_constraint_branch_26", gecode_constraint_branch_26, 5);
YAP_UserCPredicate("gecode_constraint_branch_24", gecode_constraint_branch_24, 5);
YAP_UserCPredicate("gecode_constraint_branch_32", gecode_constraint_branch_32, 5);
YAP_UserCPredicate("gecode_constraint_branch_36", gecode_constraint_branch_36, 5);
YAP_UserCPredicate("gecode_constraint_branch_42", gecode_constraint_branch_42, 5);
YAP_UserCPredicate("gecode_constraint_branch_38", gecode_constraint_branch_38, 5);
YAP_UserCPredicate("gecode_constraint_circuit_79", gecode_constraint_circuit_79, 7);
YAP_UserCPredicate("gecode_constraint_pow_351", gecode_constraint_pow_351, 4);
YAP_UserCPredicate("gecode_constraint_pow_350", gecode_constraint_pow_350, 4);
YAP_UserCPredicate("gecode_constraint_precede_357", gecode_constraint_precede_357, 3);
YAP_UserCPredicate("gecode_constraint_precede_353", gecode_constraint_precede_353, 3);
YAP_UserCPredicate("gecode_constraint_cumulative_128", gecode_constraint_cumulative_128, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_124", gecode_constraint_cumulative_124, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_118", gecode_constraint_cumulative_118, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_121", gecode_constraint_cumulative_121, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_140", gecode_constraint_cumulative_140, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_136", gecode_constraint_cumulative_136, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_130", gecode_constraint_cumulative_130, 6);
YAP_UserCPredicate("gecode_constraint_cumulative_133", gecode_constraint_cumulative_133, 6);
YAP_UserCPredicate("gecode_constraint_distinct_159", gecode_constraint_distinct_159, 4);
YAP_UserCPredicate("gecode_constraint_min_304", gecode_constraint_min_304, 3);
YAP_UserCPredicate("gecode_constraint_min_305", gecode_constraint_min_305, 3);
YAP_UserCPredicate("gecode_constraint_min_310", gecode_constraint_min_310, 3);
YAP_UserCPredicate("gecode_constraint_sqrt_438", gecode_constraint_sqrt_438, 4);
YAP_UserCPredicate("gecode_constraint_sequence_425", gecode_constraint_sequence_425, 6);
YAP_UserCPredicate("gecode_constraint_sequence_423", gecode_constraint_sequence_423, 6);
YAP_UserCPredicate("gecode_constraint_unshare_454", gecode_constraint_unshare_454, 3);
YAP_UserCPredicate("gecode_constraint_unshare_452", gecode_constraint_unshare_452, 3);
YAP_UserCPredicate("gecode_constraint_path_349", gecode_constraint_path_349, 6);
YAP_UserCPredicate("gecode_constraint_path_340", gecode_constraint_path_340, 6);
YAP_UserCPredicate("gecode_constraint_divmod_165", gecode_constraint_divmod_165, 5);
YAP_UserCPredicate("gecode_constraint_branch_31", gecode_constraint_branch_31, 6);
YAP_UserCPredicate("gecode_constraint_branch_27", gecode_constraint_branch_27, 6);
YAP_UserCPredicate("gecode_constraint_branch_25", gecode_constraint_branch_25, 6);
YAP_UserCPredicate("gecode_constraint_branch_33", gecode_constraint_branch_33, 6);
YAP_UserCPredicate("gecode_constraint_branch_37", gecode_constraint_branch_37, 6);
YAP_UserCPredicate("gecode_constraint_branch_43", gecode_constraint_branch_43, 6);
YAP_UserCPredicate("gecode_constraint_branch_39", gecode_constraint_branch_39, 6);
YAP_UserCPredicate("gecode_constraint_nooverlap_322", gecode_constraint_nooverlap_322, 9);
YAP_UserCPredicate("gecode_constraint_cumulative_120", gecode_constraint_cumulative_120, 5);
YAP_UserCPredicate("gecode_constraint_cumulative_132", gecode_constraint_cumulative_132, 5);
YAP_UserCPredicate("gecode_constraint_member_300", gecode_constraint_member_300, 3);
YAP_UserCPredicate("gecode_constraint_member_296", gecode_constraint_member_296, 3);
YAP_UserCPredicate("gecode_constraint_count_111", gecode_constraint_count_111, 6);
YAP_UserCPredicate("gecode_constraint_count_113", gecode_constraint_count_113, 6);
YAP_UserCPredicate("gecode_constraint_count_115", gecode_constraint_count_115, 6);
YAP_UserCPredicate("gecode_constraint_count_117", gecode_constraint_count_117, 6);
YAP_UserCPredicate("gecode_constraint_count_103", gecode_constraint_count_103, 6);
YAP_UserCPredicate("gecode_constraint_count_105", gecode_constraint_count_105, 6);
YAP_UserCPredicate("gecode_constraint_count_93", gecode_constraint_count_93, 6);
YAP_UserCPredicate("gecode_constraint_count_95", gecode_constraint_count_95, 6);
YAP_UserCPredicate("gecode_constraint_pow_352", gecode_constraint_pow_352, 5);
YAP_UserCPredicate("gecode_constraint_notMin_326", gecode_constraint_notMin_326, 3);
YAP_UserCPredicate("gecode_constraint_cumulative_127", gecode_constraint_cumulative_127, 8);
YAP_UserCPredicate("gecode_constraint_cumulative_123", gecode_constraint_cumulative_123, 8);
YAP_UserCPredicate("gecode_constraint_cumulative_139", gecode_constraint_cumulative_139, 8);
YAP_UserCPredicate("gecode_constraint_cumulative_135", gecode_constraint_cumulative_135, 8);
YAP_UserCPredicate("gecode_constraint_branch_46", gecode_constraint_branch_46, 3);
YAP_UserCPredicate("gecode_constraint_branch_21", gecode_constraint_branch_21, 3);
YAP_UserCPredicate("gecode_constraint_branch_44", gecode_constraint_branch_44, 3);
YAP_UserCPredicate("gecode_constraint_branch_48", gecode_constraint_branch_48, 3);
YAP_UserCPredicate("gecode_constraint_dom_188", gecode_constraint_dom_188, 3);
YAP_UserCPredicate("gecode_constraint_dom_190", gecode_constraint_dom_190, 3);
YAP_UserCPredicate("gecode_constraint_dom_171", gecode_constraint_dom_171, 3);
YAP_UserCPredicate("gecode_constraint_dom_173", gecode_constraint_dom_173, 3);
YAP_UserCPredicate("gecode_constraint_dom_169", gecode_constraint_dom_169, 3);
YAP_UserCPredicate("gecode_constraint_dom_167", gecode_constraint_dom_167, 3);
YAP_UserCPredicate("gecode_constraint_dom_178", gecode_constraint_dom_178, 3);
YAP_UserCPredicate("gecode_constraint_dom_176", gecode_constraint_dom_176, 3);
YAP_UserCPredicate("gecode_constraint_dom_174", gecode_constraint_dom_174, 3);
YAP_UserCPredicate("gecode_constraint_dom_195", gecode_constraint_dom_195, 3);
YAP_UserCPredicate("gecode_constraint_dom_203", gecode_constraint_dom_203, 3);
YAP_UserCPredicate("gecode_constraint_dom_191", gecode_constraint_dom_191, 3);
YAP_UserCPredicate("gecode_constraint_dom_182", gecode_constraint_dom_182, 3);
YAP_UserCPredicate("gecode_constraint_dom_211", gecode_constraint_dom_211, 3);
YAP_UserCPredicate("gecode_constraint_linear_263", gecode_constraint_linear_263, 5);
YAP_UserCPredicate("gecode_constraint_linear_261", gecode_constraint_linear_261, 5);
YAP_UserCPredicate("gecode_constraint_linear_250", gecode_constraint_linear_250, 5);
YAP_UserCPredicate("gecode_constraint_linear_249", gecode_constraint_linear_249, 5);
YAP_UserCPredicate("gecode_constraint_linear_254", gecode_constraint_linear_254, 5);
YAP_UserCPredicate("gecode_constraint_linear_253", gecode_constraint_linear_253, 5);
YAP_UserCPredicate("gecode_constraint_linear_258", gecode_constraint_linear_258, 5);
YAP_UserCPredicate("gecode_constraint_linear_256", gecode_constraint_linear_256, 5);
YAP_UserCPredicate("gecode_constraint_linear_282", gecode_constraint_linear_282, 5);
YAP_UserCPredicate("gecode_constraint_linear_281", gecode_constraint_linear_281, 5);
YAP_UserCPredicate("gecode_constraint_linear_286", gecode_constraint_linear_286, 5);
YAP_UserCPredicate("gecode_constraint_linear_285", gecode_constraint_linear_285, 5);
YAP_UserCPredicate("gecode_constraint_linear_272", gecode_constraint_linear_272, 5);
YAP_UserCPredicate("gecode_constraint_linear_276", gecode_constraint_linear_276, 5);
YAP_UserCPredicate("gecode_constraint_linear_264", gecode_constraint_linear_264, 5);
YAP_UserCPredicate("gecode_constraint_linear_268", gecode_constraint_linear_268, 5);
YAP_UserCPredicate("gecode_constraint_nooverlap_317", gecode_constraint_nooverlap_317, 6);
YAP_UserCPredicate("gecode_constraint_nooverlap_320", gecode_constraint_nooverlap_320, 6);
YAP_UserCPredicate("gecode_constraint_element_245", gecode_constraint_element_245, 6);
YAP_UserCPredicate("gecode_constraint_element_243", gecode_constraint_element_243, 6);
YAP_UserCPredicate("gecode_constraint_element_241", gecode_constraint_element_241, 6);
YAP_UserCPredicate("gecode_constraint_element_239", gecode_constraint_element_239, 6);
YAP_UserCPredicate("gecode_constraint_rel_395", gecode_constraint_rel_395, 4);
YAP_UserCPredicate("gecode_constraint_rel_397", gecode_constraint_rel_397, 4);
YAP_UserCPredicate("gecode_constraint_rel_413", gecode_constraint_rel_413, 4);
YAP_UserCPredicate("gecode_constraint_rel_411", gecode_constraint_rel_411, 4);
YAP_UserCPredicate("gecode_constraint_rel_383", gecode_constraint_rel_383, 4);
YAP_UserCPredicate("gecode_constraint_rel_384", gecode_constraint_rel_384, 4);
YAP_UserCPredicate("gecode_constraint_rel_381", gecode_constraint_rel_381, 4);
YAP_UserCPredicate("gecode_constraint_rel_377", gecode_constraint_rel_377, 4);
YAP_UserCPredicate("gecode_constraint_rel_375", gecode_constraint_rel_375, 4);
YAP_UserCPredicate("gecode_constraint_rel_380", gecode_constraint_rel_380, 4);
YAP_UserCPredicate("gecode_constraint_rel_371", gecode_constraint_rel_371, 4);
YAP_UserCPredicate("gecode_constraint_rel_367", gecode_constraint_rel_367, 4);
YAP_UserCPredicate("gecode_constraint_rel_391", gecode_constraint_rel_391, 4);
YAP_UserCPredicate("gecode_constraint_rel_393", gecode_constraint_rel_393, 4);
YAP_UserCPredicate("gecode_constraint_rel_387", gecode_constraint_rel_387, 4);
YAP_UserCPredicate("gecode_constraint_rel_390", gecode_constraint_rel_390, 4);
YAP_UserCPredicate("gecode_constraint_rel_399", gecode_constraint_rel_399, 4);
YAP_UserCPredicate("gecode_constraint_rel_403", gecode_constraint_rel_403, 4);
YAP_UserCPredicate("gecode_constraint_rel_407", gecode_constraint_rel_407, 4);
YAP_UserCPredicate("gecode_constraint_rel_408", gecode_constraint_rel_408, 4);
YAP_UserCPredicate("gecode_constraint_rel_414", gecode_constraint_rel_414, 4);
YAP_UserCPredicate("gecode_constraint_rel_419", gecode_constraint_rel_419, 4);
YAP_UserCPredicate("gecode_constraint_rel_421", gecode_constraint_rel_421, 4);
YAP_UserCPredicate("gecode_constraint_rel_361", gecode_constraint_rel_361, 4);
YAP_UserCPredicate("gecode_constraint_rel_359", gecode_constraint_rel_359, 4);
YAP_UserCPredicate("gecode_constraint_min_309", gecode_constraint_min_309, 5);
YAP_UserCPredicate("gecode_constraint_count_108", gecode_constraint_count_108, 3);
YAP_UserCPredicate("gecode_constraint_count_98", gecode_constraint_count_98, 3);
YAP_UserCPredicate("gecode_constraint_ite_247", gecode_constraint_ite_247, 6);

View File

@ -45,12 +45,12 @@ SOBJS=gecode_yap.@SO@
GECODE_VERSION = @GECODE_VERSION@
DISJUNCTOR = -DDISJUNCTOR
GECODE_LIBS = @GECODE_EXTRALIBS@
GECODE_MAJOR = @GECODE_MAJOR@
all: $(SOBJS) gecode.yap
gecode_yap.o: \
$(srcdir)/gecode_yap.cc \
$(srcdir)/gecode-common.icc \
$(srcdir)/gecode$(GECODE_MAJOR)_yap.cc \
$(srcdir)/gecode$(GECODE_MAJOR)-common.icc \
$(srcdir)/$(GECODE_VERSION)/gecode_yap_cc_impl_auto_generated.icc \
$(srcdir)/$(GECODE_VERSION)/gecode_yap_cc_init_auto_generated.icc \
$(srcdir)/$(GECODE_VERSION)/gecode_yap_cc_forward_auto_generated.icc \
@ -61,7 +61,7 @@ gecode_yap.o: \
@DO_SECOND_LD@gecode_yap.@SO@: gecode_yap.o
@DO_SECOND_LD@ @SHLIB_CXX_LD@ -o gecode_yap.@SO@ gecode_yap.o $(LDFLAGS) $(GECODE_LIBS) @EXTRA_LIBS_FOR_DLLS@
gecode.yap: $(srcdir)/gecode_yap_hand_written.yap $(srcdir)/$(GECODE_VERSION)/gecode_yap_auto_generated.yap
gecode.yap: $(srcdir)/gecode$(GECODE_MAJOR)_yap_hand_written.yap $(srcdir)/$(GECODE_VERSION)/gecode_yap_auto_generated.yap
cat $^ > $@
.PHONY: all clean install

View File

@ -195,6 +195,9 @@ class PredGenerator(DeclsLoader):
"VarBranchOptions",
"ValBranchOptions",
"TieBreakVarBranch<IntVarBranch>",
"TieBreak<IntVarBranch>",
"TieBreak<FloatVarBranch>",
"TieBreak<SetVarBranch>",
"TieBreakVarBranchOptions",
"TieBreakVarBranch<SetVarBranch>")
@ -616,16 +619,21 @@ class CCDescriptor(object):
print "{"
i = 1
args = []
has_space = False
for t in self.argtypes:
v = "X%d" % i
a = "YAP_ARG%d" % i
if t=="Space":
v = "*space"
print " GenericSpace* space = gecode_Space_from_term(%s);" % a
has_space = True
else:
extra = ""
if t in ("IntVar","BoolVar","SetVar","IntVarArgs","BoolVarArgs","SetVarArgs"):
if t in ("IntVar","BoolVar","SetVar","FloatVar","IntVarArgs","BoolVarArgs","SetVarArgs","FloatVarArgs"):
extra = "space,"
if has_space == False:
print " GenericSpace* space = gecode_Space_from_term(%s);" % a
has_space = True
print " %s %s = gecode_%s_from_term(%s%s);" % (t,v,t,extra,a)
args.append(v)
i += 1

View File

@ -9,6 +9,8 @@ all: $(PROTOTYPES) $(ENUMS)
$(PROTOTYPES): % : xml/namespaceGecode.xml extract-prototypes.xsl
cat notice.hh > $@ || { rm -f $@; exit 1; }
xsltproc extract-prototypes.xsl $< \
| grep EXPORT \
| grep -v Symmetry \
| sed 's/Gecode:://g' \
| sed 's/< /</g' \
| sed 's/ >/>/g' \
@ -16,6 +18,7 @@ $(PROTOTYPES): % : xml/namespaceGecode.xml extract-prototypes.xsl
| sed 's/, /,/g' \
| sed 's/forceinline //g' \
| sed 's/GECODE_INT_EXPORT //g' \
| sed 's/GECODE_FLOAT_EXPORT //g' \
| sed 's/GECODE_SET_EXPORT //g' \
| grep -v '*' | sort >> $@ || { rm -f $@; exit 1; }

View File

@ -0,0 +1,397 @@
// -*- c++ -*-
//=============================================================================
// Copyright (C) 2011 by Denys Duchier
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//=============================================================================
#ifndef GECODE_COMMON
#define GECODE_COMMON
#include "gecode/driver.hh"
#include "gecode/int.hh"
#include "gecode/set.hh"
#include "gecode/search.hh"
#include <vector>
namespace generic_gecode
{
using namespace std;
using namespace Gecode;
// description of the optimization criterion
struct Optimizing
{
enum What { OPT_NONE, OPT_INT, OPT_RATIO };
enum How { OPT_MIN, OPT_MAX };
int num;
int den;
What what;
How how;
Optimizing(): num(-1), den(-1), what(OPT_NONE), how(OPT_MAX) {}
Optimizing(Optimizing& o)
: num(o.num), den(o.den), what(o.what), how(o.how) {}
void check_ok() const
{ if (what!=OPT_NONE)
throw Exception("gecode-python","too many optimization criteria"); }
void maximize(int i)
{ check_ok(); what = OPT_INT; how = OPT_MAX; num = i; };
void maximize(int i,int j)
{ check_ok(); what = OPT_RATIO; how = OPT_MAX; num = i; den = j; };
void minimize(int i)
{ check_ok(); what = OPT_INT; how = OPT_MIN; num = i; };
void minimize(int i,int j)
{ check_ok(); what = OPT_RATIO; how = OPT_MIN; num = i; den = j; };
};
struct GenericSpace;
struct GenericEngine
{
virtual GenericSpace* next(void)=0;
virtual ~GenericEngine() {};
};
struct GenericDFS: GenericEngine
{
DFS<GenericSpace> engine;
GenericDFS(GenericSpace* s,Search::Options& opt) : engine(s,opt) {}
virtual GenericSpace* next(void) { return engine.next(); }
};
struct GenericBAB: GenericEngine
{
BAB<GenericSpace> engine;
GenericBAB(GenericSpace* s,Search::Options& opt) : engine(s,opt) {}
virtual GenericSpace* next(void) { return engine.next(); }
};
#ifdef OLD
struct GenericRestart: GenericEngine
{
Restart<GenericSpace> engine;
GenericRestart(GenericSpace* s,Search::Options& opt): engine(s,opt) {}
virtual GenericSpace* next(void) { return engine.next(); }
};
#endif
struct LoadingDock
{
vector<IntVar> ivars;
vector<BoolVar> bvars;
vector<FloatVar> fvars;
vector<SetVar> svars;
vector<int> ikeep;
vector<int> bkeep;
vector<int> fkeep;
vector<int> skeep;
bool keeping_some() const
{
return (ikeep.size() != 0)
|| (bkeep.size() != 0)
|| (fkeep.size() != 0)
|| (skeep.size() != 0);
}
IntVar get_ivar(int i) const { return ivars[i]; }
BoolVar get_bvar(int i) const { return bvars[i]; }
FloatVar get_fvar(int i) const { return fvars[i]; }
SetVar get_svar(int i) const { return svars[i]; }
int enter_ivar(const IntVar& v)
{ ivars.push_back(v); return static_cast<int>(ivars.size()-1); }
int enter_bvar(const BoolVar& v)
{ bvars.push_back(v); return static_cast<int>(bvars.size()-1); }
int enter_fvar(const FloatVar& v)
{ fvars.push_back(v); return static_cast<int>(fvars.size()-1); }
int enter_svar(const SetVar& v)
{ svars.push_back(v); return static_cast<int>(svars.size()-1); }
int keep_ivar(int i) { ikeep.push_back(i); return static_cast<int>(ikeep.size()-1); }
int keep_bvar(int i) { bkeep.push_back(i); return static_cast<int>(bkeep.size()-1); }
int keep_fvar(int i) { fkeep.push_back(i); return static_cast<int>(fkeep.size()-1); }
int keep_svar(int i) { skeep.push_back(i); return static_cast<int>(skeep.size()-1); }
void freeze(Space& home,
IntVarArray& iarr, BoolVarArray& barr, SetVarArray& sarr, FloatVarArray& farr,
int& num, int& den)
{
if (keeping_some())
{
// make sure that optimization vars (if any) are kept
if (num != -1)
{
const int _num(num);
const int _den(den);
int n = static_cast<int>(ikeep.size());
bool num_found(false);
bool den_found(false);
for (;n--;)
{
const int idx(ikeep[n]);
if (idx==_num)
{ num_found=true; if (den_found) break; }
if (idx==_den)
{ den_found=true; if (num_found) break; }
}
if (!num_found)
{ ikeep.push_back(_num);
num=static_cast<int>(ikeep.size()-1); }
if (_den != -1 && !den_found)
{ ikeep.push_back(_den);
den=static_cast<int>(ikeep.size()-1); }
}
{ int n = static_cast<int>(ikeep.size());
iarr = IntVarArray(home, n);
for (;n--;) iarr[n]=ivars[ikeep[n]]; }
{ int n = static_cast<int>(bkeep.size());
barr = BoolVarArray(home, n);
for (;n--;) barr[n]=bvars[bkeep[n]]; }
{ int n = static_cast<int>(skeep.size());
sarr = SetVarArray(home, n);
for (;n--;) sarr[n]=svars[skeep[n]]; }
{ int n = static_cast<int>(fkeep.size());
farr = FloatVarArray(home, n);
for (;n--;) farr[n]=fvars[skeep[n]]; }
}
else
{
{ int n = static_cast<int>(ivars.size());
iarr = IntVarArray(home, n);
for (;n--;) iarr[n]=ivars[n]; }
{ int n = static_cast<int>(bvars.size());
barr = BoolVarArray(home, n);
for (;n--;) barr[n]=bvars[n]; }
{ int n = static_cast<int>(svars.size());
sarr = SetVarArray(home, n);
for (;n--;) sarr[n]=svars[n]; }
{ int n = static_cast<int>(fvars.size());
farr = FloatVarArray(home, n);
for (;n--;) farr[n]=fvars[n]; }
}
}
};
struct GenericSpace: Space
{
Optimizing optim;
IntVarArray ivars;
BoolVarArray bvars;
FloatVarArray fvars;
SetVarArray svars;
LoadingDock* dock;
bool keeping_some; // iff only SOME of the vars are kept
Space* space() { return this; }
GenericSpace(bool share, GenericSpace& s)
: Space(share, s), optim(s.optim), dock(NULL), keeping_some(s.keeping_some)
{
ivars.update(*this, share, s.ivars);
bvars.update(*this, share, s.bvars);
svars.update(*this, share, s.svars);
fvars.update(*this, share, s.fvars);
}
Space* copy(bool share)
{ freeze(); return new GenericSpace(share, *this); }
GenericSpace() : dock(new LoadingDock()), keeping_some(false) {}
~GenericSpace() { delete dock; }
// throw some C++ exception on behalf of glue code
void kaboom(const char* s)
{ throw Exception("gecode-python", s); }
int ikaboom(const char* s)
{ kaboom(s); return 0; }
// freeze the space before handing it off to a search engine
void freeze()
{
if (dock)
{
keeping_some = dock->keeping_some();
dock->freeze(*this, ivars, bvars, svars, fvars, optim.num, optim.den);
delete dock;
dock = NULL;
}
}
IntVar get_ivar(int i) const { return (dock)?dock->get_ivar(i):ivars[i]; }
BoolVar get_bvar(int i) const { return (dock)?dock->get_bvar(i):bvars[i]; }
SetVar get_svar(int i) const { return (dock)?dock->get_svar(i):svars[i]; }
FloatVar get_fvar(int i) const { return (dock)?dock->get_fvar(i):fvars[i]; }
int keep_ivar(int i)
{
if (dock) return dock->keep_ivar(i);
else return ikaboom("too late to keep");
}
int keep_bvar(int i)
{
if (dock) return dock->keep_bvar(i);
else return ikaboom("too late to keep");
}
int keep_svar(int i)
{
if (dock) return dock->keep_svar(i);
else return ikaboom("too late to keep");
}
int keep_fvar(int i)
{
if (dock) return dock->keep_fvar(i);
else return ikaboom("too late to keep");
}
bool frozen() const { return dock==NULL; }
bool has_keepers() const { return keeping_some; }
// when frozen and has_keepers: which is just has_keepers actually
bool use_keep_index() const { return has_keepers(); }
GenericEngine* new_engine(bool restart, Search::Options& opt)
{
freeze();
return (optim.what == Optimizing::OPT_NONE)
? static_cast<GenericEngine*>(new GenericDFS(this,opt))
: //(restart
// ? static_cast<GenericEngine*>(new GenericRestart(this,opt))
// :
static_cast<GenericEngine*>(new GenericBAB(this,opt));
}
int _new_ivar(IntVar& v)
{
if (dock) return dock->enter_ivar(v);
else return ikaboom("too late to create vars");
}
int new_ivar(int lo, int hi)
{
IntVar v(*this, lo, hi);
return _new_ivar(v);
}
int new_ivar(IntSet& s)
{
IntVar v(*this, s);
return _new_ivar(v);
}
int _new_fvar(FloatVar& v)
{
if (dock) return dock->enter_fvar(v);
else return ikaboom("too late to create vars");
}
int new_fvar(double lo, double hi)
{
FloatVar v(*this, lo, hi);
return _new_fvar(v);
}
int _new_bvar(BoolVar& v)
{
if (dock) return dock->enter_bvar(v);
else return ikaboom("too late to create vars");
}
int new_bvar()
{
BoolVar v(*this, 0, 1);
return _new_bvar(v);
}
int _new_svar(SetVar& v)
{
if (dock) return dock->enter_svar(v);
else return ikaboom("too late to create vars");
}
int new_svar(int glbMin, int glbMax, int lubMin, int lubMax,
unsigned int cardMin=0,
unsigned int cardMax=Set::Limits::card)
{
SetVar v(*this, glbMin, glbMax, lubMin, lubMax, cardMin, cardMax);
return _new_svar(v);
}
int new_svar(IntSet glb, int lubMin, int lubMax,
unsigned int cardMin=0,
unsigned int cardMax=Set::Limits::card)
{
SetVar v(*this, glb, lubMin, lubMax, cardMin, cardMax);
return _new_svar(v);
}
int new_svar(int glbMin, int glbMax, IntSet lub,
unsigned int cardMin=0,
unsigned int cardMax=Set::Limits::card)
{
SetVar v(*this, glbMin, glbMax, lub, cardMin, cardMax);
return _new_svar(v);
}
int new_svar(IntSet glb, IntSet lub,
unsigned int cardMin=0,
unsigned int cardMax=Set::Limits::card)
{
SetVar v(*this, glb, lub, cardMin, cardMax);
return _new_svar(v);
}
void minimize(int i) { optim.minimize(i); }
void minimize(int i, int j) { optim.minimize(i,j); }
void maximize(int i) { optim.maximize(i); }
void maximize(int i, int j) { optim.maximize(i,j); }
virtual void constrain(const Space& s)
{
const GenericSpace& sol = static_cast<const GenericSpace&>(s);
switch (optim.what)
{
case Optimizing::OPT_NONE:
break;
case Optimizing::OPT_INT:
rel(*this, ivars[optim.num],
((optim.how==Optimizing::OPT_MIN) ? IRT_LE : IRT_GR),
sol.ivars[optim.num].val());
break;
case Optimizing::OPT_RATIO:
{
IntArgs c(2, sol.ivars[optim.den].val(),
- sol.ivars[optim.num].val());
IntVarArgs v(2);
v[0] = ivars[optim.num];
v[1] = ivars[optim.den];
linear(*this, c, v,
((optim.how==Optimizing::OPT_MIN) ? IRT_LE : IRT_GR), 0);
break;
}
}
}
};
}
#ifdef DISJUNCTOR
#include "disjunctor.icc"
#endif
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

80
library/gecode/photo.yap Normal file
View File

@ -0,0 +1,80 @@
%% -*- prolog -*-
%%=============================================================================
%% Copyright (C) 2011 by Denys Duchier
%%
%% This program is free software: you can redistribute it and/or modify it
%% under the terms of the GNU Lesser General Public License as published by the
%% Free Software Foundation, either version 3 of the License, or (at your
%% option) any later version.
%%
%% This program is distributed in the hope that it will be useful, but WITHOUT
%% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
%% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
%% more details.
%%
%% You should have received a copy of the GNU Lesser General Public License
%% along with this program. If not, see <http://www.gnu.org/licenses/>.
%%=============================================================================
:- use_module(library(gecode)).
:- use_module(library(maplist)).
% 5 people want to have a photograph together, but they have preferences.
photo(Ex, Solution,Amount) :-
db(Ex, People, Preferences),
Space := space,
length(People, Len),
Len0 is Len-1,
People := intvars(Space,Len,0,Len0),
Space += distinct(People),
% Bools are the satisfied constraints
maplist(preferences(Space, Len), Preferences, Bools),
length(Preferences, PLen),
Sum := intvar(Space,0,PLen),
Space += linear(Bools,'IRT_EQ',Sum),
% add all satisfied constraints
Space += maximize(Sum),
Space += branch(People,'INT_VAR_SIZE_MIN','INT_VAL_MIN'),
SolSpace := search(Space),
Solution := val(SolSpace,People),
Amount := val(SolSpace,Sum).
%reification, use with care
preferences(Space, Len, X-Y, B) :-
NLen is -Len,
I0 := intvar(Space, NLen, Len),
I := intvar(Space, 0, Len),
B := boolvar(Space),
Space += reify(B, 'RM_EQV', R),
Space += linear([1,-1],[X,Y],'IRT_EQ', I0),
Space += abs(I0, I),
Space += rel(I, 'IRT_EQ', 1, R).
db(s,[Alice,Bob,Carl,Deb,Evan], [Alice-Carl,
Carl-Deb,
Deb-Alice,
Evan-Alice,
Bob-Evan,
Carl-Evan,
Deb-Evan,
Evan-Bob]).
db(l,[Betty,Chris,Donald,Fred,Gary,Mary,Paul,Peter,Susan],
[Betty-Donald,
Betty-Gary,
Betty-Peter,
Chris-Gary,
Chris-Susan,
Donald-Fred,
Donald-Gary,
Fred-Betty,
Fred-Gary,
Gary-Mary,
Gary-Betty,
Mary-Betty,
Mary-Susan,
Paul-Donald,
Paul-Peter,
Peter-Susan,
Peter-Paul]).

67
library/gecode/queens.yap Normal file
View File

@ -0,0 +1,67 @@
%% -*- prolog -*-
%%=============================================================================
%% Copyright (C) 2011 by Denys Duchier
%%
%% This program is free software: you can redistribute it and/or modify it
%% under the terms of the GNU Lesser General Public License as published by the
%% Free Software Foundation, either version 3 of the License, or (at your
%% option) any later version.
%%
%% This program is distributed in the hope that it will be useful, but WITHOUT
%% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
%% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
%% more details.
%%
%% You should have received a copy of the GNU Lesser General Public License
%% along with this program. If not, see <http://www.gnu.org/licenses/>.
%%=============================================================================
:- use_module(library(gecode)).
:- use_module(library(maplist)).
% use alldiff constraints
queens(N, Solution) :-
Space := space,
length(Queens, N),
Queens := intvars(Space,N,1,N),
Space += distinct(Queens),
foldl(inc, Queens, Inc, 0, _),
foldl(dec, Queens, Dec, 0, _),
Space += distinct(Inc,Queens),
Space += distinct(Dec,Queens),
Space += branch(Queens, 'INT_VAR_SIZE_MIN', 'INT_VAL_MIN'),
SolSpace := search(Space),
Solution := val(SolSpace,Queens).
inc(_, I0, I0, I) :-
I is I0+1.
dec(_, I0, I0, I) :-
I is I0-1.
%
% Using gecode linear constraints for diagonals.
%
lqueens(N, Solution) :-
Space := space,
length(Queens, N),
Queens := intvars(Space,N,1,N),
Space += distinct(Queens),
lconstrain( Queens, Space, 0),
Space += branch(Queens, 'INT_VAR_SIZE_MIN', 'INT_VAL_MIN'),
SolSpace := search(Space),
Solution := val(SolSpace,Queens).
lconstrain([], _, _).
lconstrain( [Q|Queens], Space, I0) :-
I is I0+1,
foldl(constrain(Q, I0, Space), Queens, I, _),
lconstrain( Queens, Space, I).
constrain(Q, I, Space, R, J, J1) :-
% Q+I != R+J, Q-I != R-J <=> Q-R != J-I, Q-R != I-J,
J1 is J+1,
Sum is I-J,
Diff is J-I,
Space += linear([1,-1], [Q,R], 'IRT_NQ', Diff),
Space += linear([1,-1], [Q,R], 'IRT_NQ', Sum).