Google OR-Tools: ortools/linear_solver/linear_expr.h Source File

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef ORTOOLS_LINEAR_SOLVER_LINEAR_EXPR_H_

15#define ORTOOLS_LINEAR_SOLVER_LINEAR_EXPR_H_

16

78

79#include <ostream>

80#include <string>

81

82#include "absl/container/flat_hash_map.h"

83

85

86

87

89

115 public:

118 LinearExpr(double constant);

119

120

121

122

123

124

126

135

141

142 double offset() const { return offset_; }

143 const absl::flat_hash_map<const MPVariable*, double>& terms() const {

144 return terms_;

145 }

146

153

158 std::string ToString() const;

159

160 private:

161 double offset_;

162 absl::flat_hash_map<const MPVariable*, double> terms_;

163};

164

165std::ostream& operator<<(std::ostream& stream, const LinearExpr& linear_expr);

166

167

168

169

170

171

172

173

174LinearExpr operator+(LinearExpr lhs, const LinearExpr& rhs);

175LinearExpr operator-(LinearExpr lhs, const LinearExpr& rhs);

176LinearExpr operator*(LinearExpr lhs, double rhs);

177LinearExpr operator/(LinearExpr lhs, double rhs);

178LinearExpr operator*(double lhs, LinearExpr rhs);

179

193 public:

204

208

209 private:

210 double lower_bound_;

211

213 double upper_bound_;

214};

215

216LinearRange operator<=(const LinearExpr& lhs, const LinearExpr& rhs);

217LinearRange operator==(const LinearExpr& lhs, const LinearExpr& rhs);

218LinearRange operator>=(const LinearExpr& lhs, const LinearExpr& rhs);

219

220

221

222

223}

224

225#endif

double SolutionValue() const

LinearExpr operator-() const

LinearExpr & operator/=(double rhs)

const absl::flat_hash_map< const MPVariable *, double > & terms() const

Definition linear_expr.h:143

std::string ToString() const

LinearExpr & operator+=(const LinearExpr &rhs)

static LinearExpr NotVar(LinearExpr var)

LinearExpr & operator-=(const LinearExpr &rhs)

LinearExpr & operator*=(double rhs)

double offset() const

Definition linear_expr.h:142

double upper_bound() const

Definition linear_expr.h:207

const LinearExpr & linear_expr() const

Definition linear_expr.h:206

LinearRange()

Definition linear_expr.h:194

double lower_bound() const

Definition linear_expr.h:205

The class for variables of a Mathematical Programming (MP) model.

LinearRange operator==(const LinearExpr &lhs, const LinearExpr &rhs)

LinearExpr operator*(LinearExpr lhs, double rhs)

LinearExpr operator-(LinearExpr lhs, const LinearExpr &rhs)

LinearRange operator<=(const LinearExpr &lhs, const LinearExpr &rhs)

std::ostream & operator<<(std::ostream &out, const Assignment &assignment)

LinearExpr operator+(LinearExpr lhs, const LinearExpr &rhs)

LinearExpr operator/(LinearExpr lhs, double rhs)

LinearRange operator>=(const LinearExpr &lhs, const LinearExpr &rhs)