当前位置: 首页>>代码示例>>C++>>正文


C++ Home::failed方法代码示例

本文整理汇总了C++中Home::failed方法的典型用法代码示例。如果您正苦于以下问题:C++ Home::failed方法的具体用法?C++ Home::failed怎么用?C++ Home::failed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Home的用法示例。


在下文中一共展示了Home::failed方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: re

 void
 linear(Home home,
        const IntVarArgs& x, IntRelType r, IntVar y,
        IntConLevel icl) {
   if (home.failed()) return;
   Region re(home);
   Linear::Term<IntView>* t = re.alloc<Linear::Term<IntView> >(x.size()+1);
   for (int i = x.size(); i--; ) {
     t[i].a=1; t[i].x=x[i];
   }
   int min, max;
   estimate(t,x.size(),0,min,max);
   IntView v(y);
   switch (r) {
   case IRT_EQ:
     GECODE_ME_FAIL(v.gq(home,min)); GECODE_ME_FAIL(v.lq(home,max));
     break;
   case IRT_GQ:
     GECODE_ME_FAIL(v.lq(home,max));
     break;
   case IRT_LQ:
     GECODE_ME_FAIL(v.gq(home,min));
     break;
   default: ;
   }
   if (home.failed()) return;
   t[x.size()].a=-1; t[x.size()].x=y;
   Linear::post(home,t,x.size()+1,r,0,icl);
 }
开发者ID:Wushaowei001,项目名称:omnibus,代码行数:29,代码来源:linear-int.cpp

示例2: ArgumentSizeMismatch

 void
 linear(Home home,
        const FloatValArgs& a, const FloatVarArgs& x, FloatRelType frt, 
        FloatVar y) {
   using namespace Float;
   if (a.size() != x.size())
     throw ArgumentSizeMismatch("Float::linear");
   if (home.failed()) return;
   Region re(home);
   Linear::Term* t = re.alloc<Linear::Term>(x.size()+1);
   for (int i = x.size(); i--; ) {
     t[i].a=a[i]; t[i].x=x[i];
   }
   FloatNum min, max;
   estimate(t,x.size(),0.0,min,max);
   FloatView v(y);
   switch (frt) {
   case FRT_EQ:
     GECODE_ME_FAIL(v.gq(home,min)); GECODE_ME_FAIL(v.lq(home,max));
     break;
   case FRT_GQ: case FRT_GR:
     GECODE_ME_FAIL(v.lq(home,max));
     break;
   case FRT_LQ: case FRT_LE:
     GECODE_ME_FAIL(v.gq(home,min));
     break;
   default: ;
   }
   if (home.failed()) return;
   t[x.size()].a=-1.0; t[x.size()].x=y;
   Linear::post(home,t,x.size()+1,frt,0.0);
 }
开发者ID:MGKhKhD,项目名称:easy-IP,代码行数:32,代码来源:linear.cpp

示例3: UnknownRelation

 void
 rel(Home home, IntVar x0, IntRelType irt, IntVar x1, IntConLevel icl) {
   if (home.failed()) return;
   switch (irt) {
   case IRT_EQ:
     if ((icl == ICL_DOM) || (icl == ICL_DEF)) {
       GECODE_ES_FAIL((Rel::EqDom<IntView,IntView>::post(home,x0,x1)));
     } else {
       GECODE_ES_FAIL((Rel::EqBnd<IntView,IntView>::post(home,x0,x1)));
     }
     break;
   case IRT_NQ:
     GECODE_ES_FAIL(Rel::Nq<IntView>::post(home,x0,x1)); break;
   case IRT_GQ:
     std::swap(x0,x1); // Fall through
   case IRT_LQ:
     GECODE_ES_FAIL(Rel::Lq<IntView>::post(home,x0,x1)); break;
   case IRT_GR:
     std::swap(x0,x1); // Fall through
   case IRT_LE:
     GECODE_ES_FAIL(Rel::Le<IntView>::post(home,x0,x1)); break;
   default:
     throw UnknownRelation("Int::rel");
   }
 }
开发者ID:Wushaowei001,项目名称:gecode-clone,代码行数:25,代码来源:rel.cpp

示例4: ArgumentSizeMismatch

 void
 unary(Home home, const IntVarArgs& s, const IntVarArgs& p, 
       const IntVarArgs& e, const BoolVarArgs& m, IntConLevel icl) {
   using namespace Gecode::Int;
   using namespace Gecode::Int::Unary;
   if ((s.size() != p.size()) || (s.size() != m.size()) ||
       (s.size() != e.size()))
     throw Int::ArgumentSizeMismatch("Int::unary");
   if (home.failed()) return;
   for (int i=p.size(); i--; ) {
     rel(home, p[i], IRT_GQ, 0);
   }
   bool allMandatory = true;
   for (int i=m.size(); i--;) {
     if (!m[i].one()) {
       allMandatory = false;
       break;
     }
   }
   if (allMandatory) {
     unary(home,s,p,e,icl);
   } else {
     TaskArray<OptFlexTask> t(home,s.size());
     for (int i=s.size(); i--; )
       t[i].init(s[i],p[i],e[i],m[i]);
     GECODE_ES_FAIL(OptProp<OptFlexTask>::post(home,t));
   }
 }
