00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00048 #ifndef __PARSE_HPP__
00049 #define __PARSE_HPP__
00050 #include <string>
00051 #include <twod/part_base.hpp>
00052 #include "twod/rec_bisect_2d.hpp"
00053 #include "twod/rec_bisect_relaxed.hpp"
00054 #include "twod/uniform_2d.hpp"
00055 #include "twod/her_jag_2d.hpp"
00056 #include "oned/nicol_plus.hpp"
00057 #include "twod/nicol_2d.hpp"
00058 #include "twod/jagged_dp.hpp"
00059 #include "twod/jagged_dp_pq.hpp"
00060 #include "twod/m_way_jag_2d.hpp"
00061 #include "twod/jag_pq_opt_interval.hpp"
00062 #include "twod/hybrid.hpp"
00063 #include "twod/m_way_probe.hpp"
00064 #include "util/version.hpp"
00065
00066 namespace twod
00067 {
00073 template<typename T, typename Pr>
00074 class Parser
00075 {
00076 public:
00095 static PartBase<T,Pr>* parseName(const std::string& s);
00096 };
00097 }
00098 template<typename T, typename Pr>
00099 twod::PartBase<T,Pr>* twod::Parser<T,Pr>::parseName(const std::string& s)
00100 {
00101 twod::PartBase<T, Pr >* pb = NULL;
00102
00103 if(s.compare("NULL") == 0)
00104 pb = NULL;
00105 if(s.compare("HIER-RB-LOAD") == 0)
00106 pb = new twod::RecBisect2D<T, Pr, 0> ();
00107 else if(s.compare("HIER-RB-DIST") == 0)
00108 pb = new twod::RecBisect2D<T, Pr, 1> ();
00109 else if(s.compare("HIER-RB-VER") == 0)
00110 pb = new twod::RecBisect2D<T, Pr, 2> ();
00111 else if(s.compare("HIER-RB-HOR") == 0)
00112 pb = new twod::RecBisect2D<T, Pr, 3> ();
00113 else if(s.compare("HIER-RELAXED-LOAD") == 0)
00114 pb = new twod::HierRelaxed<T, Pr, 0> ();
00115 else if(s.compare("HIER-RELAXED-DIST") == 0)
00116 pb = new twod::HierRelaxed<T, Pr, 1> ();
00117 else if(s.compare("HIER-RELAXED-VER") == 0)
00118 pb = new twod::HierRelaxed<T, Pr, 2> ();
00119 else if(s.compare("HIER-RELAXED-HOR") == 0)
00120 pb = new twod::HierRelaxed<T, Pr, 3> ();
00121 else if(s.compare("HIER-RB-MIDDLE") == 0)
00122 pb = new twod::HierRelaxed<T, Pr, 1,true> ();
00123 else if(s.compare("RECT-UNIFORM") == 0)
00124 pb = new twod::Uniform<T, Pr > ();
00125 else if(s.compare("RECT-NICOL") == 0)
00126 pb = new twod::RectNicol<T, Pr > ();
00127 else if(s.compare("JAG-M-OPT-HOR") == 0)
00128 pb = new twod::JagMOptHor<T, Pr > ();
00129 else if(s.compare("JAG-M-OPT-VER") == 0)
00130 pb = new twod::JagMOptVer<T, Pr > ();
00131 else if(s.compare("JAG-M-OPT-BEST") == 0)
00132 pb = new twod::JagMOptBest<T, Pr > ();
00133 else if(s.compare("JAG-PQ-OPT-DP-HOR") == 0)
00134 pb = new twod::JagPQOptHor<T, Pr > ();
00135 else if(s.compare("JAG-PQ-OPT-DP-VER") == 0)
00136 pb = new twod::JagPQOptVer<T, Pr > ();
00137 else if(s.compare("JAG-PQ-OPT-DP-BEST") == 0)
00138 pb = new twod::JagPQOptBest<T, Pr > ();
00139 else if(s.compare("JAG-PQ-HEUR-VER") == 0)
00140 pb = new twod::JagPQHeurVer<T, Pr > ();
00141 else if(s.compare("JAG-PQ-HEUR-HOR") == 0)
00142 pb = new twod::JagPQHeurHor <T, Pr > ();
00143 else if(s.compare("JAG-PQ-HEUR-BEST") == 0)
00144 pb = new twod::JagPQHeurBest<T, Pr > ();
00145 else if(s.compare("JAG-M-HEUR-HOR") == 0)
00146 pb = new twod::JagMHeurHor<T, Pr > ();
00147 else if(s.compare("JAG-M-HEUR-VER") == 0)
00148 pb = new twod::JagMHeurVer<T, Pr > ();
00149 else if(s.compare("JAG-M-HEUR-BEST") == 0)
00150 pb = new twod::JagMHeurBest<T, Pr > ();
00151 else if(s.compare("JAG-M-HEUR-PROBE-HOR") == 0)
00152 pb = new twod::JagMHeurProbeHor<T, Pr > ();
00153 else if(s.compare("JAG-M-HEUR-PROBE-VER") == 0)
00154 pb = new twod::JagMHeurProbeVer<T, Pr > ();
00155 else if(s.compare("JAG-M-HEUR-PROBE-BEST") == 0)
00156 pb = new twod::JagMHeurProbeBest<T, Pr > ();
00157 else if(s.compare("JAG-PQ-OPT-INTERVAL-HOR") == 0)
00158 pb = new twod::JagPQOptIntervalHor<T, Pr > ();
00159 else if(s.compare("JAG-PQ-OPT-INTERVAL-VER") == 0)
00160 pb = new twod::JagPQOptIntervalVer<T, Pr > ();
00161 else if(s.compare("JAG-PQ-OPT-INTERVAL-BEST") == 0)
00162 pb = new twod::JagPQOptIntervalBest<T, Pr > ();
00163
00164 return pb;
00165 }
00166
00167 #endif