本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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);
}