initialize FloatVar
This commit is contained in:
parent
c21b5bef3c
commit
614e7ab856
@ -599,6 +599,17 @@ extern "C"
|
|||||||
return YAP_Unify(ivar, y_i);
|
return YAP_Unify(ivar, y_i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int gecode_new_floatvar_from_bounds(void)
|
||||||
|
{
|
||||||
|
YAP_Term ivar = YAP_ARG1;
|
||||||
|
GenericSpace* space = gecode_Space_from_term(YAP_ARG2);
|
||||||
|
double lo = YAP_FloatOfTerm(YAP_ARG3);
|
||||||
|
double hi = YAP_FloatOfTerm(YAP_ARG4);
|
||||||
|
int i = space->new_fvar(lo, hi);
|
||||||
|
YAP_Term y_i = YAP_MkIntTerm(i);
|
||||||
|
return YAP_Unify(ivar, y_i);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
gecode_list_length(YAP_Term l)
|
gecode_list_length(YAP_Term l)
|
||||||
{
|
{
|
||||||
@ -1707,6 +1718,8 @@ extern "C"
|
|||||||
gecode_new_intvar_from_bounds, 4);
|
gecode_new_intvar_from_bounds, 4);
|
||||||
YAP_UserCPredicate("gecode_new_intvar_from_intset",
|
YAP_UserCPredicate("gecode_new_intvar_from_intset",
|
||||||
gecode_new_intvar_from_intset, 3);
|
gecode_new_intvar_from_intset, 3);
|
||||||
|
YAP_UserCPredicate("gecode_new_floatvar_from_bounds",
|
||||||
|
gecode_new_floatvar_from_bounds, 4);
|
||||||
YAP_UserCPredicate("gecode_new_boolvar", gecode_new_boolvar, 2);
|
YAP_UserCPredicate("gecode_new_boolvar", gecode_new_boolvar, 2);
|
||||||
YAP_UserCPredicate("gecode_new_setvar_1", gecode_new_setvar_1, 8);
|
YAP_UserCPredicate("gecode_new_setvar_1", gecode_new_setvar_1, 8);
|
||||||
YAP_UserCPredicate("gecode_new_setvar_2", gecode_new_setvar_2, 7);
|
YAP_UserCPredicate("gecode_new_setvar_2", gecode_new_setvar_2, 7);
|
||||||
|
@ -410,6 +410,14 @@ new_intvar(IVar, Space, IntSet) :- !,
|
|||||||
gecode_new_intvar_from_intset(Idx,Space_,L),
|
gecode_new_intvar_from_intset(Idx,Space_,L),
|
||||||
IVar='IntVar'(Idx,-1).
|
IVar='IntVar'(Idx,-1).
|
||||||
|
|
||||||
|
new_floatvar(FVar, Space, Lo, Hi) :- !,
|
||||||
|
assert_var(IVar),
|
||||||
|
assert_is_Space_or_Clause(Space,Space_),
|
||||||
|
assert_float(Lo),
|
||||||
|
assert_float(Hi),
|
||||||
|
gecode_new_floatvar_from_bounds(Idx,Space_,Lo,Hi),
|
||||||
|
FVar='FloatVar'(Idx,-1).
|
||||||
|
|
||||||
new_boolvar(BVar, Space) :- !,
|
new_boolvar(BVar, Space) :- !,
|
||||||
assert_var(BVar),
|
assert_var(BVar),
|
||||||
assert_is_Space_or_Clause(Space,Space_),
|
assert_is_Space_or_Clause(Space,Space_),
|
||||||
|
Reference in New Issue
Block a user