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


C++ Space::clone方法代码示例

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


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

示例1: mi

 Space*
 RBS::next(void) {
   if (restart) {
     restart = false;
     sslr++;
     NoGoods& ng = e->nogoods();
     // Reset number of no-goods found
     ng.ng(0);
     MetaInfo mi(stop->m_stat.restart,sslr,e->statistics().fail,last,ng);
     bool r = master->master(mi);
     stop->m_stat.nogood += ng.ng();
     if (master->status(stop->m_stat) == SS_FAILED) {
       stop->update(e->statistics());
       delete master;
       master = NULL;
       e->reset(NULL);
       return NULL;
     } else if (r) {
       stop->update(e->statistics());
       Space* slave = master;
       master = master->clone(shared_data,shared_info);
       complete = slave->slave(mi);
       e->reset(slave);
       sslr = 0;
       stop->m_stat.restart++;
     }
   }
   while (true) {
     Space* n = e->next();
     if (n != NULL) {
       // The engine found a solution
       restart = true;
       delete last;
       last = n->clone();
       return n;
     } else if ( (!complete && !e->stopped()) ||
                 (e->stopped() && stop->enginestopped()) ) {
       // The engine must perform a true restart
       // The number of the restart has been incremented in the stop object
       sslr = 0;
       NoGoods& ng = e->nogoods();
       ng.ng(0);
       MetaInfo mi(stop->m_stat.restart,sslr,e->statistics().fail,last,ng);
       (void) master->master(mi);
       stop->m_stat.nogood += ng.ng();
       long unsigned int nl = ++(*co);
       stop->limit(e->statistics(),nl);
       if (master->status(stop->m_stat) == SS_FAILED)
         return NULL;
       Space* slave = master;
       master = master->clone(shared_data,shared_info);
       complete = slave->slave(mi);
       e->reset(slave);
     } else {
       return NULL;
     }
   }
   GECODE_NEVER;
   return NULL;
 }
开发者ID:Gecode,项目名称:gecode,代码行数:60,代码来源:rbs.cpp

示例2: UninitializedCutoff

 forceinline
 RBS<E,T>::RBS(T* s, const Search::Options& m_opt) {
   if (m_opt.cutoff == NULL)
     throw Search::UninitializedCutoff("RBS::RBS");
   Search::Options e_opt(m_opt.expand());
   e_opt.clone = false;
   Search::Meta::RestartStop* rs = new Search::Meta::RestartStop(m_opt.stop);
   e_opt.stop = rs;
   Space* master;
   Space* slave;
   if (s->status(rs->m_stat) == SS_FAILED) {
     rs->m_stat.fail++;
     master = NULL;
     slave  = NULL;
   } else {
     if (m_opt.clone)
       master = s->clone();
     else
       master = s;
     slave = master->clone();
     CRI cri(0,0,0,NULL,NoGoods::eng);
     slave->slave(cri);
   }
   E<T> engine(dynamic_cast<T*>(slave),e_opt);
   Search::EngineBase<T>* eb = &engine;
   Search::Engine* ee = eb->e;
   eb->e = NULL;
   e = new Search::Meta::RBS(master,rs,ee,m_opt);
 }
开发者ID:Wushaowei001,项目名称:gecode,代码行数:29,代码来源:rbs.hpp

示例3:

 forceinline bool
 CollectBest::constrain(const Space& s) {
   if (b != NULL) {
     b->constrain(s);
     if (b->status() == SS_FAILED) {
       delete b;
     } else {
       return false;
     }
   }
   b = s.clone(false);
   reporter = NULL;
   return true;
 }
开发者ID:Gecode,项目名称:gecode,代码行数:14,代码来源:pbs.hpp

示例4: NoBest

 void
 RBS::constrain(const Space& b) {
   if (!best)
     throw NoBest("RBS::constrain");
   if (last != NULL) {
     last->constrain(b);
     if (last->status() == SS_FAILED) {
       delete last;
     } else {
       return;
     }
   }
   last = b.clone();
   master->constrain(b);
   e->constrain(b);
 }
开发者ID:Gecode,项目名称:gecode,代码行数:16,代码来源:rbs.cpp


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