Changeset 103


Ignore:
Timestamp:
Apr 12, 2009 8:47:38 AM (13 years ago)
Author:
pbelotti
Message:

fixed bug in zero-multiplicity original variables: they are set to zero in the .sol file, but they shouln't - thanks to Francois Dionne for pointing it out. split CouenneProblem?.cpp to separate constructors and reformulation from the rest. Added two new files for expression containers.

Location:
trunk/Couenne/src
Files:
5 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/src/Makefile.am

    r96 r103  
    167167        expression/exprStore.hpp \
    168168        expression/exprOp.hpp \
     169        expression/CouExpr.hpp \
    169170        expression/CouennePrecisions.hpp \
    170171        problem/depGraph/depGraph.hpp \
  • trunk/Couenne/src/Makefile.in

    r96 r103  
    414414        expression/exprStore.hpp \
    415415        expression/exprOp.hpp \
     416        expression/CouExpr.hpp \
    416417        expression/CouennePrecisions.hpp \
    417418        problem/depGraph/depGraph.hpp \
  • trunk/Couenne/src/convex/CouenneCutGenerator.cpp

    r40 r103  
    44 * Purpose: define a class of convexification procedures
    55 *
    6  * (C) Carnegie-Mellon University, 2006-08.
     6 * (C) Carnegie-Mellon University, 2006-09.
    77 * This file is licensed under the Common Public License (CPL)
    88 */
     
    2020CouenneCutGenerator::CouenneCutGenerator (Bonmin::OsiTMINLPInterface *nlp,
    2121                                          Bonmin::BabSetupBase *base,
    22                                           const struct ASL *asl):
     22                                          struct ASL *asl):
    2323
    2424  CglCutGenerator (),
     
    113113
    114114/// total number of variables (original + auxiliary) of the problem
    115 const int CouenneCutGenerator::getnvars () const
     115int CouenneCutGenerator::getnvars () const
    116116  {return problem_ -> nVars ();}
    117117
  • trunk/Couenne/src/convex/CouenneCutGenerator.hpp

    r40 r103  
    44 * Purpose: a convexification cut generator for MINLP problems
    55 *
    6  * (C) Carnegie-Mellon University, 2006.
     6 * (C) Carnegie-Mellon University, 2006-09.
    77 * This file is licensed under the Common Public License (CPL)
    88 */
     
    9090  CouenneCutGenerator  (Bonmin::OsiTMINLPInterface * = NULL,
    9191                        Bonmin::BabSetupBase *base = NULL,
    92                         const struct ASL * = NULL);
     92                        struct ASL * = NULL);
    9393
    9494  /// copy constructor
     
    111111
    112112  /// total number of variables (original + auxiliary)
    113   const int getnvars () const;
     113  int getnvars () const;
    114114
    115115  /// has generateCuts been called yet?
  • trunk/Couenne/src/expression/Makefile.am

    r96 r103  
    1717        exprVar.cpp \
    1818        exprAux.cpp \
     19        CouExpr.cpp \
    1920        operators/exprAbs.cpp \
    2021        operators/exprDiv.cpp \
  • trunk/Couenne/src/expression/Makefile.in

    r96 r103  
    6868libCouenneExpression_la_LIBADD =
    6969am_libCouenneExpression_la_OBJECTS = domain.lo expression.lo exprOp.lo \
    70         exprUnary.lo exprVar.lo exprAux.lo exprAbs.lo exprDiv.lo \
    71         exprExp.lo exprInv.lo exprLog.lo exprMul.lo exprOpp.lo \
    72         exprPow.lo exprSin.lo exprCos.lo exprSub.lo exprSum.lo \
    73         exprMinMax.lo exprGroup.lo exprQuad.lo compQuadFinBounds.lo \
    74         exprBQuad.lo simplifiers.lo simplify.lo conv-exprAbs.lo \
    75         conv-exprDiv.lo conv-exprMul.lo conv-exprMul-genCuts.lo \
    76         unifiedProdCuts.lo conv-exprOpp.lo conv-exprPow.lo \
    77         conv-exprPow-getBounds.lo conv-exprPow-envelope.lo \
    78         powNewton.lo conv-exprSub.lo conv-exprSum.lo conv-exprInv.lo \
    79         conv-exprSinCos.lo conv-exprExp.lo conv-exprLog.lo \
    80         conv-exprGroup.lo conv-exprQuad.lo trigNewton.lo \
    81         alphaConvexify.lo quadCuts.lo branchExprAbs.lo \
    82         branchExprExp.lo branchExprDiv.lo branchExprInv.lo \
    83         branchExprLog.lo branchExprMul.lo branchExprPow.lo \
    84         branchExprQuad.lo branchExprSinCos.lo minMaxDelta.lo \
    85         computeMulBrDist.lo
     70        exprUnary.lo exprVar.lo exprAux.lo CouExpr.lo exprAbs.lo \
     71        exprDiv.lo exprExp.lo exprInv.lo exprLog.lo exprMul.lo \
     72        exprOpp.lo exprPow.lo exprSin.lo exprCos.lo exprSub.lo \
     73        exprSum.lo exprMinMax.lo exprGroup.lo exprQuad.lo \
     74        compQuadFinBounds.lo exprBQuad.lo simplifiers.lo simplify.lo \
     75        conv-exprAbs.lo conv-exprDiv.lo conv-exprMul.lo \
     76        conv-exprMul-genCuts.lo unifiedProdCuts.lo conv-exprOpp.lo \
     77        conv-exprPow.lo conv-exprPow-getBounds.lo \
     78        conv-exprPow-envelope.lo powNewton.lo conv-exprSub.lo \
     79        conv-exprSum.lo conv-exprInv.lo conv-exprSinCos.lo \
     80        conv-exprExp.lo conv-exprLog.lo conv-exprGroup.lo \
     81        conv-exprQuad.lo trigNewton.lo alphaConvexify.lo quadCuts.lo \
     82        branchExprAbs.lo branchExprExp.lo branchExprDiv.lo \
     83        branchExprInv.lo branchExprLog.lo branchExprMul.lo \
     84        branchExprPow.lo branchExprQuad.lo branchExprSinCos.lo \
     85        minMaxDelta.lo computeMulBrDist.lo
    8686libCouenneExpression_la_OBJECTS =  \
    8787        $(am_libCouenneExpression_la_OBJECTS)
     
    298298        exprVar.cpp \
    299299        exprAux.cpp \
     300        CouExpr.cpp \
    300301        operators/exprAbs.cpp \
    301302        operators/exprDiv.cpp \
     
    420421        -rm -f *.tab.c
    421422
     423@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CouExpr.Plo@am__quote@
    422424@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alphaConvexify.Plo@am__quote@
    423425@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/branchExprAbs.Plo@am__quote@
  • trunk/Couenne/src/main/BonCouenne.cpp

    r79 r103  
    4646#include "CouenneProblem.hpp"
    4747
    48 int main (int argc, char *argv[])
    49 {
    50   WindowsErrorPopupBlocker();
     48int main (int argc, char *argv[]) {
     49
     50  //WindowsErrorPopupBlocker();
    5151  using namespace Ipopt;
    5252
     
    9797    couenne.options () -> GetNumericValue ("time_limit", timeLimit, "couenne.");
    9898    couenne.setDoubleParameter (BabSetupBase::MaxTime,
    99                                timeLimit - (time_start = (CoinCpuTime () - time_start)));
     99                                timeLimit - (time_start = (CoinCpuTime () - time_start)));
    100100
    101101    //////////////////////////////////
  • trunk/Couenne/src/main/BonCouenneInterface.cpp

    r82 r103  
    121121        } else {
    122122          // if not enabled, fix them in the NLP solver
    123           setColLower (i, 0.);
    124           setColUpper (i, 0.);
     123          setColLower (i, -COIN_DBL_MAX);
     124          setColUpper (i,  COIN_DBL_MAX);
    125125        }
    126126    }
     
    262262   for (int i=0; i<numcols; i++)
    263263     if (p -> Var (i) -> Multiplicity () > 0) si.addCol (0, NULL,NULL, lb [i],       ub [i],      0);
    264      else                                     si.addCol (0, NULL,NULL, 0.,           0.,          0);
     264     else                                     si.addCol (0, NULL,NULL, -COIN_DBL_MAX,COIN_DBL_MAX,0);
    265265   for (int i=numcols; i<numcolsconv; i++)    si.addCol (0, NULL,NULL, -COIN_DBL_MAX,COIN_DBL_MAX,0);
    266266
     
    282282       colUpper [i] = (uu [i] <   COUENNE_INFINITY) ? uu [i] :  COIN_DBL_MAX;
    283283     } else {
    284        colLower [i] = 0.;
    285        colUpper [i] = 0.;
     284       colLower [i] = -COIN_DBL_MAX;
     285       colUpper [i] =  COIN_DBL_MAX;
    286286     }
    287287
  • trunk/Couenne/src/problem/CouenneProblem.cpp

    r98 r103  
    2828#include "lqelems.hpp"
    2929
    30 /// constructor
    31 CouenneProblem::CouenneProblem (const struct ASL *asl,
    32                                 Bonmin::BabSetupBase *base,
    33                                 JnlstPtr jnlst):
    34   problemName_ (""),
    35   auxSet_    (NULL),
    36   curnvars_  (-1),
    37   nIntVars_  (0),
    38   optimum_   (NULL),
    39   bestObj_   (COIN_DBL_MAX),
    40   quadIndex_ (NULL),
    41   commuted_  (NULL),
    42   numbering_ (NULL),
    43   ndefined_  (0),
    44   graph_     (NULL),
    45   nOrigVars_ (0),
    46   nOrigIntVars_ (0),
    47   pcutoff_   (new GlobalCutOff (COIN_DBL_MAX)),
    48   created_pcutoff_ (true),
    49   doFBBT_    (true),
    50   doOBBT_    (false),
    51   doABT_     (true),
    52   logObbtLev_(0),
    53   logAbtLev_ (0),
    54   jnlst_     (jnlst),
    55   opt_window_ (COIN_DBL_MAX),
    56   useQuadratic_ (false),
    57   feas_tolerance_ (feas_tolerance_default),
    58   integerRank_ (NULL),
    59   maxCpuTime_  (COIN_DBL_MAX),
    60   bonBase_     (base)
    61 {
    62 
    63   double now = CoinCpuTime ();
    64 
    65   if (asl) {
    66 #if COIN_HAS_ASL
    67     // read problem from AMPL structure
    68     readnl (asl);
    69 #else
    70     jnlst_ -> Printf (Ipopt::J_ERROR, J_PROBLEM, "Couenne was compiled without ASL library. Cannot process ASL structure.\n");
    71     throw -1;
    72 #endif
    73 
    74     if ((now = (CoinCpuTime () - now)) > 10.)
    75       jnlst_ -> Printf (Ipopt::J_WARNING, J_PROBLEM,
    76                         "Couenne: reading time %.3fs\n", now);
    77   }
    78 
    79   // create expression set for binary search
    80   auxSet_ = new std::set <exprAux *, compExpr>;
    81 
    82   if (base) {
    83     std::string s;
    84     base -> options() -> GetStringValue ("use_quadratic", s, "couenne.");
    85     useQuadratic_ = (s == "yes");
    86   }
    87 
    88   if (base) {
    89 
    90     std::string s;
    91 
    92     base -> options() -> GetStringValue ("feasibility_bt",  s, "couenne."); doFBBT_ = (s == "yes");
    93     base -> options() -> GetStringValue ("optimality_bt",   s, "couenne."); doOBBT_ = (s == "yes");
    94     base -> options() -> GetStringValue ("aggressive_fbbt", s, "couenne."); doABT_  = (s == "yes");
    95 
    96     base -> options() -> GetIntegerValue ("log_num_obbt_per_level", logObbtLev_, "couenne.");
    97     base -> options() -> GetIntegerValue ("log_num_abt_per_level",  logAbtLev_,  "couenne.");
    98 
    99     base -> options() -> GetNumericValue ("feas_tolerance",  feas_tolerance_, "couenne.");
    100     base -> options() -> GetNumericValue ("opt_window",      opt_window_,     "couenne.");
    101   }
    102 }
    103 
    104 
    105 /// preprocess problem in order to extract linear relaxations etc.
    106 void CouenneProblem::reformulate () {
    107 
    108   double now = CoinCpuTime ();
    109 
    110   if (domain_.current () == NULL) {
    111 
    112     // create room for problem's variables and bounds, if no domain exists
    113     CouNumber
    114       *x  = (CouNumber *) malloc ((nVars()) * sizeof (CouNumber)),
    115       *lb = (CouNumber *) malloc ((nVars()) * sizeof (CouNumber)),
    116       *ub = (CouNumber *) malloc ((nVars()) * sizeof (CouNumber));
    117 
    118     for (int i = nVars(); i--;) {
    119       x  [i] =  0.;
    120       lb [i] = -COUENNE_INFINITY;
    121       ub [i] =  COUENNE_INFINITY;
    122     }
    123 
    124     domain_.push (nVars (), x, lb, ub);
    125   }
    126 
    127   // link initial variables to problem's domain
    128   for (std::vector <exprVar *>::iterator i = variables_.begin ();
    129        i != variables_.end (); ++i)
    130     (*i) -> linkDomain (&domain_);
    131 
    132   if (jnlst_ -> ProduceOutput(Ipopt::J_SUMMARY, J_PROBLEM))
    133     print (std::cout);
    134 
    135   // save -- for statistic purposes -- number of original
    136   // constraints. Some of them will be deleted as definition of
    137   // auxiliary variables.
    138   nOrigCons_    = constraints_. size ();
    139   nOrigIntVars_ = nIntVars ();
    140 
    141   jnlst_->Printf (Ipopt::J_SUMMARY, J_PROBLEM,
    142                   "Problem size before reformulation: %d variables (%d integer), %d constraints.\n",
    143                   nOrigVars_, nOrigIntVars_, nOrigCons_);
    144 
    145   // reformulation
    146   if (!standardize ()) { // problem is infeasible if standardize returns false
    147 
    148     jnlst_->Printf(Ipopt::J_WARNING, J_PROBLEM,
    149                    "Couenne: problem infeasible after reformulation\n");
    150     // fake infeasible bounds for Couenne to bail out
    151     for (int i = nVars (); i--;)
    152       Ub (i) = - (Lb (i) = 1.);
    153   }
    154 
    155   // clear all spurious variables pointers not referring to the variables_ vector
    156   realign ();
    157 
    158   // give a value to all auxiliary variables. Do it now to be able to
    159   // recognize complementarity constraints in fillDependence()
    160   initAuxs ();
    161 
    162   // fill dependence_ structure
    163   fillDependence (bonBase_);
    164 
    165   // quadratic handling
    166   fillQuadIndices ();
    167 
    168   if ((now = (CoinCpuTime () - now)) > 10.)
    169     jnlst_->Printf(Ipopt::J_WARNING, J_PROBLEM,
    170     "Couenne: reformulation time %.3fs\n", now);
    171 
    172   // give a value to all auxiliary variables
    173   initAuxs ();
    174 
    175   int nActualVars = nIntVars_ = 0;
    176 
    177   // check how many integer variables we have now (including aux)
    178   for (int i=0; i<nVars(); i++)
    179     if (variables_ [i] -> Multiplicity () > 0) {
    180 
    181       nActualVars++;
    182       if (variables_ [i] -> isDefinedInteger ())
    183         nIntVars_++;
    184     }
    185 
    186   jnlst_->Printf(Ipopt::J_SUMMARY, J_PROBLEM,
    187                   "Problem size after  reformulation: %d variables (%d integer), %d constraints.\n",
    188                   nActualVars, nIntVars_, nCons());
    189 
    190   // check if optimal solution is available (for debug purposes)
    191   readOptimum ();
    192 
    193   if (bonBase_) {
    194 
    195     CouNumber
    196       art_cutoff =  COIN_DBL_MAX,
    197       art_lower  = -COIN_DBL_MAX;
    198 
    199     bonBase_ -> options() -> GetNumericValue ("art_cutoff", art_cutoff, "couenne.");
    200     bonBase_ -> options() -> GetNumericValue ("art_lower",  art_lower,  "couenne.");
    201 
    202     if (art_cutoff <  1.e50) setCutOff (art_cutoff);
    203     if (art_lower  > -1.e50) {
    204       int indobj = objectives_ [0] -> Body () -> Index ();
    205       if (indobj >= 0)
    206         domain_.lb (indobj) = art_lower;
    207     }
    208   }
    209 
    210   if (jnlst_->ProduceOutput(Ipopt::J_DETAILED, J_PROBLEM)) {
    211     // We should route that also through the journalist
    212     print (std::cout);
    213   }
    214 
    215   //writeAMPL ("extended-aw.mod", true);
    216   //writeAMPL ("original.mod", false);
    217 }
    218 
    219 
    220 /// copy constructor
    221 
    222 CouenneProblem::CouenneProblem (const CouenneProblem &p):
    223   problemName_  (p.problemName_),
    224   domain_       (p.domain_),
    225   curnvars_     (-1),
    226   nIntVars_     (p.nIntVars_),
    227   optimum_      (NULL),
    228   bestObj_      (p.bestObj_),
    229   commuted_     (NULL),
    230   numbering_    (NULL),
    231   ndefined_     (p.ndefined_),
    232   graph_        (NULL),
    233   nOrigVars_    (p.nOrigVars_),
    234   nOrigCons_    (p.nOrigCons_),
    235   nOrigIntVars_ (p.nOrigIntVars_),
    236   pcutoff_      (p.pcutoff_),
    237   created_pcutoff_ (false),
    238   doFBBT_       (p. doFBBT_),
    239   doOBBT_       (p. doOBBT_),
    240   doABT_        (p. doABT_),
    241   logObbtLev_   (p. logObbtLev_),
    242   logAbtLev_    (p. logAbtLev_),
    243   jnlst_        (p.jnlst_),
    244   opt_window_   (p.opt_window_),    // needed only in standardize (), unnecessary to update it
    245   useQuadratic_ (p.useQuadratic_),  // ditto
    246   feas_tolerance_ (p.feas_tolerance_),
    247   dependence_   (p.dependence_),
    248   objects_      (p.objects_),
    249   integerRank_  (NULL),
    250   numberInRank_ (p.numberInRank_),
    251   maxCpuTime_   (p.maxCpuTime_),
    252   bonBase_      (p.bonBase_) {
    253 
    254   for (int i=0; i < p.nVars (); i++)
    255     variables_ . push_back (NULL);
    256 
    257   for (int i=0; i < p.nVars (); i++) {
    258     int ind = p.numbering_ [i];
    259     variables_ [ind] = p.Var (ind) -> clone (&domain_);
    260   }
    261 
    262   if (p.numbering_)
    263     numbering_ = CoinCopyOfArray (p.numbering_, nVars ());
    264 
    265   // clone objectives and constraints (there's a leak around here)
    266   for (int i=0; i < p.nObjs (); i++) objectives_  . push_back (p.Obj (i) -> clone (&domain_));
    267   for (int i=0; i < p.nCons (); i++) constraints_ . push_back (p.Con (i) -> clone (&domain_));
    268 
    269   if (p.optimum_)
    270     optimum_ = CoinCopyOfArray (p.optimum_, nVars ());
    271    
    272   // clear all spurious variables pointers not referring to the variables_ vector
    273   realign ();
    274 
    275   // copy integer rank (used in getIntegerCandidate)
    276   if (p.integerRank_) {
    277     integerRank_ = new int [nVars ()];
    278     CoinCopyN (p.integerRank_, nVars (), integerRank_);
    279   }
    280 }
    281 
    282 
    283 /// Destructor
    284 
    285 CouenneProblem::~CouenneProblem () {
    286 
    287   // delete optimal solution (if any)
    288   if (optimum_)
    289     free (optimum_);
    290 
    291   // delete objectives
    292   for (std::vector <CouenneObjective *>::iterator i  = objectives_ . begin ();
    293        i != objectives_ . end (); ++i)
    294     delete (*i);
    295 
    296   // delete constraints
    297   for (std::vector <CouenneConstraint *>::iterator i = constraints_ . begin ();
    298        i != constraints_ . end (); ++i)
    299     delete (*i);
    300 
    301   // delete variables
    302   //for (std::vector <exprVar *>::iterator i = variables_ . begin ();
    303   //i != variables_ . end (); ++i)
    304   //delete (*i);
    305 
    306   for (int i=nVars (); i--;) { // delete in inverse order
    307     int ind = numbering_ [i];
    308     delete variables_ [ind];
    309   }
    310 
    311   // delete extra structures
    312   if (graph_)     delete    graph_;
    313   if (commuted_)  delete [] commuted_;
    314   if (numbering_) delete [] numbering_;
    315 
    316   if (created_pcutoff_) delete pcutoff_;
    317 
    318   if (integerRank_) delete [] integerRank_;
    319 }
    320 
    32130
    32231/// methods to add objective function.
  • trunk/Couenne/src/problem/CouenneProblem.hpp

    r70 r103  
    44 * Purpose: define the class CouenneProblem
    55 *
    6  * (C) Carnegie-Mellon University, 2006-08.
     6 * (C) Carnegie-Mellon University, 2006-09.
    77 * This file is licensed under the Common Public License (CPL)
    88 */
     
    172172  Bonmin::BabSetupBase *bonBase_;
    173173
     174#ifdef COIN_HAS_ASL
     175  /// AMPL structure pointer (temporary --- looking forward to embedding into OS...)
     176  ASL *asl_;
     177#endif
     178
     179  /// some originals may be unused due to their zero multiplicity
     180  /// (that happens when they are duplicates). This array keeps track
     181  /// of their indices and is sorted by evaluation order
     182  int *unusedOriginalsIndices_;
     183
     184  /// number of unused originals
     185  int nUnusedOriginals_;
     186
    174187 public:
    175188
    176   CouenneProblem  (const ASL * = NULL,
     189  CouenneProblem  (ASL * = NULL,
    177190                   Bonmin::BabSetupBase *base = NULL,
    178191                   JnlstPtr jnlst = NULL);  ///< Constructor
     
    458471  }
    459472
     473  /// Some originals may be unused due to their zero multiplicity
     474  /// (that happens when they are duplicates). This procedure creates
     475  /// a structure for quickly checking and restoring their value after
     476  /// solving.
     477  void createUnusedOriginals ();
     478
     479  /// Some originals may be unused due to their zero multiplicity (that
     480  /// happens when they are duplicates). This procedure restores their
     481  /// value after solving
     482  void restoreUnusedOriginals (CouNumber * = NULL) const;
     483
     484  /// return indices of neglected redundant variables
     485  int *unusedOriginalsIndices () {return unusedOriginalsIndices_;}
     486
     487  /// number of unused originals
     488  int nUnusedOriginals ()        {return nUnusedOriginals_;}
     489
    460490protected:
    461491
  • trunk/Couenne/src/problem/CouenneSolverInterface.cpp

    r1 r103  
    55 * Purpose: Implementation of the OsiSolverInterface::resolve () method
    66 *
    7  * (C) Carnegie-Mellon University, 2006-08.
     7 * (C) Carnegie-Mellon University, 2006-09.
    88 * This file is licensed under the Common Public License (CPL)
    99 */
     
    2020  cutgen_ (cg),
    2121  knowInfeasible_(false),
    22   knowOptimal_(false)
    23 {
     22  knowOptimal_(false) {
     23
    2424  // prevents from running OsiClpSolverInterface::tightenBounds()
    2525  specialOptions_ = specialOptions_ | 262144;
     
    3333  cutgen_ (src.cutgen_),
    3434  knowInfeasible_ (src.knowInfeasible_),
    35   knowOptimal_ (src.knowOptimal_)
    36 {}
     35  knowOptimal_ (src.knowOptimal_) {}
    3736
    3837/// Destructor
     
    5453            cutgen_ -> Problem () -> print ();*/
    5554
    56   knowInfeasible_ = false;
    57   knowOptimal_ = false;
     55  knowInfeasible_ =
     56  knowOptimal_    = false;
    5857
    5958  OsiClpSolverInterface::initialSolve ();
    6059  //writeLp ("initialLP");
    61 }
    62 
    63 bool CouenneSolverInterface::isProvenPrimalInfeasible() const
    64 {
    65   if (knowInfeasible_) {
    66     return true;
    67   }
    68   return OsiClpSolverInterface::isProvenPrimalInfeasible();
    69 }
    70 
    71 bool CouenneSolverInterface::isProvenOptimal() const
    72 {
    73   if (knowOptimal_) {
    74     return true;
    75   }
    76   return OsiClpSolverInterface::isProvenOptimal();
     60
     61  // some originals may be unused due to their zero multiplicity (that
     62  // happens when they are duplicates), restore their value
     63  CouNumber *x = new CouNumber [getNumCols ()];
     64  CoinCopyN (getColSolution (), getNumCols (), x);
     65  cutgen_ -> Problem () -> restoreUnusedOriginals (x);
     66  setColSolution (x);
     67  delete [] x;
     68
     69  /*
     70    printf ("------------------------------------- INITSOLV\n");
     71  for (int i=0; i<cutgen_ -> Problem () -> nOrigVars (); i++)
     72    //if (cutgen_ -> Problem () -> Var (i) -> Multiplicity () <= 0)
     73      {
     74      printf ("%4d. %20.5g [%20.5g %20.5g]   ",
     75              i, getColSolution () [i],
     76              getColLower () [i],
     77              getColUpper () [i]);
     78      cutgen_ -> Problem () -> Var (i) -> print ();
     79      printf ("\n");
     80    }
     81  */
     82}
     83
     84bool CouenneSolverInterface::isProvenPrimalInfeasible() const {
     85  return knowInfeasible_ || OsiClpSolverInterface::isProvenPrimalInfeasible();
     86}
     87
     88bool CouenneSolverInterface::isProvenOptimal() const {
     89  return knowOptimal_ || OsiClpSolverInterface::isProvenOptimal();
    7790}
    7891
     
    134147  OsiClpSolverInterface::resolve ();
    135148
     149  // some originals may be unused due to their zero multiplicity (that
     150  // happens when they are duplicates), restore their value
     151  CouNumber *x = new CouNumber [getNumCols ()];
     152  CoinCopyN (getColSolution (), getNumCols (), x);
     153  cutgen_ -> Problem () -> restoreUnusedOriginals (x);
     154  setColSolution (x);
     155  delete [] x;
     156
     157  //cutgen_ -> Problem () -> restoreUnusedOriginals (this);
     158
    136159  // check LP independently
    137160  if (cutgen_ && (cutgen_ -> check_lp ())) {
     
    187210    //filename, isProvenOptimal () ? "current" : "saved");
    188211  }
    189 
    190212}
    191213
     
    299321  resolve();
    300322
     323  // some originals may be unused due to their zero multiplicity (that
     324  // happens when they are duplicates), restore their value
     325  CouNumber *x = new CouNumber [getNumCols ()];
     326  CoinCopyN (getColSolution (), getNumCols (), x);
     327  cutgen_ -> Problem () -> restoreUnusedOriginals (x);
     328  setColSolution (x);
     329  delete [] x;
     330
    301331  if (isProvenPrimalInfeasible ()) knowInfeasible_ = true;
    302332  if (isProvenOptimal ())          knowOptimal_    = true;
  • trunk/Couenne/src/problem/CouenneSolverInterface.hpp

    r1 r103  
    8080  //@}
    8181
    82   /// tighten bounds on all variables (including continuous)
     82  /// Tighten bounds on all variables (including continuous).
    8383  virtual int tightenBounds (int lightweight);
    8484
    85   /// Returns pointer to CLP structure
     85  /// Returns pointer to CLP structure.
    8686  ClpSimplex *continuousModel ()
    8787  {return continuousModel_;}
  • trunk/Couenne/src/problem/Makefile.am

    r96 r103  
    2525        testIntFix.cpp \
    2626        CouenneSOS.cpp \
     27        CouenneProblemConstructors.cpp \
     28        CouenneRestoreUnused.cpp \
     29        reformulate.cpp \
    2730        depGraph/depGraph.cpp \
    2831        depGraph/checkCycles.cpp
  • trunk/Couenne/src/problem/Makefile.in

    r96 r103  
    6868        fillQuadIndices.lo fillDependence.lo CouenneSolverInterface.lo \
    6969        CouenneLPtightenBounds.lo checkNLP.lo getIntegerCandidate.lo \
    70         testIntFix.lo CouenneSOS.lo depGraph.lo checkCycles.lo
     70        testIntFix.lo CouenneSOS.lo CouenneProblemConstructors.lo \
     71        CouenneRestoreUnused.lo reformulate.lo depGraph.lo \
     72        checkCycles.lo
    7173libCouenneProblem_la_OBJECTS = $(am_libCouenneProblem_la_OBJECTS)
    7274DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/inc
     
    290292        testIntFix.cpp \
    291293        CouenneSOS.cpp \
     294        CouenneProblemConstructors.cpp \
     295        CouenneRestoreUnused.cpp \
     296        reformulate.cpp \
    292297        depGraph/depGraph.cpp \
    293298        depGraph/checkCycles.cpp
     
    367372@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CouenneLPtightenBounds.Plo@am__quote@
    368373@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CouenneProblem.Plo@am__quote@
     374@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CouenneProblemConstructors.Plo@am__quote@
     375@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CouenneRestoreUnused.Plo@am__quote@
    369376@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CouenneSOS.Plo@am__quote@
    370377@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CouenneSolverInterface.Plo@am__quote@
     
    378385@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/problem.Plo@am__quote@
    379386@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/problemIO.Plo@am__quote@
     387@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reformulate.Plo@am__quote@
    380388@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testIntFix.Plo@am__quote@
    381389@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/writeAMPL.Plo@am__quote@
  • trunk/Couenne/src/problem/getIntegerCandidate.cpp

    r25 r103  
    266266
    267267    // save tightened bounds in NLP space. Sanity check
    268     for (int i = nOrigVars_; i--;) 
     268    for (int i = nOrigVars_; i--;)
    269269      if (Var (i) -> Multiplicity () > 0) {
    270270
     
    285285        }
    286286      }
     287
     288    restoreUnusedOriginals (xInt);
    287289
    288290    // if initial point is feasible, compute corresponding objective
  • trunk/Couenne/src/standardize/standardize.cpp

    r75 r103  
    351351      Var (i) -> setInteger (true);
    352352
    353     if (Var (i) -> Multiplicity () == 0)
    354       Lb (i) = Ub (i) = 0.;
     353    //if (Var (i) -> Multiplicity () == 0)
     354    //Lb (i) = Ub (i) = 0.;
    355355  }
    356356
Note: See TracChangeset for help on using the changeset viewer.