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


C++ Propagator::unlink方法代码示例

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


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

示例1: assert

 SpaceStatus
 Space::status(StatusStatistics& stat) {
   SpaceStatus s = SS_FAILED;
   // Check whether space is failed
   if (failed()) {
     s = SS_FAILED; goto exit;
   }
   assert(pc.p.active <= &pc.p.queue[PropCost::AC_MAX+1]);
   // Check whether space is stable but not failed
   if (pc.p.active >= &pc.p.queue[0]) {
     Propagator* p;
     ModEventDelta med_o;
     goto unstable;
   execute:
     stat.propagate++;
     // Keep old modification event delta
     med_o = p->u.med;
     // Clear med but leave propagator in queue
     p->u.med = 0;
     switch (p->propagate(*this,med_o)) {
     case ES_FAILED:
       // Count failure
       if (afc_enabled())
         gafc.fail(p->gafc);
       // Mark as failed
       fail(); s = SS_FAILED; goto exit;
     case ES_NOFIX:
       // Find next, if possible
       if (p->u.med != 0) {
       unstable:
         // There is at least one propagator in a queue
         do {
           assert(pc.p.active >= &pc.p.queue[0]);
           // First propagator or link back to queue
           ActorLink* fst = pc.p.active->next();
           if (pc.p.active != fst) {
             p = Propagator::cast(fst);
             goto execute;
           }
           pc.p.active--;
         } while (true);
         GECODE_NEVER;
       }
       // Fall through
     case ES_FIX:
       // Clear med and put into idle queue
       p->u.med = 0; p->unlink(); pl.head(p);
     stable_or_unstable:
       // There might be a propagator in the queue
       do {
         assert(pc.p.active >= &pc.p.queue[0]);
         // First propagator or link back to queue
         ActorLink* fst = pc.p.active->next();
         if (pc.p.active != fst) {
           p = Propagator::cast(fst);
           goto execute;
         }
       } while (--pc.p.active >= &pc.p.queue[0]);
       assert(pc.p.active < &pc.p.queue[0]);
       goto stable;
     case __ES_SUBSUMED:
       p->unlink(); rfree(p,p->u.size);
       goto stable_or_unstable;
     case __ES_PARTIAL:
       // Schedule propagator with specified propagator events
       assert(p->u.med != 0);
       enqueue(p);
       goto unstable;
     default:
       GECODE_NEVER;
     }
   }
 stable:
   /*
    * Find the next brancher that has still alternatives left
    *
    * It is important to note that branchers reporting to have no more
    * alternatives left cannot be deleted. They cannot be deleted
    * as there might be choices to be used in commit
    * that refer to one of these branchers. This e.g. happens when
    * we combine branch-and-bound search with adaptive recomputation: during
    * recomputation, a copy is constrained to be better than the currently
    * best solution, then the first half of the choices are posted,
    * and a fixpoint computed (for storing in the middle of the path). Then
    * the remaining choices are posted, and because of the additional
    * constraints that the space must be better than the previous solution,
    * the corresponding Branchers may already have no alternatives left.
    *
    * The same situation may arise due to weakly monotonic propagators.
    *
    * A brancher reporting that no more alternatives exist is exhausted.
    * All exhausted branchers will be left of the current pointer b_status.
    * Only when it is known that no more choices
    * can be used for commit an exhausted brancher can actually be deleted.
    * This becomes known when choice is called.
    */
   while (b_status != Brancher::cast(&bl))
     if (b_status->status(*this)) {
       // Brancher still has choices to generate
       s = SS_BRANCH; goto exit;
//.........这里部分代码省略.........
开发者ID:Wushaowei001,项目名称:crossbow,代码行数:101,代码来源:core.cpp


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