crown
1.0.0
|
00001 /* 00002 Copyright 2015 Nicolas Melot 00003 00004 This file is part of Crown. 00005 00006 Crown is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 Crown is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with Crown. If not, see <http://www.gnu.org/licenses/>. 00018 00019 */ 00020 00021 00022 #include <fstream> 00023 00024 #include <crown/scaling.h> 00025 00026 #include <pelib/AmplOutput.hpp> 00027 #include <pelib/AmplInput.hpp> 00028 00029 using namespace std; 00030 using namespace pelib; 00031 00032 int 00033 main(int argc, char **argv) 00034 { 00035 // Open and read input file 00036 ifstream taskgraph(argv[1], std::ios::in); 00037 00038 Algebra input = AmplInput(AmplInput::floatHandlers()).parse(taskgraph); 00039 taskgraph.close(); 00040 00041 cout << setprecision(6) 00042 << setiosflags(ios::fixed) 00043 << setiosflags(ios::showpoint); 00044 00045 input = frequency_height(input); 00046 00047 // Garbage to make output to look like Ampl/Gurobi output 00048 cout << "Presolve eliminates 0 constraints and 0 variables." << endl; 00049 cout << "Substitution eliminates 0 variables." << endl; 00050 cout << "Adjusted problem:" << endl; 00051 cout << "0 variables:" << endl; 00052 cout << " 0 binary variables" << endl; 00053 cout << " 0 linear variable" << endl; 00054 cout << "0 constraints, all linear; 0 nonzeros" << endl; 00055 cout << "0 linear objective; 0 nonzero." << endl; 00056 cout << endl; 00057 cout << ": timelim 300" << endl; 00058 00059 float m = input.find<Scalar<float> >("m")->getValue(); 00060 float M = input.find<Scalar<float> >("M")->getValue(); 00061 if(m < 0 && M > 0) 00062 { 00063 cout << "Height heuristic: infeasible" << endl; 00064 cout << "29 simplex iterations" << endl; 00065 cout << "plus 1 simplex iteration for intbasis" << endl; 00066 } 00067 else 00068 { 00069 cout << "plus 1 simplex iteration for intbasis" << endl; 00070 cout << "Height heuristic: heuristic solution; nonoptimal 0" << endl; 00071 cout << "29 simplex iterations" << endl; 00072 } 00073 00074 AmplOutput(AmplOutput::floatHandlers()).dump(cout, input); 00075 AmplOutput(AmplOutput::floatHandlers()).dump(cout, Scalar<float>("complexity", frequency_height_complexity(input))); 00076 00077 return EXIT_SUCCESS; 00078 } 00079