本文整理汇总了C++中Problem::chain_search方法的典型用法代码示例。如果您正苦于以下问题:C++ Problem::chain_search方法的具体用法?C++ Problem::chain_search怎么用?C++ Problem::chain_search使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Problem
的用法示例。
在下文中一共展示了Problem::chain_search方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: svgmap
/*
* BIG MACHINE
*/
std::list<LabelPosition*>* Pal::labeller( int nbLayers, char **layersName , double *layersFactor, double scale, double bbox[4], PalStat **stats, bool displayAll )
{
#ifdef _DEBUG_
std::cout << "LABELLER (selection)" << std::endl;
#endif
Problem *prob;
SearchMethod old_searchMethod = searchMethod;
if ( displayAll )
{
setSearch( POPMUSIC_TABU );
}
#ifdef _VERBOSE_
clock_t start = clock();
double create_time;
std::cout << std::endl << "bbox: " << bbox[0] << " " << bbox[1] << " " << bbox[2] << " " << bbox[3] << std::endl;
#endif
#ifdef _EXPORT_MAP_
// TODO this is not secure
std::ofstream svgmap( "pal-map.svg" );
svgmap << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" << std::endl
<< "<svg" << std::endl
<< "xmlns:dc=\"http://purl.org/dc/elements/1.1/\"" << std::endl
<< "xmlns:cc=\"http://creativecommons.org/ns#\"" << std::endl
<< "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"" << std::endl
<< "xmlns:svg=\"http://www.w3.org/2000/svg\"" << std::endl
<< "xmlns=\"http://www.w3.org/2000/svg\"" << std::endl
<< "xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\"" << std::endl
<< "xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"" << std::endl
<< "width=\"" << convert2pt( bbox[2] - bbox[0], scale, dpi ) << "\"" << std::endl
<< "height=\"" << convert2pt( bbox[3] - bbox[1], scale, dpi ) << "\">" << std::endl; // TODO xmax ymax
#endif
QTime t;
t.start();
// First, extract the problem
// TODO which is the minimum scale ? (> 0, >= 0, >= 1, >1 )
if ( scale < 1 || ( prob = extract( nbLayers, layersName, layersFactor, bbox[0], bbox[1], bbox[2], bbox[3], scale,
#ifdef _EXPORT_MAP_
& svgmap
#else
NULL
#endif
) ) == NULL )
{
#ifdef _VERBOSE_
if ( scale < 1 )
std::cout << "Scale is 1:" << scale << std::endl;
else
std::cout << "empty problem... finishing" << std::endl;
#endif
#ifdef _EXPORT_MAP_
svgmap << "</svg>" << std::endl;
svgmap.close();
#endif
// nothing to be done => return an empty result set
if ( stats )
( *stats ) = new PalStat();
return new std::list<LabelPosition*>();
}
std::cout << "PAL EXTRACT: " << t.elapsed() / 1000.0 << " s" << std::endl;
t.restart();
// reduce number of candidates
// (remove candidates which surely won't be used)
prob->reduce();
#ifdef _VERBOSE_
std::cerr << prob->nblp << "\t"
<< prob->nbOverlap;
#endif
prob->displayAll = displayAll;
#ifdef _VERBOSE_
create_time = double( clock() - start ) / double( CLOCKS_PER_SEC );
std::cout << std::endl << "Problem : " << prob->nblp << " candidates for " << prob->nbft << " features makes " << prob->nbOverlap << " overlaps" << std::endl;
std::cout << std::endl << "Times:" << std::endl << " to create problem: " << create_time << std::endl;
#endif
// search a solution
if ( searchMethod == FALP )
prob->init_sol_falp();
else if ( searchMethod == CHAIN )
prob->chain_search();
//.........这里部分代码省略.........