Dip  0.92.4
BcpsDecompSolution.h
Go to the documentation of this file.
1 //===========================================================================//
2 // This file is part of the Decomp Solver Framework. //
3 // //
4 // Decomp is distributed under the Common Public License as part of the //
5 // COIN-OR repository (http://www.coin-or.org). //
6 // //
7 // Author: Matthew Galati, SAS Institute Inc. (matthew.galati@sas.com) //
8 // //
9 // Copyright (C) 2002-2007, Lehigh University, Matthew Galati, and Ted Ralphs//
10 // All Rights Reserved. //
11 //===========================================================================//
12 
13 /*===========================================================================*
14  * This file is part of the Abstract Library for Parallel Search (ALPS). *
15  * *
16  * ALPS is distributed under the Common Public License as part of the *
17  * COIN-OR repository (http://www.coin-or.org). *
18  * *
19  * Authors: Yan Xu, SAS Institute Inc. *
20  * Ted Ralphs, Lehigh University *
21  * Laszlo Ladanyi, IBM T.J. Watson Research Center *
22  * Matthew Saltzman, Clemson University *
23  * *
24  * *
25  * Copyright (C) 2001-2006, Lehigh University, Yan Xu, and Ted Ralphs. *
26  *===========================================================================*/
27 
28 #ifndef BcpsDecompSolution_h
29 #define BcpsDecompSolution_h
30 
31 #include "AlpsSolution.h"
32 #include "BcpsDecompModel.h"
33 
36  private:
37  int size_;
38  double* value_;
39  double objective_;
40 
41  public:
43  :
44  size_(0),
45  value_(0),
46  objective_()
47  {}
48  BcpsDecompSolution(const int s, const double* val, const double obj)
49  :
50  size_(s)
51  {
52  if (size_ >= 0) {
53  value_ = new double [size_];
54  memcpy(value_, val, sizeof(double) * size_);
55  }
56  }
57 
59  if (value_ != 0) {
60  delete [] value_;
61  value_ = 0;
62  }
63  }
64 
66  double getObjValue() const { return objective_; }
67 
68  virtual double getQuality() const { return getObjValue(); }
69 
71  int getSize() const { return size_; }
72 
74  const double* getColSolution() const
75  { return value_; }
76 
78  double getColSolution(int i) const { return value_[i]; }
79 
81  virtual void print(std::ostream& os) const;
82 
83 #if 0
84 
85  virtual AlpsEncoded* encode() const;
86 
88  virtual AlpsKnowledge* decode(AlpsEncoded&) const;
89 #endif
90 };
91 
92 #endif
virtual AlpsKnowledge * decode(AlpsEncoded &encoded) const
This method should decode and return a pointer to a brand new object, i.e., the method must create a ...
virtual double getQuality() const
const double * getColSolution() const
Get the column solution.
double getObjValue() const
Get the objective value value.
This class holds a MIP feasible primal solution.
BcpsDecompSolution(const int s, const double *val, const double obj)
This data structure is to contain the packed form of an encodable knowledge.
Definition: AlpsEncoded.h:25
virtual void print(std::ostream &os) const
Print out the solution.
double getColSolution(int i) const
Get item i in the solution vector.
int getSize() const
Get the size of the solution.
The abstract base class of any user-defined class that Alps has to know about in order to encode/deco...
Definition: AlpsKnowledge.h:51
virtual AlpsEncoded * encode() const
This method should encode the content of the object and return a pointer to the encoded form...