/* Copyright (C) 2000, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). $Id$ */ #ifndef __NAMES_HPP__ #define __NAMES_HPP__ #include #include #include #include /* The classes in this file are used for reading in an MPS file. Rname is used for storing the names and signs of the constraints. Cname is used for storing the names of the variables. */ using std::string; using std::map; using std::vector; using std::cout; using std::endl; class LP_parms; class VOL_lp; // The function that actually reads in the MPS file int reader(const LP_parms &lp_par, VOL_lp *lp_pb); //############################################################################# class Rname { public: int nrows; map name; vector sign; public: Rname() : nrows(0) {} ~Rname() {} int original_index(const string & Name) { map::iterator j = name.find(Name); if ( j == name.end() ) { cout << " name not found: " << Name << endl; abort(); } return j->second; } void add(const string &Name, const string &Sign) { map::iterator j = name.find(Name); if ( j==name.end() ){ name[Name]=nrows++; sign.push_back(Sign); } else { cout << " duplicated row: " << Name << endl; abort(); } } }; //############################################################################# class Cname{ private: int ncols; public: map name; public: Cname() : ncols(0) {} ~Cname() {} int original_index(const string & Name) { map::iterator j = name.find(Name); if ( j == name.end() ) { cout << " name not found: " << Name << endl; abort(); } return j->second; } void add(const string &Name) { map::iterator j = name.find(Name); if ( j==name.end() ){ name[Name]=ncols++; } else { cout << " duplicated row: " << Name << endl; abort(); } } }; //############################################################################# #endif