first cut at supporting TupleSets

This commit is contained in:
Vitor Santos Costa 2013-09-11 12:29:49 +01:00
parent 46c3c4546f
commit 52c0d8a8de
5 changed files with 449 additions and 1 deletions

View File

@ -191,7 +191,6 @@ class DeclsLoader(object):
class PredGenerator(DeclsLoader): class PredGenerator(DeclsLoader):
OMIT = ("DFA", # NOT YET SUPPORTED!!! OMIT = ("DFA", # NOT YET SUPPORTED!!!
"TupleSet", # NOT YET SUPPORTED!!!
"VarBranchOptions", "VarBranchOptions",
"ValBranchOptions", "ValBranchOptions",
"TieBreakVarBranch<IntVarBranch>", "TieBreakVarBranch<IntVarBranch>",

View File

@ -0,0 +1,95 @@
# This file was automatically extracted from Gecode source files.
# It is subject to the same Copyright as the source files from which
# it is derived, and is distributed under the same Licensing conditions.
ENUM_CLASSES = []
class ScriptMode(object):
TYPE = 'ScriptMode'
ENUM = ['SM_SOLUTION','SM_TIME','SM_STAT','SM_GIST']
ENUM_CLASSES.append(ScriptMode)
class RestartMode(object):
TYPE = 'RestartMode'
ENUM = ['RM_NONE','RM_CONSTANT','RM_LINEAR','RM_LUBY','RM_GEOMETRIC']
ENUM_CLASSES.append(RestartMode)
class FloatRelType(object):
TYPE = 'FloatRelType'
ENUM = ['FRT_EQ','FRT_NQ','FRT_LQ','FRT_LE','FRT_GQ','FRT_GR']
ENUM_CLASSES.append(FloatRelType)
class ReifyMode(object):
TYPE = 'ReifyMode'
ENUM = ['RM_EQV','RM_IMP','RM_PMI']
ENUM_CLASSES.append(ReifyMode)
class IntRelType(object):
TYPE = 'IntRelType'
ENUM = ['IRT_EQ','IRT_NQ','IRT_LQ','IRT_LE','IRT_GQ','IRT_GR']
ENUM_CLASSES.append(IntRelType)
class BoolOpType(object):
TYPE = 'BoolOpType'
ENUM = ['BOT_AND','BOT_OR','BOT_IMP','BOT_EQV','BOT_XOR']
ENUM_CLASSES.append(BoolOpType)
class IntConLevel(object):
TYPE = 'IntConLevel'
ENUM = ['ICL_VAL','ICL_BND','ICL_DOM','ICL_DEF']
ENUM_CLASSES.append(IntConLevel)
class TaskType(object):
TYPE = 'TaskType'
ENUM = ['TT_FIXP','TT_FIXS','TT_FIXE']
ENUM_CLASSES.append(TaskType)
class ExtensionalPropKind(object):
TYPE = 'ExtensionalPropKind'
ENUM = ['EPK_DEF','EPK_SPEED','EPK_MEMORY']
ENUM_CLASSES.append(ExtensionalPropKind)
class ViewSelStatus(object):
TYPE = 'ViewSelStatus'
ENUM = ['VSS_BEST','VSS_BETTER','VSS_TIE','VSS_WORSE']
ENUM_CLASSES.append(ViewSelStatus)
class ExecStatus(object):
TYPE = 'ExecStatus'
ENUM = ['__ES_SUBSUMED','ES_FAILED','ES_NOFIX','ES_OK','ES_FIX','ES_NOFIX_FORCE','__ES_PARTIAL']
ENUM_CLASSES.append(ExecStatus)
class ActorProperty(object):
TYPE = 'ActorProperty'
ENUM = ['AP_DISPOSE','AP_WEAKLY']
ENUM_CLASSES.append(ActorProperty)
class SpaceStatus(object):
TYPE = 'SpaceStatus'
ENUM = ['SS_FAILED','SS_SOLVED','SS_BRANCH']
ENUM_CLASSES.append(SpaceStatus)
class SetRelType(object):
TYPE = 'SetRelType'
ENUM = ['SRT_EQ','SRT_NQ','SRT_SUB','SRT_SUP','SRT_DISJ','SRT_CMPL','SRT_LQ','SRT_LE','SRT_GQ','SRT_GR']
ENUM_CLASSES.append(SetRelType)
class SetOpType(object):
TYPE = 'SetOpType'
ENUM = ['SOT_UNION','SOT_DUNION','SOT_INTER','SOT_MINUS']
ENUM_CLASSES.append(SetOpType)

View File

@ -0,0 +1,280 @@
// This file was automatically extracted from Gecode source files.
// It is subject to the same Copyright as the source files from which
// it is derived, and is distributed under the same Licensing conditions.
BrancherHandle assign(Home,BoolVar,IntAssign,BoolVarValPrint=NULL);
BrancherHandle assign(Home,const BoolVarArgs&,IntAssign,BoolBranchFilter=NULL,BoolVarValPrint=NULL);
BrancherHandle assign(Home,const FloatVarArgs&,FloatAssign,FloatBranchFilter=NULL,FloatVarValPrint=NULL);
BrancherHandle assign(Home,const IntVarArgs&,IntAssign,IntBranchFilter=NULL,IntVarValPrint=NULL);
BrancherHandle assign(Home,const SetVarArgs&,SetAssign,SetBranchFilter=NULL,SetVarValPrint=NULL);
BrancherHandle assign(Home,FloatVar,FloatAssign,FloatVarValPrint=NULL);
BrancherHandle assign(Home,IntVar,IntAssign,IntVarValPrint=NULL);
BrancherHandle assign(Home,SetVar,SetAssign,SetVarValPrint=NULL);
BrancherHandle branch(Home,BoolVar,IntValBranch,BoolVarValPrint=NULL);
BrancherHandle branch(Home,const BoolVarArgs&,IntVarBranch,IntValBranch,BoolBranchFilter=NULL,BoolVarValPrint=NULL);
BrancherHandle branch(Home,const BoolVarArgs&,IntVarBranch,IntValBranch,const Symmetries&,BoolBranchFilter=NULL,BoolVarValPrint=NULL);
BrancherHandle branch(Home,const BoolVarArgs&,TieBreak<IntVarBranch>,IntValBranch,BoolBranchFilter=NULL,BoolVarValPrint=NULL);
BrancherHandle branch(Home,const BoolVarArgs&,TieBreak<IntVarBranch>,IntValBranch,const Symmetries&,BoolBranchFilter=NULL,BoolVarValPrint=NULL);
BrancherHandle branch(Home,const FloatVarArgs&,FloatVarBranch,FloatValBranch,FloatBranchFilter=NULL,FloatVarValPrint=NULL);
BrancherHandle branch(Home,const FloatVarArgs&,TieBreak<FloatVarBranch>,FloatValBranch,FloatBranchFilter=NULL,FloatVarValPrint=NULL);
BrancherHandle branch(Home,const IntVarArgs&,IntVarBranch,IntValBranch,const Symmetries&,IntBranchFilter=NULL,IntVarValPrint=NULL);
BrancherHandle branch(Home,const IntVarArgs&,IntVarBranch,IntValBranch,IntBranchFilter=NULL,IntVarValPrint=NULL);
BrancherHandle branch(Home,const IntVarArgs&,TieBreak<IntVarBranch>,IntValBranch,const Symmetries&,IntBranchFilter=NULL,IntVarValPrint=NULL);
BrancherHandle branch(Home,const IntVarArgs&,TieBreak<IntVarBranch>,IntValBranch,IntBranchFilter=NULL,IntVarValPrint=NULL);
BrancherHandle branch(Home,const SetVarArgs&,SetVarBranch,SetValBranch,const Symmetries&,SetBranchFilter=NULL,SetVarValPrint=NULL);
BrancherHandle branch(Home,const SetVarArgs&,SetVarBranch,SetValBranch,SetBranchFilter=NULL,SetVarValPrint=NULL);
BrancherHandle branch(Home,const SetVarArgs&,TieBreak<SetVarBranch>,SetValBranch,const Symmetries&,SetBranchFilter=NULL,SetVarValPrint=NULL);
BrancherHandle branch(Home,const SetVarArgs&,TieBreak<SetVarBranch>,SetValBranch,SetBranchFilter=NULL,SetVarValPrint=NULL);
BrancherHandle branch(Home,FloatVar,FloatValBranch,FloatVarValPrint=NULL);
BrancherHandle branch(Home,IntVar,IntValBranch,IntVarValPrint=NULL);
BrancherHandle branch(Home,SetVar,SetValBranch,SetVarValPrint=NULL);
void abs(Home,FloatVar,FloatVar);
void abs(Home,IntVar,IntVar,IntConLevel=ICL_DEF);
void atmostOne(Home,const SetVarArgs&,unsigned int);
void binpacking(Home,const IntVarArgs&,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cardinality(Home,const SetVarArgs&,unsigned int,unsigned int);
void cardinality(Home,SetVar,IntVar);
void cardinality(Home,SetVar,unsigned int,unsigned int);
void channel(Home,BoolVar,IntVar,IntConLevel=ICL_DEF);
void channel(Home,const BoolVarArgs&,IntVar,int=0,IntConLevel=ICL_DEF);
void channel(Home,const BoolVarArgs&,SetVar);
void channel(Home,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void channel(Home,const IntVarArgs&,const SetVarArgs&);
void channel(Home,const IntVarArgs&,int,const IntVarArgs&,int,IntConLevel=ICL_DEF);
void channel(Home,const SetVarArgs&,const SetVarArgs&);
void channel(Home,FloatVar,IntVar);
void channel(Home,IntVar,FloatVar);
void channelSorted(Home,const IntVarArgs&,SetVar);
void circuit(Home,const IntArgs&,const IntVarArgs&,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void circuit(Home,const IntArgs&,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void circuit(Home,const IntArgs&,int,const IntVarArgs&,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void circuit(Home,const IntArgs&,int,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void circuit(Home,const IntVarArgs&,IntConLevel=ICL_DEF);
void circuit(Home,int,const IntVarArgs&,IntConLevel=ICL_DEF);
void clause(Home,BoolOpType,const BoolVarArgs&,const BoolVarArgs&,BoolVar,IntConLevel=ICL_DEF);
void clause(Home,BoolOpType,const BoolVarArgs&,const BoolVarArgs&,int,IntConLevel=ICL_DEF);
void convex(Home,SetVar);
void convex(Home,SetVar,SetVar);
void count(Home,const IntVarArgs&,const IntArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntSetArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntSetArgs&,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntSet&,const IntArgs&,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntSet&,IntRelType,int,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntSet&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,int,IntRelType,int,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,int,IntRelType,IntVar,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,IntVar,IntRelType,int,IntConLevel=ICL_DEF);
void count(Home,const IntVarArgs&,IntVar,IntRelType,IntVar,IntConLevel=ICL_DEF);
void cumulative(Home,int,const IntVarArgs&,const IntArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,int,const IntVarArgs&,const IntArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,int,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,int,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,int,const TaskTypeArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,int,const TaskTypeArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,IntVar,const IntVarArgs&,const IntArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,IntVar,const IntVarArgs&,const IntArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,IntVar,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,IntVar,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,IntVar,const TaskTypeArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void cumulative(Home,IntVar,const TaskTypeArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntArgs&,const IntVarArgs&,const IntArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntArgs&,const IntVarArgs&,const IntArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntVarArgs&,const IntVarArgs&,const IntArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntVarArgs&,const IntVarArgs&,const IntArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void cumulatives(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntArgs&,bool,IntConLevel=ICL_DEF);
void distinct(Home,const IntArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void distinct(Home,const IntVarArgs&,IntConLevel=ICL_DEF);
void div(Home,FloatVar,FloatVar,FloatVar);
void div(Home,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void divmod(Home,IntVar,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void dom(Home,BoolVar,BoolVar,IntConLevel=ICL_DEF);
void dom(Home,const BoolVarArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void dom(Home,const FloatVarArgs&,const FloatVarArgs&);
void dom(Home,const FloatVarArgs&,FloatNum,FloatNum);
void dom(Home,const FloatVarArgs&,FloatVal);
void dom(Home,const IntVarArgs&,const IntSet&,IntConLevel=ICL_DEF);
void dom(Home,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void dom(Home,const IntVarArgs&,int,IntConLevel=ICL_DEF);
void dom(Home,const IntVarArgs&,int,int,IntConLevel=ICL_DEF);
void dom(Home,const SetVarArgs&,const SetVarArgs&);
void dom(Home,const SetVarArgs&,SetRelType,const IntSet&);
void dom(Home,const SetVarArgs&,SetRelType,int);
void dom(Home,const SetVarArgs&,SetRelType,int,int);
void dom(Home,FloatVar,FloatNum,FloatNum);
void dom(Home,FloatVar,FloatNum,FloatNum,Reify);
void dom(Home,FloatVar,FloatVal);
void dom(Home,FloatVar,FloatVal,Reify);
void dom(Home,FloatVar,FloatVar);
void dom(Home,IntVar,const IntSet&,IntConLevel=ICL_DEF);
void dom(Home,IntVar,const IntSet&,Reify,IntConLevel=ICL_DEF);
void dom(Home,IntVar,int,IntConLevel=ICL_DEF);
void dom(Home,IntVar,int,int,IntConLevel=ICL_DEF);
void dom(Home,IntVar,int,int,Reify,IntConLevel=ICL_DEF);
void dom(Home,IntVar,int,Reify,IntConLevel=ICL_DEF);
void dom(Home,IntVar,IntVar,IntConLevel=ICL_DEF);
void dom(Home,SetVar,SetRelType,const IntSet&);
void dom(Home,SetVar,SetRelType,const IntSet&,Reify);
void dom(Home,SetVar,SetRelType,int);
void dom(Home,SetVar,SetRelType,int,int);
void dom(Home,SetVar,SetRelType,int,int,Reify);
void dom(Home,SetVar,SetRelType,int,Reify);
void dom(Home,SetVar,SetVar);
void element(Home,const BoolVarArgs&,IntVar,BoolVar,IntConLevel=ICL_DEF);
void element(Home,const BoolVarArgs&,IntVar,int,IntConLevel=ICL_DEF);
void element(Home,const BoolVarArgs&,IntVar,int,IntVar,int,BoolVar,IntConLevel=ICL_DEF);
void element(Home,const IntSetArgs&,IntVar,int,IntVar,int,SetVar);
void element(Home,const IntSetArgs&,IntVar,SetVar);
void element(Home,const IntVarArgs&,IntVar,int,IntConLevel=ICL_DEF);
void element(Home,const IntVarArgs&,IntVar,int,IntVar,int,IntVar,IntConLevel=ICL_DEF);
void element(Home,const IntVarArgs&,IntVar,IntVar,IntConLevel=ICL_DEF);
void element(Home,const SetVarArgs&,IntVar,int,IntVar,int,SetVar);
void element(Home,const SetVarArgs&,IntVar,SetVar);
void element(Home,IntSharedArray,IntVar,BoolVar,IntConLevel=ICL_DEF);
void element(Home,IntSharedArray,IntVar,int,IntConLevel=ICL_DEF);
void element(Home,IntSharedArray,IntVar,int,IntVar,int,BoolVar,IntConLevel=ICL_DEF);
void element(Home,IntSharedArray,IntVar,int,IntVar,int,IntVar,IntConLevel=ICL_DEF);
void element(Home,IntSharedArray,IntVar,IntVar,IntConLevel=ICL_DEF);
void element(Home,SetOpType,const IntArgs&,SetVar,SetVar,const IntSet&=IntSet(Set::Limits::min,Set::Limits::max));
void element(Home,SetOpType,const IntSetArgs&,SetVar,SetVar,const IntSet&=IntSet(Set::Limits::min,Set::Limits::max));
void element(Home,SetOpType,const IntVarArgs&,SetVar,SetVar,const IntSet&=IntSet(Set::Limits::min,Set::Limits::max));
void element(Home,SetOpType,const SetVarArgs&,SetVar,SetVar,const IntSet&=IntSet(Set::Limits::min,Set::Limits::max));
void extensional(Home,const BoolVarArgs&,const TupleSet&,ExtensionalPropKind=EPK_DEF,IntConLevel=ICL_DEF);
void extensional(Home,const BoolVarArgs&,DFA,IntConLevel=ICL_DEF);
void extensional(Home,const IntVarArgs&,const TupleSet&,ExtensionalPropKind=EPK_DEF,IntConLevel=ICL_DEF);
void extensional(Home,const IntVarArgs&,DFA,IntConLevel=ICL_DEF);
void ite(Home,BoolVar,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void linear(Home,const BoolVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void linear(Home,const BoolVarArgs&,IntRelType,int,Reify,IntConLevel=ICL_DEF);
void linear(Home,const BoolVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void linear(Home,const BoolVarArgs&,IntRelType,IntVar,Reify,IntConLevel=ICL_DEF);
void linear(Home,const FloatValArgs&,const FloatVarArgs&,FloatRelType,FloatNum);
void linear(Home,const FloatValArgs&,const FloatVarArgs&,FloatRelType,FloatNum,Reify);
void linear(Home,const FloatValArgs&,const FloatVarArgs&,FloatRelType,FloatVar);
void linear(Home,const FloatValArgs&,const FloatVarArgs&,FloatRelType,FloatVar,Reify);
void linear(Home,const FloatVarArgs&,FloatRelType,FloatNum);
void linear(Home,const FloatVarArgs&,FloatRelType,FloatNum,Reify);
void linear(Home,const FloatVarArgs&,FloatRelType,FloatVar);
void linear(Home,const FloatVarArgs&,FloatRelType,FloatVar,Reify);
void linear(Home,const IntArgs&,const BoolVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const BoolVarArgs&,IntRelType,int,Reify,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const BoolVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const BoolVarArgs&,IntRelType,IntVar,Reify,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const IntVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const IntVarArgs&,IntRelType,int,Reify,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const IntVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void linear(Home,const IntArgs&,const IntVarArgs&,IntRelType,IntVar,Reify,IntConLevel=ICL_DEF);
void linear(Home,const IntVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void linear(Home,const IntVarArgs&,IntRelType,int,Reify,IntConLevel=ICL_DEF);
void linear(Home,const IntVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void linear(Home,const IntVarArgs&,IntRelType,IntVar,Reify,IntConLevel=ICL_DEF);
void max(Home,const FloatVarArgs&,FloatVar);
void max(Home,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void max(Home,FloatVar,FloatVar,FloatVar);
void max(Home,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void max(Home,SetVar,IntVar);
void max(Home,SetVar,IntVar,Reify);
void member(Home,const BoolVarArgs&,BoolVar,IntConLevel=ICL_DEF);
void member(Home,const BoolVarArgs&,BoolVar,Reify,IntConLevel=ICL_DEF);
void member(Home,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void member(Home,const IntVarArgs&,IntVar,Reify,IntConLevel=ICL_DEF);
void min(Home,const FloatVarArgs&,FloatVar);
void min(Home,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void min(Home,FloatVar,FloatVar,FloatVar);
void min(Home,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void min(Home,SetVar,IntVar);
void min(Home,SetVar,IntVar,Reify);
void mod(Home,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void mult(Home,FloatVar,FloatVar,FloatVar);
void mult(Home,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void nooverlap(Home,const IntVarArgs&,const IntArgs&,const IntVarArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void nooverlap(Home,const IntVarArgs&,const IntArgs&,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void nooverlap(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void nooverlap(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void notMax(Home,SetVar,IntVar);
void notMin(Home,SetVar,IntVar);
void nroot(Home,FloatVar,int,FloatVar);
void nroot(Home,IntVar,int,IntVar,IntConLevel=ICL_DEF);
void nvalues(Home,const BoolVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void nvalues(Home,const BoolVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void nvalues(Home,const IntVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void nvalues(Home,const IntVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void path(Home,const IntArgs&,const IntVarArgs&,IntVar,IntVar,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void path(Home,const IntArgs&,const IntVarArgs&,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void path(Home,const IntArgs&,int,const IntVarArgs&,IntVar,IntVar,const IntVarArgs&,IntVar,IntConLevel=ICL_DEF);
void path(Home,const IntArgs&,int,const IntVarArgs&,IntVar,IntVar,IntVar,IntConLevel=ICL_DEF);
void path(Home,const IntVarArgs&,IntVar,IntVar,IntConLevel=ICL_DEF);
void path(Home,int,const IntVarArgs&,IntVar,IntVar,IntConLevel=ICL_DEF);
void pow(Home,FloatVar,int,FloatVar);
void pow(Home,IntVar,int,IntVar,IntConLevel=ICL_DEF);
void precede(Home,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void precede(Home,const IntVarArgs&,int,int,IntConLevel=ICL_DEF);
void precede(Home,const SetVarArgs&,const IntArgs&);
void precede(Home,const SetVarArgs&,int,int);
void rel(Home,BoolOpType,const BoolVarArgs&,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,BoolOpType,const BoolVarArgs&,int,IntConLevel=ICL_DEF);
void rel(Home,BoolVar,BoolOpType,BoolVar,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,BoolVar,BoolOpType,BoolVar,int,IntConLevel=ICL_DEF);
void rel(Home,BoolVar,IntRelType,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,BoolVar,IntRelType,BoolVar,Reify,IntConLevel=ICL_DEF);
void rel(Home,BoolVar,IntRelType,int,IntConLevel=ICL_DEF);
void rel(Home,BoolVar,IntRelType,int,Reify,IntConLevel=ICL_DEF);
void rel(Home,const BoolVarArgs&,IntRelType,BoolVar,IntConLevel=ICL_DEF);
void rel(Home,const BoolVarArgs&,IntRelType,const BoolVarArgs&,IntConLevel=ICL_DEF);
void rel(Home,const BoolVarArgs&,IntRelType,IntConLevel=ICL_DEF);
void rel(Home,const BoolVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void rel(Home,const FloatVarArgs&,FloatRelType,FloatVal);
void rel(Home,const FloatVarArgs&,FloatRelType,FloatVar);
void rel(Home,const IntSet&,SetOpType,SetVar,SetRelType,const IntSet&);
void rel(Home,const IntSet&,SetOpType,SetVar,SetRelType,SetVar);
void rel(Home,const IntVarArgs&,IntRelType,const IntVarArgs&,IntConLevel=ICL_DEF);
void rel(Home,const IntVarArgs&,IntRelType,IntConLevel=ICL_DEF);
void rel(Home,const IntVarArgs&,IntRelType,int,IntConLevel=ICL_DEF);
void rel(Home,const IntVarArgs&,IntRelType,IntVar,IntConLevel=ICL_DEF);
void rel(Home,FloatVar,FloatRelType,FloatVal);
void rel(Home,FloatVar,FloatRelType,FloatVal,Reify);
void rel(Home,FloatVar,FloatRelType,FloatVar);
void rel(Home,FloatVar,FloatRelType,FloatVar,Reify);
void rel(Home,IntVar,IntRelType,int,IntConLevel=ICL_DEF);
void rel(Home,IntVar,IntRelType,int,Reify,IntConLevel=ICL_DEF);
void rel(Home,IntVar,IntRelType,IntVar,IntConLevel=ICL_DEF);
void rel(Home,IntVar,IntRelType,IntVar,Reify,IntConLevel=ICL_DEF);
void rel(Home,IntVar,IntRelType,SetVar);
void rel(Home,IntVar,SetRelType,SetVar);
void rel(Home,IntVar,SetRelType,SetVar,Reify);
void rel(Home,SetOpType,const IntVarArgs&,const IntSet&,SetVar);
void rel(Home,SetOpType,const IntVarArgs&,SetVar);
void rel(Home,SetOpType,const SetVarArgs&,const IntSet&,SetVar);
void rel(Home,SetOpType,const SetVarArgs&,SetVar);
void rel(Home,SetVar,IntRelType,IntVar);
void rel(Home,SetVar,SetOpType,const IntSet&,SetRelType,const IntSet&);
void rel(Home,SetVar,SetOpType,const IntSet&,SetRelType,SetVar);
void rel(Home,SetVar,SetOpType,SetVar,SetRelType,const IntSet&);
void rel(Home,SetVar,SetOpType,SetVar,SetRelType,SetVar);
void rel(Home,SetVar,SetRelType,IntVar);
void rel(Home,SetVar,SetRelType,IntVar,Reify);
void rel(Home,SetVar,SetRelType,SetVar);
void rel(Home,SetVar,SetRelType,SetVar,Reify);
void sequence(Home,const BoolVarArgs&,const IntSet&,int,int,int,IntConLevel=ICL_DEF);
void sequence(Home,const IntVarArgs&,const IntSet&,int,int,int,IntConLevel=ICL_DEF);
void sequence(Home,const SetVarArgs&);
void sequence(Home,const SetVarArgs&,SetVar);
void sorted(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void sorted(Home,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void sqr(Home,FloatVar,FloatVar);
void sqr(Home,IntVar,IntVar,IntConLevel=ICL_DEF);
void sqrt(Home,FloatVar,FloatVar);
void sqrt(Home,IntVar,IntVar,IntConLevel=ICL_DEF);
void unary(Home,const IntVarArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void unary(Home,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void unary(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void unary(Home,const IntVarArgs&,const IntVarArgs&,const IntVarArgs&,IntConLevel=ICL_DEF);
void unary(Home,const TaskTypeArgs&,const IntVarArgs&,const IntArgs&,const BoolVarArgs&,IntConLevel=ICL_DEF);
void unary(Home,const TaskTypeArgs&,const IntVarArgs&,const IntArgs&,IntConLevel=ICL_DEF);
void unshare(Home,BoolVarArgs&,IntConLevel=ICL_DEF);
void unshare(Home,IntVarArgs&,IntConLevel=ICL_DEF);
void weights(Home,IntSharedArray,IntSharedArray,SetVar,IntVar);

View File

@ -168,6 +168,12 @@ extern "C"
return * (SetAssign*) YAP_OpaqueObjectFromTerm(t); return * (SetAssign*) YAP_OpaqueObjectFromTerm(t);
} }
static inline TupleSet&
gecode_TupleSet_from_term(YAP_Term t)
{
return *(TupleSet *) YAP_IntOfTerm(t);
}
static inline FloatNum static inline FloatNum
gecode_FloatNum_from_term(YAP_Term t) gecode_FloatNum_from_term(YAP_Term t)
{ {
@ -1569,6 +1575,55 @@ extern "C"
return YAP_Unify(YAP_ARG4, term); return YAP_Unify(YAP_ARG4, term);
} }
static YAP_opaque_tag_t gecode_tupleset_tag;
static YAP_opaque_handler_t gecode_tupleset_handler;
static int gecode_tupleset_fail_handler(void* p)
{
//delete *(GenericSpace**)p;
return TRUE;
}
static int
gecode_tupleset_write_handler
(void *stream_, YAP_opaque_tag_t type, void *p, int flags)
{
IOSTREAM* stream = (IOSTREAM*) stream_;
Sfprintf(stream,"<tupleset %p>", p);
return TRUE;
}
static YAP_Term gecode_term_from_tupleset(TupleSet& r)
{
YAP_Term term =
YAP_NewOpaqueObject(gecode_tupleset_tag, sizeof(TupleSet *));
TupleSet *ptr =
(TupleSet*) YAP_OpaqueObjectFromTerm(term);
*ptr = r;
return term;
}
static int gecode_new_tupleset(void)
{
TupleSet ts;
YAP_Term t = YAP_ARG1;
while (YAP_IsPairTerm( t ) ) {
YAP_Term l = YAP_HeadOfTerm(t);
int n = gecode_list_length(l);
int i = 0;
IntArgs is(n);
while (YAP_IsPairTerm( l ) ) {
YAP_Term ll = YAP_HeadOfTerm(l);
is[i++] = YAP_IntOfTerm(ll);
l = YAP_TailOfTerm(l);
}
ts.add(is);
t = YAP_TailOfTerm(t);
}
ts.finalize();
return YAP_Unify(YAP_ARG2, gecode_term_from_tupleset( ts ));
}
void gecode_init(void) void gecode_init(void)
{ {
{ YAP_Atom X= YAP_LookupAtom("true"); { YAP_Atom X= YAP_LookupAtom("true");
@ -1758,6 +1813,11 @@ extern "C"
gecode_reify_handler.write_handler = gecode_reify_write_handler; gecode_reify_handler.write_handler = gecode_reify_write_handler;
gecode_reify_tag = YAP_NewOpaqueType(&gecode_reify_handler); gecode_reify_tag = YAP_NewOpaqueType(&gecode_reify_handler);
YAP_UserCPredicate("gecode_new_reify", gecode_new_reify, 4); YAP_UserCPredicate("gecode_new_reify", gecode_new_reify, 4);
// TupleSet reifications
gecode_tupleset_handler.fail_handler = gecode_tupleset_fail_handler;
gecode_tupleset_handler.write_handler = gecode_tupleset_write_handler;
gecode_tupleset_tag = YAP_NewOpaqueType(&gecode_tupleset_handler);
YAP_UserCPredicate("gecode_new_tupleset", gecode_new_tupleset, 4);
#ifdef DISJUNCTOR #ifdef DISJUNCTOR
// opaque disjunctors and clauses // opaque disjunctors and clauses
gecode_disjunctor_handler.write_handler = gecode_disjunctor_write_handler; gecode_disjunctor_handler.write_handler = gecode_disjunctor_write_handler;
@ -1848,5 +1908,8 @@ extern "C"
YAP_UserCPredicate("gecode_floatvar_max", gecode_floatvar_max, 3); YAP_UserCPredicate("gecode_floatvar_max", gecode_floatvar_max, 3);
YAP_UserCPredicate("gecode_floatvar_med", gecode_floatvar_med, 3); YAP_UserCPredicate("gecode_floatvar_med", gecode_floatvar_med, 3);
YAP_UserCPredicate("gecode_floatvar_size", gecode_floatvar_size, 3); YAP_UserCPredicate("gecode_floatvar_size", gecode_floatvar_size, 3);
// TupleSets
YAP_UserCPredicate("gecode_new_tupleset", gecode_new_tupleset, 2);
} }
} }

View File

@ -118,6 +118,10 @@ is_IntSetArgs_([H|T],[H2|T2]) :- is_IntSet(H,H2), is_IntSetArgs(T,T2).
is_IntSetArgs(X,Y) :- nonvar(X), is_IntSetArgs_(X,Y). is_IntSetArgs(X,Y) :- nonvar(X), is_IntSetArgs_(X,Y).
is_IntSetArgs(X) :- \+ \+ is_IntSetArgs(X,_). is_IntSetArgs(X) :- \+ \+ is_IntSetArgs(X,_).
is_TupleSet_('TupleSet'(L),L).
is_TupleSet(X,Y) :- nonvar(X), is_TupleSet_(X,Y).
is_TupleSet(X) :- is_TupleSet(X,_).
new_intset(X,I,J) :- intset(X,I,J). new_intset(X,I,J) :- intset(X,I,J).
new_intset(X,L) :- intset(X,L). new_intset(X,L) :- intset(X,L).
@ -150,6 +154,8 @@ assert_is_Space(X,Y) :-
is_Space(X,Y) -> true ; throw(gecode_error(expected(space))). is_Space(X,Y) -> true ; throw(gecode_error(expected(space))).
assert_is_IntSet(X,Y) :- assert_is_IntSet(X,Y) :-
is_IntSet(X,Y) -> true ; throw(gecode_error(expected(intset))). is_IntSet(X,Y) -> true ; throw(gecode_error(expected(intset))).
assert_is_TupleSet(X,Y) :-
is_TupleSet(X,Y) -> true ; throw(gecode_error(expected(tupleset))).
assert_is_IntVar(X,Y) :- assert_is_IntVar(X,Y) :-
is_IntVar(X,Y) -> true ; throw(gecode_error(expected(intvar))). is_IntVar(X,Y) -> true ; throw(gecode_error(expected(intvar))).
assert_is_BoolVar(X,Y) :- assert_is_BoolVar(X,Y) :-
@ -540,6 +546,11 @@ new_setvar(SVar,Space,X1,X2) :-
gecode_new_setvar_12(Idx,Space_,X1_,X2_), gecode_new_setvar_12(Idx,Space_,X1_,X2_),
SVar='SetVar'(Idx,-1). SVar='SetVar'(Idx,-1).
new_tuple_set( List, X1 ) :-
gecode_new_tuple_set(List, X1_),
X1 = 'TupleSet'(X1_, -1).
minimize(Space,IVar) :- minimize(Space,IVar) :-
assert_is_Space(Space,Space_), assert_is_Space(Space,Space_),
assert_is_IntVar(IVar,IVar_), assert_is_IntVar(IVar,IVar_),