Commit 41a73562 authored by Simon de Givry's avatar Simon de Givry Committed by Thomas Schiex
Browse files

[code] compilation without BOOST must diseable VNS and OPENMPI

parent 2f34c05c
// Cmake generated version
#define Toulbar_VERSION "1.0.1-2-g5263a9d-master-tainted (1544259913)"
#define Toulbar_VERSION "1.0.1-3-gc7f044d-master-tainted (1544265320)"
......@@ -37,18 +37,38 @@ WeightedCSPSolver* WeightedCSPSolver::makeWeightedCSPSolver(Cost ub)
switch (ToulBar2::searchMethod) {
case VNS:
case DGVNS:
#ifdef BOOST
solver = new VNSSolver(ub);
#else
cerr << "Error: compiling with Boost graph library is needed to allow VNS-like search methods." << endl;
exit(EXIT_FAILURE);
#endif
break;
#ifdef OPENMPI
case CPDGVNS:
#ifdef BOOST
solver = new CooperativeParallelDGVNS(ub, env0);
#else
cerr << "Error: compiling with Boost graph library is needed to allow VNS-like search methods." << endl;
exit(EXIT_FAILURE);
#endif
break;
case RPDGVNS:
#ifdef BOOST
solver = new ReplicatedParallelDGVNS(ub, env0);
#else
cerr << "Error: compiling with Boost graph library is needed to allow VNS-like search methods." << endl;
exit(EXIT_FAILURE);
#endif
break;
#endif
case TREEDEC:
#ifdef BOOST
solver = new TreeDecRefinement(ub);
#else
cerr << "Error: compiling with Boost graph library is needed to allow VNS-like search methods." << endl;
exit(EXIT_FAILURE);
#endif
break;
default:
solver = new Solver(ub);
......
......@@ -248,6 +248,7 @@ enum {
OPT_random,
// VNS Methods
#ifdef BOOST
OPT_VNS_search,
#ifdef OPENMPI
OPT_CPDGVNS_search,
......@@ -270,6 +271,7 @@ enum {
OPT_neighbor_change,
OPT_neighbor_synch,
OPT_optimum
#endif
};
string getExt(string FileName)
......@@ -446,6 +448,7 @@ CSimpleOpt::SOption g_rgOptions[] = {
{ OPT_random, (char*)"-random", SO_REQ_SEP }, // init upper bound in cli
// VNS Methods
#ifdef BOOST
{ OPT_VNS_search, (char*)"-vns", SO_NONE },
{ OPT_VNS_search, (char*)"--vns", SO_NONE },
{ OPT_VNS_search, (char*)"-dgvns", SO_NONE },
......@@ -476,6 +479,7 @@ CSimpleOpt::SOption g_rgOptions[] = {
{ OPT_neighbor_synch, (char*)"--synch", SO_NONE },
{ OPT_optimum, (char*)"-best", SO_REQ_SEP },
{ OPT_optimum, (char*)"--best", SO_REQ_SEP },
#endif
SO_END_OF_OPTIONS
};
......@@ -745,6 +749,7 @@ void help_msg(char* toulbar2filename)
cout << " -i=[\"string\"] : initial upperbound found by INCOP local search solver." << endl;
cout << " string parameter is optional, using \"" << Incop_cmd << "\" by default with the following meaning:" << endl;
cout << " stoppinglowerbound randomseed nbiterations method nbmoves neighborhoodchoice neighborhoodchoice2 minnbneighbors maxnbneighbors neighborhoodchoice3 autotuning tracemode" << endl;
#ifdef BOOST
cout << " -vns : unified decomposition guided variable neighborhood search (a problem decomposition can be given as *.dec, *.cov, or *.order input files or using tree decomposition options such as -O)";
#ifdef OPENMPI
// cout << " -cpdgvns : initial upperbound found by cooperative parallel DGVNS (usage: \"mpirun -n [NbOfProcess] toulbar2 -cpdgvns problem.wcsp\")" << endl;
......@@ -761,6 +766,7 @@ void help_msg(char* toulbar2filename)
cout << " -kinc=[integer] : neighborhood size increment strategy for VNS-like methods using (1) Add1, (2) Mult2, (3) Luby operator (4) Add1/Jump (" << ToulBar2::vnsKinc << " by default)" << endl;
cout << " -best=[integer] : stop VNS-like methods if a better solution is found (default value is " << ToulBar2::vnsOptimum << ")" << endl;
cout << endl;
#endif
cout << " -z=[filename] : saves problem in wcsp format in filename (or \"problem.wcsp\" if no parameter is given)" << endl;
cout << " writes also the graphviz dot file and the degree distribution of the input problem" << endl;
cout << " -z=[integer] : 1: saves original instance (by default), 2: saves after preprocessing" << endl;
......@@ -966,6 +972,7 @@ int _tmain(int argc, TCHAR* argv[])
}
// VNS
#ifdef BOOST
if (args.OptionId() == OPT_VNS_search) {
// ToulBar2::searchMethod = VNS;
// ToulBar2::vnsNeighborVarHeur = RANDOMVAR;
......@@ -1017,20 +1024,6 @@ int _tmain(int argc, TCHAR* argv[])
}
}
if (args.OptionId() == OPT_stdin) {
// stdin format reading by default stdin type is cfn format
ToulBar2::stdin_format = args.OptionArg();
if (ToulBar2::stdin_format.length() == 0) {
ToulBar2::stdin_format = "cfn";
} else {
if (ToulBar2::stdin_format.compare("bep") == 0 || ToulBar2::stdin_format.compare("map") == 0 || ToulBar2::stdin_format.compare("pre") == 0) {
cerr << "Error: cannot read this " << ToulBar2::stdin_format << " format using stdin option!" << endl;
exit(EXIT_FAILURE);
}
}
// cout << "pipe STDIN on waited FORMAT : " << ToulBar2::stdin_format<<endl;
}
if (args.OptionId() == OPT_vns_output) {
#ifdef OPENMPI
if (env0.myrank == 0) {
......@@ -1125,6 +1118,21 @@ int _tmain(int argc, TCHAR* argv[])
// ToulBar2::vnsOptimum = atoll(args.OptionArg());
ToulBar2::vnsOptimumS = args.OptionArg();
}
#endif
if (args.OptionId() == OPT_stdin) {
// stdin format reading by default stdin type is cfn format
ToulBar2::stdin_format = args.OptionArg();
if (ToulBar2::stdin_format.length() == 0) {
ToulBar2::stdin_format = "cfn";
} else {
if (ToulBar2::stdin_format.compare("bep") == 0 || ToulBar2::stdin_format.compare("map") == 0 || ToulBar2::stdin_format.compare("pre") == 0) {
cerr << "Error: cannot read this " << ToulBar2::stdin_format << " format using stdin option!" << endl;
exit(EXIT_FAILURE);
}
}
// cout << "pipe STDIN on waited FORMAT : " << ToulBar2::stdin_format<<endl;
}
// BTD root cluster
if (args.OptionId() == OPT_btdRootCluster) {
......
......@@ -285,6 +285,7 @@ typedef struct {
\endcode
**/
#ifdef BOOST
class CFNStreamReader {
public:
......@@ -1980,6 +1981,7 @@ void CFNStreamReader::generateGCFStreamSsame(vector<int>& scope, stringstream& s
return;
}
#endif
// TB2 entry point for WCSP reading (not only wcsp format).
// Returns the global UB obtained form both the file and command line in internal Cost units
......
......@@ -8,6 +8,7 @@
#include "tb2dgvns.hpp"
#include "core/tb2wcsp.hpp"
#ifdef BOOST
bool VNSSolver::solve()
{
......@@ -208,6 +209,8 @@ bool VNSSolver::solve()
return (bestUb < MAX_COST);
}
#endif
/* Local Variables: */
/* c-basic-offset: 4 */
/* tab-width: 4 */
......
......@@ -6,6 +6,7 @@
* Phd. Student : LITIO, University of Oran. GREYC, University of Caen.
*/
#ifdef BOOST
#include "tb2vns.hpp"
#include "core/tb2wcsp.hpp"
#include "search/tb2clusters.hpp"
......@@ -558,6 +559,8 @@ uint ParallelRandomClusterChoice::getClustersSize(uint c, uint number)
return z.size();
}
#endif
/* Local Variables: */
/* c-basic-offset: 4 */
/* tab-width: 4 */
......
......@@ -12,6 +12,7 @@
#include "tb2localsearch.hpp"
#ifdef BOOST
#include <boost/version.hpp>
#include <boost/tokenizer.hpp>
#include <boost/graph/graph_traits.hpp>
......@@ -135,6 +136,7 @@ public:
virtual uint getClustersSize(uint c, uint number);
};
#endif
#endif /* TB2VNS_HPP_ */
/* Local Variables: */
......
......@@ -6,6 +6,7 @@
* PhD Student: LITIO, University of Oran ; GREYC, University of Caen.
*/
#ifdef BOOST
#include "tb2vnsutils.hpp"
#include "core/tb2wcsp.hpp"
......@@ -357,6 +358,8 @@ void cluster_graph_absorption(TCDGraph& m_graph, TCDGraph& abs_graph)
}
}
#endif
/* Local Variables: */
/* c-basic-offset: 4 */
/* tab-width: 4 */
......
......@@ -9,6 +9,7 @@
#ifndef TB2VNSUTILS_HPP_
#define TB2VNSUTILS_HPP_
#ifdef BOOST
#include "tb2vns.hpp"
#include "tb2localsearch.hpp"
......@@ -143,6 +144,7 @@ public:
double ecart_type(vector<int> data);
};
#endif
#endif /* TB2VNSUTILS_HPP_ */
/* Local Variables: */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment