Changeset 5583


Ignore:
Timestamp:
09/18/08 13:51:27 (6 years ago)
Author:
wehart
Message:

Adding pack/unpack capabilities to MILPSymbol objects.

Deleting old development directories.

Location:
pico/trunk/src/ampl/pico
Files:
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • pico/trunk/src/ampl/pico/MILPSymbInfo.cpp

    r5553 r5583  
    241241void MILPSymbInfo::write(PackBuffer& pack) const 
    242242{ 
    243 #if 0 
    244 pack << lname; 
    245 pack << other_index_ht << col_index_ht << row_index_ht << hashset; 
    246 pack << set_names << sets << set_types << num_sets; 
    247 #endif 
     243pack << double_literals << string_literals; 
     244pack << symbols.size(); 
     245// 
     246// Pack each symbol separately, since the objects already exist on the 
     247// remote processor 
     248// 
     249std::map<std::string, pico::MILPSymbol*>::const_iterator curr = symbols.begin(); 
     250std::map<std::string, pico::MILPSymbol*>::const_iterator end  = symbols.end(); 
     251while (curr != end) { 
     252  pack << curr->first; 
     253  pack << *(curr->second); 
     254  } 
    248255} 
    249256 
    250257void MILPSymbInfo::read(UnPackBuffer& unpack) 
    251258{ 
    252 #if 0 
    253 unpack >> lname; 
    254 unpack >> other_index_ht >> col_index_ht >> row_index_ht >> hashset; 
    255 unpack >> set_names >> sets >> set_types >> num_sets; 
    256 #endif 
     259unpack >> double_literals >> string_literals; 
     260size_t num; 
     261unpack >> num; 
     262if (num != symbols.size())  
     263   EXCEPTION_MNGR(std::runtime_error, "Bad unpack buffer.  Expected " << symbols.size() << " symbols, but got " << num); 
     264 
     265for (int i=0; i<num; i++) { 
     266  std::string tmp; 
     267  unpack >> tmp; 
     268  unpack >> symbols[tmp]; 
     269  } 
    257270} 
    258271 
  • pico/trunk/src/ampl/pico/MILPSymbInfo.h

    r5553 r5583  
    2020#include <utilib/bimap.h> 
    2121#include <utilib/CharString.h> 
    22 //#include <pico/MILPSet.h> 
     22#include <utilib/PackObject.h> 
    2323#include <pico/MILPSymbol.h> 
    2424 
     
    3030 * a MILP. 
    3131 */ 
    32 class MILPSymbInfo 
     32class MILPSymbInfo : public utilib::PackObject 
    3333{ 
    3434public: 
     
    7373   /// 
    7474   std::map<std::string, pico::MILPSymbolMapValueCore<size_t,size_t>*> rc_symbols; 
    75  
    7675}; 
    7776 
  • pico/trunk/src/ampl/pico/MILPSymbol.h

    r5568 r5583  
    9090 * Defines a symbol, which is mapped into a MILP variable, parameter or set. 
    9191 */ 
    92 class MILPSymbol 
     92class MILPSymbol : public utilib::PackObject 
    9393{ 
    9494public: 
     
    180180   int dimen; 
    181181 
     182   /// 
     183   void write(utilib::PackBuffer& pack) 
     184        { pack << valid; } 
     185 
     186   /// 
     187   void read(utilib::UnPackBuffer& unpack) 
     188        { unpack >> valid; } 
     189 
     190 
    182191protected: 
    183192 
     
    292301      return curr->second; 
    293302   } 
     303 
     304   void write(utilib::PackBuffer& pack) 
     305        { 
     306        MILPSymbol::write(pack); 
     307        pack << id; 
     308        } 
     309 
     310   void read(utilib::UnPackBuffer& unpack) 
     311        { 
     312        MILPSymbol::read(unpack); 
     313        unpack >> id; 
     314        } 
    294315 
    295316protected: 
Note: See TracChangeset for help on using the changeset viewer.