本文整理汇总了C++中FloatVal::min方法的典型用法代码示例。如果您正苦于以下问题:C++ FloatVal::min方法的具体用法?C++ FloatVal::min怎么用?C++ FloatVal::min使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FloatVal
的用法示例。
在下文中一共展示了FloatVal::min方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: new
ExecStatus
ReLeFloat<View,CtrlView,rm>::post(Home home, View x, FloatVal c, CtrlView b) {
if (b.one()) {
if (rm != RM_PMI)
{
GECODE_ME_CHECK(x.lq(home,c.max()));
if (x.assigned() && (x.max() >= c.min()))
return ES_FAILED;
(void) new (home) ReLeFloat<View,CtrlView,rm>(home,x,c,b);
}
} else if (b.zero()) {
if (rm != RM_IMP)
GECODE_ME_CHECK(x.gq(home,c.min()));
} else {
switch (rtest_le(x,c)) {
case RT_TRUE:
if (rm != RM_IMP)
GECODE_ME_CHECK(b.one(home));
break;
case RT_FALSE:
if (rm != RM_PMI)
GECODE_ME_CHECK(b.zero(home));
break;
case RT_MAYBE:
(void) new (home) ReLeFloat<View,CtrlView,rm>(home,x,c,b);
break;
default: GECODE_NEVER;
}
}
return ES_OK;
}
示例2: d
forceinline ModEvent
FloatVarImp::lq(Space& home, const FloatVal& n) {
if (n.max() >= dom.max()) return ME_FLOAT_NONE;
if (n.max() < dom.min()) return ME_FLOAT_FAILED;
FloatDelta d(n.min(),dom.max());
ModEvent me = ME_FLOAT_BND;
dom = intersect(dom,FloatVal(dom.min(),n.min()));
if (assigned()) me = ME_FLOAT_VAL;
GECODE_ASSUME((me == ME_FLOAT_VAL) |
(me == ME_FLOAT_BND));
return notify(home,me,d);
}
示例3: offSet
ExecStatus
Tan<A,B>::propagate(Space& home, const ModEventDelta&) {
GECODE_ME_CHECK(x1.eq(home,tan(x0.domain())));
FloatVal iv = fmod(x0.domain(),FloatVal::pi());
FloatNum offSet(Round.sub_down(x0.min(),iv.min()));
GECODE_ES_CHECK(aTanProject(x1,iv));
GECODE_ME_CHECK(x0.eq(home,iv + offSet));
return (x0.assigned() && x1.assigned()) ? home.ES_SUBSUMED(*this) : ES_FIX;
}
示例4: estimate
void
estimate(Term* t, int n, FloatVal c, FloatNum& l, FloatNum &u) {
FloatVal est = c;
for (int i=n; i--; )
est += t[i].a * t[i].x.domain();
FloatNum min = est.min();
FloatNum max = est.max();
if (min < Limits::min)
min = Limits::min;
if (min > Limits::max)
min = Limits::max;
l = min;
if (max < Limits::min)
max = Limits::min;
if (max > Limits::max)
max = Limits::max;
u = max;
}
示例5: aTanProject
ExecStatus aTanProject(const V& aTanIv, FloatVal& iv) {
#define I0__PI_2I FloatVal(0,pi_half_upper())
#define IPI_2__PII FloatVal(pi_half_lower(),pi_upper())
#define POS(X) ((I0__PI_2I.in(X))?0:1)
#define CASE(X,Y) case ((X << 2) | Y) :
#define SHIFTN_UP(N,X) Round.add_up(Round.mul_up(N,pi_upper()),X)
#define GROWING(I) Round.tan_down(iv.min()) <= Round.tan_up(iv.max())
#define ATANINF_DOWN Round.atan_down(aTanIv.min())
#define ATANSUP_UP Round.atan_up(aTanIv.max())
#define PI_UP pi_upper()
#define PI_DOWN pi_lower()
#define PI_TWICE_DOWN pi_twice_lower()
int n = iv.max() / pi_lower();
// 0 <=> in [0;PI/2]
// 1 <=> in [PI/2;PI]
switch ( (POS(iv.min()) << 2) | POS(Round.sub_up(iv.max(),Round.mul_up(n,PI_UP))) )
{
CASE(0,0)
if (GROWING(iv)) iv.assign(ATANINF_DOWN,SHIFTN_UP(n,ATANSUP_UP));
else if (Round.tan_down(iv.min()) <= aTanIv.max())
if (Round.tan_up(iv.max()) >= aTanIv.min()) break; // Nothing changed
else iv.assign(iv.min(),SHIFTN_UP(n-1, ATANSUP_UP));
else
if (Round.tan_up(iv.max()) >= aTanIv.min()) iv.assign(Round.add_down(PI_DOWN, ATANINF_DOWN), iv.max());
else { if (n <= 1) return ES_FAILED; else iv.assign(Round.add_down(PI_DOWN, ATANINF_DOWN), SHIFTN_UP(n-1, ATANSUP_UP)); }
break;
CASE(0,1)
if (Round.tan_down(iv.min()) <= aTanIv.max())
if (Round.tan_up(iv.max()) >= aTanIv.min()) break; // Nothing changed
else iv.assign(iv.min(), SHIFTN_UP(n,ATANSUP_UP));
else
if (Round.tan_up(iv.max()) >= aTanIv.min()) iv.assign(Round.add_down(PI_DOWN, ATANINF_DOWN), iv.max());
else { if (n <= 1) return ES_FAILED; else iv.assign(Round.add_down(PI_DOWN, ATANINF_DOWN), SHIFTN_UP(n,ATANSUP_UP)); }
break;
CASE(1,0)
iv.assign(Round.add_down(PI_DOWN, ATANINF_DOWN), SHIFTN_UP(n,ATANSUP_UP));
break;
CASE(1,1)
if (GROWING(iv)) iv.assign(Round.add_down(PI_DOWN, ATANINF_DOWN), SHIFTN_UP(n+1,ATANSUP_UP));
else if (Round.tan_down(iv.min()) <= aTanIv.max())
if (Round.tan_up(iv.max()) >= aTanIv.min()) break; // Nothing changed
else iv.assign(iv.min(), SHIFTN_UP(n,ATANSUP_UP));
else
if (Round.tan_up(iv.max()) >= aTanIv.min()) iv.assign(Round.add_down(PI_TWICE_DOWN, ATANINF_DOWN), iv.max());
else { if (n <= 1) return ES_FAILED; iv.assign(Round.add_down(PI_TWICE_DOWN, ATANINF_DOWN), SHIFTN_UP(n,ATANSUP_UP)); }
break;
default:
GECODE_NEVER;
break;
}
return ES_OK;
#undef PI_TWICE_DOWN
#undef PI_UP
#undef PI_DOWN
#undef ATANINF_DOWN
#undef ATANSUP_UP
#undef GROWING
#undef SHIFTN_UP
#undef CASE
#undef POS
#undef I0__PI_2I
#undef IPI_2__PII
}
示例6: return
forceinline FloatNum
ScaleView::med(void) const {
FloatVal c = x.med(); c *= a; return (c.min()+c.max())/2;
}
示例7:
forceinline FloatNum
ScaleView::min(void) const {
FloatVal c = x.min(); c *= a; return c.min();
}