Changeset 542


Ignore:
Timestamp:
May 20, 2007 3:27:13 PM (12 years ago)
Author:
pbelotti
Message:

modify problem IO to save extended models

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Couenne/Couenne/src/problem/problemIO.cpp

    r445 r542  
    5151// store problem in a .mod file (AMPL)
    5252
    53 void CouenneProblem::writeMod (char *fname) {
     53void CouenneProblem::writeMod (char *fname,  /// name of the mod file
     54                               bool aux) {   ///
    5455
    5556  std::ofstream f (fname);
     
    7576  // defined (aux) variables, declaration ///////////////////////////////////////////
    7677
    77   f << std::endl << "# auxiliary variables" << std::endl << std::endl;
     78  if (aux) {
    7879
    79   for (std::vector <exprAux *>::iterator i = auxiliaries_.begin ();
    80        i != auxiliaries_.end ();
    81        i++) {
     80    f << std::endl << "# auxiliary variables" << std::endl << std::endl;
    8281
    83     f << "var "; (*i) -> print (f);
    84     //    f << " = ";  (*i) -> Image () -> print (f);
    85     f << ';' << std::endl;
     82    for (std::vector <exprAux *>::iterator i = auxiliaries_.begin ();
     83         i != auxiliaries_.end ();
     84         i++) {
     85
     86      f << "var "; (*i) -> print (f);
     87      //    f << " = ";  (*i) -> Image () -> print (f);
     88      CouNumber bound;
     89
     90      if ((bound = (*((*i) -> Lb ())) ()) > - COUENNE_INFINITY) f << " >= " << bound;
     91      if ((bound = (*((*i) -> Ub ())) ()) <   COUENNE_INFINITY) f << " <= " << bound;
     92      if ((*i) -> isInteger ()) f << " integer";
     93      f << ';' << std::endl;
     94    }
    8695  }
    8796
Note: See TracChangeset for help on using the changeset viewer.