开发者ID:celikpence,项目名称:gecode,代码行数:28,代码来源:unary.cpp

示例5: ArgumentSame

 void
 unary(Home home, const IntVarArgs& s, const IntArgs& p, 
       const BoolVarArgs& m, IntConLevel icl) {
   using namespace Gecode::Int;
   using namespace Gecode::Int::Unary;
   if (s.same(home))
     throw Int::ArgumentSame("Int::unary");
   if ((s.size() != p.size()) || (s.size() != m.size()))
     throw Int::ArgumentSizeMismatch("Int::unary");
   for (int i=p.size(); i--; ) {
     Int::Limits::nonnegative(p[i],"Int::unary");
     Int::Limits::check(static_cast<double>(s[i].max()) + p[i],
                        "Int::unary");
   }
   bool allMandatory = true;
   for (int i=m.size(); i--;) {
     if (!m[i].one()) {
       allMandatory = false;
       break;
     }
   }
   if (allMandatory) {
     unary(home,s,p,icl);
   } else {
     if (home.failed()) return;
     TaskArray<OptFixPTask> t(home,s.size());
     for (int i=s.size(); i--; )
       t[i].init(s[i],p[i],m[i]);
     GECODE_ES_FAIL(OptProp<OptFixPTask>::post(home,t));
   }
 }
开发者ID:celikpence,项目名称:gecode,代码行数:31,代码来源:unary.cpp

示例6: pow

 void
 pow(Home home, FloatNum base, FloatVar x0, FloatVar x1) {
   using namespace Float;
   if (home.failed()) return;
   GECODE_ES_FAIL((Transcendental::Pow<FloatView,FloatView>
     ::post(home,base,x0,x1)));
 }
开发者ID:kenhys,项目名称:gecode,代码行数:7,代码来源:arithmetic.cpp

示例7: wait

 void
 wait(Home home, const BoolVarArgs& x, void (*c)(Space& home),
      IntConLevel) {
   if (home.failed()) return;
   ViewArray<Int::BoolView> xv(home,x);
   GECODE_ES_FAIL(Kernel::NaryWait<Int::BoolView>::post(home,xv,c));
 }
开发者ID:celikpence,项目名称:gecode,代码行数:7,代码来源:exec.cpp

示例8: ArgumentSame

  void
  binpacking(Home home, 
             const IntVarArgs& l, 
             const IntVarArgs& b, const IntArgs& s,
             IntConLevel) {
    using namespace Int;
    if (l.same(home,b))
      throw ArgumentSame("Int::binpacking");
    if (b.size() != s.size())
      throw ArgumentSizeMismatch("Int::binpacking");      
    for (int i=s.size(); i--; )
      Limits::nonnegative(s[i],"Int::binpacking");
    if (home.failed()) return;

    ViewArray<OffsetView> lv(home,l.size());
    for (int i=l.size(); i--; )
      lv[i] = OffsetView(l[i],0);

    if (b.size() == 0) {
      for (int i=l.size(); i--; )
        GECODE_ME_FAIL(lv[i].eq(home,0));
      return;
    }

    ViewArray<BinPacking::Item> bs(home,b.size());
    for (int i=bs.size(); i--; )
      bs[i] = BinPacking::Item(b[i],s[i]);

    Support::quicksort(&bs[0], bs.size());

    GECODE_ES_FAIL(Int::BinPacking::Pack::post(home,lv,bs));
  }
开发者ID:Wushaowei001,项目名称:gecode-clone,代码行数:32,代码来源:bin-packing.cpp

示例9: channel

 void
 channel(Home home, const BoolVarArgs& x, SetVar y) {
   if (home.failed()) return;
   ViewArray<Int::BoolView> xv(home,x);
   GECODE_ES_FAIL((Set::Int::ChannelBool<Set::SetView>
                        ::post(home,xv,y)));
 }
开发者ID:YoshihisaMaruya,项目名称:tool_test_chef,代码行数:7,代码来源:int.cpp

示例10: _div

 void
 mod(Home home, IntVar x0, IntVar x1, IntVar x2,
     IntConLevel icl) {
   if (home.failed()) return;
   IntVar _div(home, Int::Limits::min, Int::Limits::max);
   divmod(home, x0, x1, _div, x2, icl);
 }
开发者ID:Wushaowei001,项目名称:omnibus,代码行数:7,代码来源:arithmetic.cpp

