Blis 0.95.0
Loading...
Searching...
No Matches
BlisConstraint.h
Go to the documentation of this file.
1/*===========================================================================*
2 * This file is part of the BiCePS Linear Integer 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-2023, 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#include "BlisConfig.h"
29
30class OsiRowCut;
31
32//#############################################################################
33
34class BLISLIB_EXPORT BlisConstraint : public BcpsConstraint {
35
36 protected:
38 int size_;
42 double *values_;
43
44 public:
45
48
50 BlisConstraint(int s, const int *ind, const double *val);
51
53 BlisConstraint(double lbh, double ubh, double lbs, double ubs);
54
56 BlisConstraint(double lbh, double ubh, double lbs, double ubs,
57 int size, const int *ind, const double *val);
59 virtual ~BlisConstraint();
60
63
66 int getSize() const { return size_; }
67 int* getIndices() const { return indices_; }
68 double* getValues() const { return values_; }
73 void setData(int s, const int *ind, const double *val) {
74 if (size_ < s) {
75 delete [] indices_;
76 delete [] values_;
77 indices_ = new int [s];
78 values_ = new double [s];
79 }
80 size_ = s;
81 memcpy(indices_, ind, sizeof(int) * s);
82 memcpy(values_, val, sizeof(double) * s);
83 }
86 protected:
87
89 AlpsReturnStatus encodeBlis(AlpsEncoded *encoded);
90
92 AlpsReturnStatus decodeBlis(AlpsEncoded &encoded);
93
94 public:
95
97 OsiRowCut *createOsiRowCut();
98
100 virtual void hashing(BcpsModel *model=NULL);
101
103 double violation(const double *lpSolution);
104
105 using AlpsKnowledge::encode ;
107 virtual AlpsReturnStatus encode(AlpsEncoded *encoded);
108
110 virtual AlpsKnowledge* decode(AlpsEncoded& encoded) const;
111};
112
113//#############################################################################
114
115#endif
int size_
Number of nonzero coefficients.
virtual void hashing(BcpsModel *model=NULL)
Compute a hash key.
BlisConstraint(double lbh, double ubh, double lbs, double ubs)
Useful constructor.
BlisConstraint()
Default constructor.
double * getValues() const
double violation(const double *lpSolution)
Check if violates a given lp solution.
AlpsReturnStatus decodeBlis(AlpsEncoded &encoded)
Unpack Blis part from a encode object.
virtual ~BlisConstraint()
Destructor.
virtual AlpsKnowledge * decode(AlpsEncoded &encoded) const
Decode a constraint from an encoded object.
BlisConstraint(double lbh, double ubh, double lbs, double ubs, int size, const int *ind, const double *val)
Useful constructor.
BlisConstraint(const BlisConstraint &rhs)
Copy constructor.
int * indices_
Variable indices.
void setData(int s, const int *ind, const double *val)
Set data
virtual AlpsReturnStatus encode(AlpsEncoded *encoded)
Pack into a encode object.
double * values_
Value of nonzero coefficients.
BlisConstraint(int s, const int *ind, const double *val)
Useful constructor.
AlpsReturnStatus encodeBlis(AlpsEncoded *encoded)
Pack Blis part into an encoded object.
OsiRowCut * createOsiRowCut()
Create a OsiRowCut based on this constraint.
int getSize() const
Return data
int * getIndices() const
#define BLISLIB_EXPORT
Definition config.h:5