00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "CouenneGlobalCutOff.hpp"
00013
00014 #include "CoinFinite.hpp"
00015 #include "CoinHelperFunctions.hpp"
00016
00017 using namespace Couenne;
00018
00019 GlobalCutOff::GlobalCutOff ():
00020 cutoff_ (COIN_DBL_MAX),
00021 sol_ (NULL),
00022 size_ (0),
00023 valid_ (false) {}
00024
00025 GlobalCutOff::GlobalCutOff (double c, const double *s, int n):
00026 cutoff_ (c),
00027 sol_ (NULL),
00028 size_ (n),
00029 valid_ (false) {
00030 if (s) {
00031 sol_ = CoinCopyOfArray (s, n);
00032 size_ = n;
00033 valid_ = true;
00034 }
00035 }
00036
00037
00038 GlobalCutOff::~GlobalCutOff ()
00039 {if (sol_) delete [] sol_;}
00040
00041
00042 void GlobalCutOff::setCutOff (const CouenneProblem *p, double cutoff, const double *s) {
00043
00044 cutoff_ = cutoff;
00045
00046 valid_ = (s != NULL);
00047
00048 if (s) {
00049
00050 if (!sol_)
00051 sol_ = new CouNumber [size_ = p -> nVars ()];
00052
00053 CoinCopyN (s, p -> nOrigVars (), sol_);
00054 CoinFillN (sol_ + p -> nOrigVars (), p -> nVars () - p -> nOrigVars (), 0.);
00055
00056 p -> getAuxs (sol_);
00057 }
00058 }