23 #ifndef BcpsSolution_h_
24 #define BcpsSolution_h_
70 memcpy(
values_, values,
sizeof(
double) * size);
73 std::cout <<
"ERROR: Solution size = " << size << std::endl;
90 for (
int i = 0; i <
size_; ++i) {
117 memcpy(
values_, vs, s *
sizeof(
double));
130 virtual void print(std::ostream& os)
const {
131 for (
int j = 0; j <
size_; ++j) {
133 os <<
"x[" << j <<
"] = " <<
values_[j] << std::endl;
virtual BcpsSolution * selectFractional(const double etol=1e-5) const
Select the fractional/nonzero elements from the solution array and return a new object in compacted f...
virtual void print(std::ostream &os) const
Print out the solution.
A class for describing the objects that comprise a BCPS subproblem.
BcpsSolution()
Default constructor.
void assignObjects(BcpsObject_p *&obj)
Set/assign the appropriate data member.
void setSize(int s)
Set/assign the appropriate data member.
AlpsReturnStatus decodeBcps(AlpsEncoded &encoded)
Unpack Bcps part of solution from an encoded objects.
double getQuality() const
Get the appropriate data member.
This class holds the solution objects.
const double * getValues() const
Get the appropriate data member.
This data structure is to contain the packed form of an encodable knowledge.
BcpsObject_p * objects_
List of objects associated with values.
double quality_
Quality/Objective value associated with this solution.
BcpsSolution(int size, BcpsObject_p *&objects, double *&values, double q)
Construct an object using the given arrays.
virtual BcpsSolution * selectNonzeros(const double etol=1e-5) const
Select the fractional/nonzero elements from the solution array and return a new object in compacted f...
AlpsReturnStatus encodeBcps(AlpsEncoded *encoded) const
Pack Bcps part of solution into an encoded objects.
void setQuality(double q)
Set/assign the appropriate data member.
double * values_
Solution values.
int getSize() const
Get the appropriate data member.
BcpsSolution & operator=(const BcpsSolution &)
const BcpsObject_p * getObjects() const
Get the appropriate data member.
virtual ~BcpsSolution()
Distructor.
void setValues(const double *vs, int s)
Set/assign the appropriate data member.
BcpsSolution(int size, const double *values, double q)
Useful constructor.
int size_
Size of values_.