reader.h

Go to the documentation of this file.
00001 /*
00002   Copyright (C) 2000, International Business Machines
00003   Corporation and others.  All Rights Reserved.
00004   This code is licensed under the terms of the Eclipse Public License (EPL).
00005 
00006   $Id$
00007 */
00008 
00009 #ifndef __NAMES_HPP__
00010 #define __NAMES_HPP__
00011 
00012 #include <map>
00013 #include <vector>
00014 #include <string>
00015 #include <iostream>
00016 
00017 /* The classes in this file are used for reading in an MPS file.
00018    Rname is used for storing the names and signs of the constraints.
00019    Cname is used for storing the names of the variables.
00020 */
00021 
00022 using std::string;
00023 using std::map;
00024 using std::vector;
00025 using std::cout;
00026 using std::endl;
00027 
00028 class LP_parms;
00029 class VOL_lp;
00030 
00031 // The function that actually reads in the MPS file
00032 int reader(const LP_parms &lp_par, VOL_lp *lp_pb);
00033 
00034 //#############################################################################
00035 
00036 class Rname {
00037 public:
00038    int nrows;
00039    map<string, int> name;
00040    vector<string> sign;
00041 public:
00042    Rname() : nrows(0) {}
00043    ~Rname() {}
00044    int original_index(const string & Name) {
00045       map<string, int>::iterator j = name.find(Name);
00046       if ( j == name.end() ) {
00047          cout << " name not found: " << Name << endl;
00048          abort();
00049       }
00050       return j->second;
00051    }
00052    void add(const string &Name, const string &Sign) {
00053       map<string, int>::iterator j = name.find(Name);
00054       if ( j==name.end() ){
00055          name[Name]=nrows++;
00056          sign.push_back(Sign);
00057       } else {
00058          cout << " duplicated row: " << Name << endl;
00059          abort();
00060       }
00061    }
00062 };
00063 
00064 //#############################################################################
00065 
00066 class Cname{
00067 private:
00068    int ncols;
00069 public:
00070    map<string, int> name;
00071 public:
00072    Cname() : ncols(0) {}
00073    ~Cname() {}
00074    int original_index(const string & Name) {
00075       map<string, int>::iterator j = name.find(Name);
00076       if ( j == name.end() ) {
00077          cout << " name not found: " << Name << endl;
00078          abort();
00079       }
00080       return j->second;
00081    }
00082    void add(const string &Name) {
00083       map<string, int>::iterator j = name.find(Name);
00084       if ( j==name.end() ){
00085          name[Name]=ncols++;
00086       } else {
00087          cout << " duplicated row: " << Name << endl;
00088          abort();
00089       }
00090    }
00091 };
00092 
00093 //#############################################################################
00094 
00095 #endif
 All Classes Files Functions Variables Enumerations Enumerator Friends Defines

Generated on 3 Jun 2015 for Vol by  doxygen 1.6.1