MCPcopy Create free account
hub / github.com/Gecode/gecode / runMeta

Method runMeta

gecode/flatzinc/flatzinc.cpp:1830–1936  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1828 template<template<class> class Engine,
1829 template<class,template<class> class> class Meta>
1830 void
1831 FlatZincSpace::runMeta(std::ostream& out, const Printer& p,
1832 const FlatZincOptions& opt, Support::Timer& t_total) {
1833#ifdef GECODE_HAS_GIST
1834 if (opt.mode() == SM_GIST) {
1835 FZPrintingInspector<FlatZincSpace> pi(p);
1836 FZPrintingComparator<FlatZincSpace> pc(p);
1837 (void) GistEngine<Engine<FlatZincSpace> >::explore(this,opt,&pi,&pc);
1838 return;
1839 }
1840#endif
1841 StatusStatistics sstat;
1842 unsigned int n_p = 0;
1843 Support::Timer t_solve;
1844 t_solve.start();
1845 if (status(sstat) != SS_FAILED) {
1846 n_p = PropagatorGroup::all.size(*this);
1847 }
1848 Search::Options o;
1849 o.stop = Driver::CombinedStop::create(opt.node(), opt.fail(), opt.time(), opt.restart_limit(),
1850 true);
1851 o.c_d = opt.c_d();
1852 o.a_d = opt.a_d();
1853
1854#ifdef GECODE_HAS_CPPROFILER
1855 if (opt.profiler_port()) {
1856 FlatZincGetInfo* getInfo = nullptr;
1857 if (opt.profiler_info())
1858 getInfo = new FlatZincGetInfo(p);
1859 o.tracer = new CPProfilerSearchTracer(opt.profiler_id(),
1860 opt.name(), opt.profiler_port(),
1861 getInfo);
1862 }
1863
1864#endif
1865
1866#ifdef GECODE_HAS_FLOAT_VARS
1867 step = opt.step();
1868#endif
1869 o.threads = opt.threads();
1870 o.nogoods_limit = opt.nogoods() ? opt.nogoods_limit() : 0;
1871 o.cutoff = new Search::CutoffAppend(new Search::CutoffConstant(0), 1, Driver::createCutoff(opt));
1872 if (opt.interrupt())
1873 Driver::CombinedStop::installCtrlHandler(true);
1874 {
1875 Meta<FlatZincSpace,Engine> se(this,o);
1876 int noOfSolutions = opt.solutions();
1877 if (noOfSolutions == -1) {
1878 noOfSolutions = (_method == SAT) ? 1 : 0;
1879 }
1880 bool printAll = _method == SAT || opt.allSolutions() || noOfSolutions != 0;
1881 int findSol = noOfSolutions;
1882 FlatZincSpace* sol = nullptr;
1883 while (FlatZincSpace* next_sol = se.next()) {
1884 delete sol;
1885 sol = next_sol;
1886 if (printAll) {
1887 sol->print(out, p);

Callers

nothing calls this directly

Calls 15

exploreFunction · 0.85
createCutoffFunction · 0.85
profiler_infoMethod · 0.80
allSolutionsMethod · 0.80
absFunction · 0.50
modeMethod · 0.45
startMethod · 0.45
sizeMethod · 0.45
nodeMethod · 0.45
failMethod · 0.45
timeMethod · 0.45
restart_limitMethod · 0.45

Tested by

no test coverage detected