Blis 0.94
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-2019, 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
29class OsiRowCut;
30
31//#############################################################################
32
34
35 protected:
37 int size_;
41 double *values_;
42
43 public:
44
47
49 BlisConstraint(int s, const int *ind, const double *val);
50
52 BlisConstraint(double lbh, double ubh, double lbs, double ubs);
53
55 BlisConstraint(double lbh, double ubh, double lbs, double ubs,
56 int size, const int *ind, const double *val);
58 virtual ~BlisConstraint();
59
62
65 int getSize() const { return size_; }
66 int* getIndices() const { return indices_; }
67 double* getValues() const { return values_; }
72 void setData(int s, const int *ind, const double *val) {
73 if (size_ < s) {
74 delete [] indices_;
75 delete [] values_;
76 indices_ = new int [s];
77 values_ = new double [s];
78 }
79 size_ = s;
80 memcpy(indices_, ind, sizeof(int) * s);
81 memcpy(values_, val, sizeof(double) * s);
82 }
85 protected:
86
89
92
93 public:
94
96 OsiRowCut *createOsiRowCut();
97
99 virtual void hashing(BcpsModel *model=NULL);
100
102 double violation(const double *lpSolution);
103
107
109 virtual AlpsKnowledge* decode(AlpsEncoded& encoded) const;
110};
111
112//#############################################################################
113
114#endif
AlpsReturnStatus
virtual AlpsEncoded * encode() const
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