| ... | ... |
@@ -94,49 +94,49 @@ |
| 94 | 94 |
void solve_mat(ArgParser &ap, std::istream &is, std::ostream &, |
| 95 | 95 |
DimacsDescriptor &desc) |
| 96 | 96 |
{
|
| 97 | 97 |
bool report = !ap.given("q");
|
| 98 | 98 |
Graph g; |
| 99 | 99 |
Timer ti; |
| 100 | 100 |
ti.restart(); |
| 101 | 101 |
readDimacsMat(is, g, desc); |
| 102 | 102 |
if(report) std::cerr << "Read the file: " << ti << '\n'; |
| 103 | 103 |
ti.restart(); |
| 104 | 104 |
MaxMatching<Graph> mat(g); |
| 105 | 105 |
if(report) std::cerr << "Setup MaxMatching class: " << ti << '\n'; |
| 106 | 106 |
ti.restart(); |
| 107 | 107 |
mat.run(); |
| 108 | 108 |
if(report) std::cerr << "Run MaxMatching: " << ti << '\n'; |
| 109 | 109 |
if(report) std::cerr << "\nCardinality of max matching: " |
| 110 | 110 |
<< mat.matchingSize() << '\n'; |
| 111 | 111 |
} |
| 112 | 112 |
|
| 113 | 113 |
|
| 114 | 114 |
template<class Value> |
| 115 | 115 |
void solve(ArgParser &ap, std::istream &is, std::ostream &os, |
| 116 | 116 |
DimacsDescriptor &desc) |
| 117 | 117 |
{
|
| 118 |
std::stringstream iss(ap["infcap"]); |
|
| 118 |
std::stringstream iss(static_cast<std::string>(ap["infcap"])); |
|
| 119 | 119 |
Value infty; |
| 120 | 120 |
iss >> infty; |
| 121 | 121 |
if(iss.fail()) |
| 122 | 122 |
{
|
| 123 | 123 |
std::cerr << "Cannot interpret '" |
| 124 | 124 |
<< static_cast<std::string>(ap["infcap"]) << "' as infinite" |
| 125 | 125 |
<< std::endl; |
| 126 | 126 |
exit(1); |
| 127 | 127 |
} |
| 128 | 128 |
|
| 129 | 129 |
switch(desc.type) |
| 130 | 130 |
{
|
| 131 | 131 |
case DimacsDescriptor::MIN: |
| 132 | 132 |
std::cerr << |
| 133 | 133 |
"\n\n Sorry, the min. cost flow solver is not yet available.\n"; |
| 134 | 134 |
break; |
| 135 | 135 |
case DimacsDescriptor::MAX: |
| 136 | 136 |
solve_max<Value>(ap,is,os,infty,desc); |
| 137 | 137 |
break; |
| 138 | 138 |
case DimacsDescriptor::SP: |
| 139 | 139 |
solve_sp<Value>(ap,is,os,desc); |
| 140 | 140 |
break; |
| 141 | 141 |
case DimacsDescriptor::MAT: |
| 142 | 142 |
solve_mat(ap,is,os,desc); |
0 comments (0 inline)