- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

BlisConstraint.h
Go to the documentation of this file.
1 /*===========================================================================*
2 * This file is part of the Bcps Linear Solver (BLIS). *
3 * *
4 * BLIS is distributed under the Eclipse Public License as part of the *
5 * COIN-OR repository (http://www.coin-or.org). *
6 * *
7 * Authors: *
8 * *
9 * Yan Xu, Lehigh University *
10 * Ted Ralphs, Lehigh University *
11 * *
12 * Conceptual Design: *
13 * *
14 * Yan Xu, Lehigh University *
15 * Ted Ralphs, Lehigh University *
16 * Laszlo Ladanyi, IBM T.J. Watson Research Center *
17 * Matthew Saltzman, Clemson University *
18 * *
19 * *
20 * Copyright (C) 2001-2013, Lehigh University, Yan Xu, and Ted Ralphs. *
21 * All Rights Reserved. *
22 *===========================================================================*/
23
24 #ifndef BlisConstraint_h_
25 #define BlisConstraint_h_
26
27 #include "BcpsObject.h"
28
29 //#############################################################################
30
31 class BlisConstraint : public BcpsConstraint {
32
33 private:
34
35 int size_;
36 int *indices_;
37 double *values_;
38
39 public:
40
42 BlisConstraint();
43
45 BlisConstraint(int s, const int *ind, const double *val);
46
48 BlisConstraint(double lbh, double ubh, double lbs, double ubs);
49
51 BlisConstraint(double lbh, double ubh, double lbs, double ubs,
52 int s, const int *ind, const double *val);
54 virtual ~BlisConstraint();
55
57 BlisConstraint(const BlisConstraint & rhs);
58
61 int getSize() const { return size_; }
62 int* getIndices() const { return indices_; }
63 double* getValues() const { return values_; }
68 void setData(int s, const int *ind, const double *val) {
69 if (size_ < s) {
70 delete [] indices_;
71 delete [] values_;
72 indices_ = new int [s];
73 values_ = new double [s];
74 }
75 size_ = s;
76 memcpy(indices_, ind, sizeof(int) * s);
77 memcpy(values_, val, sizeof(double) * s);
78 }
81 protected:
82
84 AlpsReturnStatus encodeBlis(AlpsEncoded *encoded);
85
87 AlpsReturnStatus decodeBlis(AlpsEncoded &encoded);
88
89 public:
90
92 virtual AlpsReturnStatus encode(AlpsEncoded *encoded);
93
95 virtual AlpsKnowledge* decode(AlpsEncoded& encoded) const;
96
98 virtual void hashing(BcpsModel *model=NULL);
99 };
100
101 //#############################################################################
102
103 #endif
BlisConstraint::values_
double * values_
Value of nonzero coefficients.
Definition: BlisConstraint.h:37
BlisConstraint::decode
virtual AlpsKnowledge * decode(AlpsEncoded &encoded) const
Decode a constraint from an encoded object.
BlisConstraint::setData
void setData(int s, const int *ind, const double *val)
Set data.
Definition: BlisConstraint.h:68
BlisConstraint::getIndices
int * getIndices() const
Return data.
Definition: BlisConstraint.h:62
AlpsReturnStatus
AlpsReturnStatus
Definition: Alps.h:118
BlisConstraint::BlisConstraint
BlisConstraint()
Default constructor.
BlisConstraint::getValues
double * getValues() const
Return data.
Definition: BlisConstraint.h:63
BlisConstraint::indices_
int * indices_
Variable indices.
Definition: BlisConstraint.h:36
AlpsEncoded
This data structure is to contain the packed form of an encodable knowledge.
Definition: AlpsEncoded.h:25
BlisConstraint::getSize
int getSize() const
Return data.
Definition: BlisConstraint.h:61
BcpsConstraint
Definition: BcpsObject.h:355
BlisConstraint::size_
int size_
Number of nonzero coefficients.
Definition: BlisConstraint.h:35
BcpsObject.h
BlisConstraint::decodeBlis
AlpsReturnStatus decodeBlis(AlpsEncoded &encoded)
Unpack Blis part from a encode object.
BcpsModel
Definition: BcpsModel.h:40
BlisConstraint::~BlisConstraint
virtual ~BlisConstraint()
Destructor.
BlisConstraint::encodeBlis
AlpsReturnStatus encodeBlis(AlpsEncoded *encoded)
Pack Blis part into an encoded object.
AlpsKnowledge
The abstract base class of any user-defined class that Alps has to know about in order to encode/deco...
Definition: AlpsKnowledge.h:51
BlisConstraint
Definition: BlisConstraint.h:31
BlisConstraint::hashing
virtual void hashing(BcpsModel *model=NULL)
Compute a hash key.
AlpsKnowledge::encode
virtual AlpsEncoded * encode() const
This method should encode the content of the object and return a pointer to the encoded form...