@@ -9,24 +9,24 @@ namespace linspire
99 utils::inf_rational var::get_lb () const noexcept { return lbs.empty () ? utils::rational::negative_infinite : lbs.rbegin ()->first ; }
1010 utils::inf_rational var::get_ub () const noexcept { return ubs.empty () ? utils::rational::positive_infinite : ubs.begin ()->first ; }
1111
12- void var::set_lb (const utils::inf_rational &v, std::optional<std::reference_wrapper<constraint>> reason) noexcept
12+ void var::set_lb (const utils::inf_rational &v, std::optional<std::reference_wrapper<const constraint>> reason) noexcept
1313 {
1414 assert (v <= get_ub ()); // we cannot set a lower bound greater than the current upper bound..
1515 if (reason)
1616 { // we add a new lower bound `v` with the given reason..
1717 if (auto it = lbs.find (v); it != lbs.end ())
1818 it->second .insert (&reason->get ()); // we add the reason to the existing lower bound `v`..
1919 else
20- lbs.emplace (v, std::set<constraint *>{&reason->get ()}); // we create a new lower bound `v`..
20+ lbs.emplace (v, std::set<const constraint *>{&reason->get ()}); // we create a new lower bound `v`..
2121 }
2222 else
2323 { // we remove all the lower bounds that are less than `v`..
2424 auto it = lbs.upper_bound (v);
2525 lbs.erase (lbs.begin (), it);
26- lbs.emplace (v, std::set<constraint *>());
26+ lbs.emplace (v, std::set<const constraint *>());
2727 }
2828 }
29- void var::unset_lb (const utils::inf_rational &v, constraint &reason) noexcept
29+ void var::unset_lb (const utils::inf_rational &v, const constraint &reason) noexcept
3030 {
3131 assert (lbs.find (v) != lbs.end ());
3232 auto it = lbs.find (v);
@@ -35,24 +35,24 @@ namespace linspire
3535 lbs.erase (it);
3636 }
3737
38- void var::set_ub (const utils::inf_rational &v, std::optional<std::reference_wrapper<constraint>> reason) noexcept
38+ void var::set_ub (const utils::inf_rational &v, std::optional<std::reference_wrapper<const constraint>> reason) noexcept
3939 {
4040 assert (v >= get_lb ()); // we cannot set an upper bound less than the current lower bound..
4141 if (reason)
4242 { // we add a new upper bound `v` with the given reason..
4343 if (auto it = ubs.find (v); it != ubs.end ())
4444 it->second .insert (&reason->get ()); // we add the reason to the existing upper bound `v`..
4545 else
46- ubs.emplace (v, std::set<constraint *>{&reason->get ()}); // we create a new upper bound `v`..
46+ ubs.emplace (v, std::set<const constraint *>{&reason->get ()}); // we create a new upper bound `v`..
4747 }
4848 else
4949 { // we remove all the upper bounds that are greater than `v`..
5050 auto it = ubs.lower_bound (v);
5151 ubs.erase (it, ubs.end ());
52- ubs.emplace (v, std::set<constraint *>());
52+ ubs.emplace (v, std::set<const constraint *>());
5353 }
5454 }
55- void var::unset_ub (const utils::inf_rational &v, constraint &reason) noexcept
55+ void var::unset_ub (const utils::inf_rational &v, const constraint &reason) noexcept
5656 {
5757 assert (ubs.find (v) != ubs.end ());
5858 auto it = ubs.find (v);
0 commit comments