Linear expressions over integer variables
| 243 | |
| 244 | /// Linear expressions over integer variables |
| 245 | class LinIntExpr { |
| 246 | friend class LinIntRel; |
| 247 | #ifdef GECODE_HAS_SET_VARS |
| 248 | friend class SetExpr; |
| 249 | #endif |
| 250 | #ifdef GECODE_HAS_FLOAT_VARS |
| 251 | friend class LinFloatExpr; |
| 252 | #endif |
| 253 | public: |
| 254 | /// Type of linear expression |
| 255 | enum NodeType { |
| 256 | NT_CONST, ///< Integer constant |
| 257 | NT_VAR_INT, ///< Linear term with integer variable |
| 258 | NT_VAR_BOOL, ///< Linear term with Boolean variable |
| 259 | NT_NONLIN, ///< Non-linear expression |
| 260 | NT_SUM_INT, ///< Sum of integer variables |
| 261 | NT_SUM_BOOL, ///< Sum of Boolean variables |
| 262 | NT_ADD, ///< Addition of linear terms |
| 263 | NT_SUB, ///< Subtraction of linear terms |
| 264 | NT_MUL ///< Multiplication by coefficient |
| 265 | }; |
| 266 | private: |
| 267 | /// Nodes for linear expressions |
| 268 | class Node; |
| 269 | /// The actual node |
| 270 | Node* n; |
| 271 | public: |
| 272 | /// Default constructor |
| 273 | GECODE_MINIMODEL_EXPORT |
| 274 | LinIntExpr(void); |
| 275 | /// Create expression for constant \a c |
| 276 | GECODE_MINIMODEL_EXPORT |
| 277 | LinIntExpr(int c); |
| 278 | /// Create expression |
| 279 | GECODE_MINIMODEL_EXPORT |
| 280 | LinIntExpr(const IntVar& x, int a=1); |
| 281 | /// Create expression |
| 282 | GECODE_MINIMODEL_EXPORT |
| 283 | LinIntExpr(const BoolVar& x, int a=1); |
| 284 | /// Create sum expression |
| 285 | GECODE_MINIMODEL_EXPORT |
| 286 | explicit LinIntExpr(const IntVarArgs& x); |
| 287 | /// Create sum expression |
| 288 | GECODE_MINIMODEL_EXPORT |
| 289 | LinIntExpr(const IntArgs& a, const IntVarArgs& x); |
| 290 | /// Create sum expression |
| 291 | GECODE_MINIMODEL_EXPORT |
| 292 | explicit LinIntExpr(const BoolVarArgs& x); |
| 293 | /// Create sum expression |
| 294 | GECODE_MINIMODEL_EXPORT |
| 295 | LinIntExpr(const IntArgs& a, const BoolVarArgs& x); |
| 296 | /// Copy constructor |
| 297 | GECODE_MINIMODEL_EXPORT |
| 298 | LinIntExpr(const LinIntExpr& e); |
| 299 | /// Create expression for type and subexpressions |
| 300 | GECODE_MINIMODEL_EXPORT |
| 301 | LinIntExpr(const LinIntExpr& e0, NodeType t, const LinIntExpr& e1); |
| 302 | /// Create expression for type and subexpression |
no outgoing calls
no test coverage detected