示例11: UnknownOperation

 void
 qrel(Home home, QBoolVar qx0, BoolOpType o, QBoolVar qx1, BoolVar x2) {
   using namespace Int;
   if (home.failed()) return;
   switch (o) {
   case BOT_AND:
     {
       NegBoolView n0(qx0.x); NegBoolView n1(qx1.x); NegBoolView n2(x2);
       GECODE_ES_FAIL((Bool::QOr<NegBoolView,NegBoolView,NegBoolView>
                       ::post(home,n0,qx0.q,qx0.r,n1,qx1.q,qx1.r,n2)));
     }
     break;
   case BOT_OR:
     GECODE_ES_FAIL((Bool::QOr<BoolView,BoolView,BoolView>
                     ::post(home,qx0.x,qx0.q,qx0.r,qx1.x,qx1.q,qx1.r,x2)));
     break;
   case BOT_IMP: 
     {
       NegBoolView n0(qx0.x);
       GECODE_ES_FAIL((Bool::QOr<NegBoolView,BoolView,BoolView>
                       ::post(home,n0,qx0.q,qx0.r,qx1.x,qx1.q,qx1.r,x2)));
     }
     break;
   case BOT_EQV:
     GECODE_ES_FAIL((Bool::QEqv<BoolView,BoolView,BoolView>
                     ::post(home,qx0,qx1,x2)));
     break;
   case BOT_XOR:
     GECODE_ES_FAIL((Bool::QXorv<BoolView,BoolView,BoolView>
                     ::post(home,qx0,qx1,x2)));
     break;
   default:
     throw UnknownOperation("Int::rel");
   }
 }
开发者ID:Wushaowei001,项目名称:vcp,代码行数:35,代码来源:qbool.cpp

示例12: div

 void
 div(Home home, IntVar x0, IntVar x1, IntVar x2,
     IntConLevel) {
   if (home.failed()) return;
   GECODE_ES_FAIL(
     (Arithmetic::DivBnd<IntView>::post(home,x0,x1,x2)));
 }
开发者ID:Wushaowei001,项目名称:omnibus,代码行数:7,代码来源:arithmetic.cpp

示例13: ArgumentSame

 void
 distinct(Home home, const IntArgs& c, const IntVarArgs& x,
          IntConLevel icl) {
   if (x.same(home))
     throw ArgumentSame("Int::distinct");
   if (c.size() != x.size())
     throw ArgumentSizeMismatch("Int::distinct");
   if (home.failed()) return;
   ViewArray<OffsetView> cx(home,x.size());
   for (int i = c.size(); i--; ) {
     long long int cx_min = (static_cast<long long int>(c[i]) +
                             static_cast<long long int>(x[i].min()));
     long long int cx_max = (static_cast<long long int>(c[i]) +
                             static_cast<long long int>(x[i].max()));
     Limits::check(c[i],"Int::distinct");
     Limits::check(cx_min,"Int::distinct");
     Limits::check(cx_max,"Int::distinct");
     cx[i] = OffsetView(x[i],c[i]);
   }
   switch (icl) {
   case ICL_BND:
     GECODE_ES_FAIL(Distinct::Bnd<OffsetView>::post(home,cx));
     break;
   case ICL_DOM:
     GECODE_ES_FAIL(Distinct::Dom<OffsetView>::post(home,cx));
     break;
   default:
     GECODE_ES_FAIL(Distinct::Val<OffsetView>::post(home,cx));
   }
 }
开发者ID:Wushaowei001,项目名称:crossbow,代码行数:30,代码来源:distinct.cpp

示例14: NotYetFinalized

  void
  extensional(Home home, const BoolVarArgs& x, const TupleSet& t,
              ExtensionalPropKind epk, IntConLevel) {
    using namespace Int;
    if (!t.finalized())
      throw NotYetFinalized("Int::extensional");
    if (t.arity() != x.size())
      throw ArgumentSizeMismatch("Int::extensional");
    if (home.failed()) return;

    // Construct view array
    ViewArray<BoolView> xv(home,x);
    switch (epk) {
    case EPK_SPEED:
      GECODE_ES_FAIL((Extensional::Incremental<BoolView>
                           ::post(home,xv,t)));
      break;
    default:
      if (x.same(home)) {
        GECODE_ES_FAIL((Extensional::Basic<BoolView,true>
                             ::post(home,xv,t)));
      } else {
        GECODE_ES_FAIL((Extensional::Basic<BoolView,false>
                             ::post(home,xv,t)));
      }
      break;
    }
  }
开发者ID:celikpence,项目名称:gecode,代码行数:28,代码来源:extensional.cpp

示例15: div

 void
 div(Home home, FloatVar x0, FloatVar x1, FloatVar x2) {
   using namespace Float;
   if (home.failed()) return;
   GECODE_ES_FAIL(
     (Arithmetic::Div<FloatView,FloatView,FloatView>::post(home,x0,x1,x2)));
 }
开发者ID:kenhys,项目名称:gecode,代码行数:7,代码来源:arithmetic.cpp


注:本文中的Home::failed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。