| 84 | } |
| 85 | |
| 86 | void Bound::set_bound(BoundType type, double value) |
| 87 | { |
| 88 | switch (type) |
| 89 | { |
| 90 | case FIXED: |
| 91 | bound_type_ = FIXED; |
| 92 | lower_bound_ = upper_bound_ = value; |
| 93 | break; |
| 94 | |
| 95 | case LOWER: |
| 96 | bound_type_ = LOWER; |
| 97 | lower_bound_ = value; |
| 98 | break; |
| 99 | case UPPER: |
| 100 | bound_type_ = UPPER; |
| 101 | upper_bound_ = value; |
| 102 | break; |
| 103 | |
| 104 | case DOUBLE: |
| 105 | std::cerr << "Warning: please use \'set_bounds()\' to set DOUBLE bound" << std::endl; |
| 106 | break; |
| 107 | |
| 108 | case FREE: |
| 109 | lower_bound_ = -infinity_; // adjust the bound value |
| 110 | upper_bound_ = +infinity_; // adjust the bound value |
| 111 | bound_type_ = FREE; |
| 112 | break; |
| 113 | default: |
| 114 | std::cerr << "fatal error: unrecognized bound type" << std::endl; |
| 115 | break; |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | // query the single bound according to its bound type |
| 120 | double Bound::get_bound() const { |