File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,13 @@ struct Var {
48
48
* @return \c true iff the value of this variable in the primal solution is in range epsilon of 0.0.
49
49
*/
50
50
[[nodiscard]] bool isZero (const Solution& solution) const ;
51
+
52
+ /* *
53
+ * Checks whether an existing %SCIP variable is wrapped or the wrapper is empty.
54
+ * @since 1.2.0
55
+ * @return \c true iff the wrapper is empty
56
+ */
57
+ [[nodiscard]] bool isVoid () const ;
51
58
};
52
59
53
60
}
Original file line number Diff line number Diff line change @@ -26,4 +26,9 @@ bool Var::isZero(const Solution& solution) const
26
26
return SCIPisZero (solution.scip , getSolVal (solution));
27
27
}
28
28
29
+ bool Var::isVoid () const
30
+ {
31
+ return var == nullptr ;
32
+ }
33
+
29
34
}
Original file line number Diff line number Diff line change @@ -62,4 +62,16 @@ BOOST_AUTO_TEST_CASE(IsZero)
62
62
BOOST_TEST (model.isZero (x1.getSolVal (sol)));
63
63
}
64
64
65
+ BOOST_AUTO_TEST_CASE (IsVoid)
66
+ {
67
+ scippp::Var x;
68
+ BOOST_TEST (x.var == nullptr );
69
+ BOOST_TEST (x.isVoid ());
70
+
71
+ Model model (" Simple" );
72
+ auto x1 = model.addVar (" x_1" , 1 );
73
+ BOOST_TEST (x1.var != nullptr );
74
+ BOOST_TEST (!x1.isVoid ());
75
+ }
76
+
65
77
BOOST_AUTO_TEST_SUITE_END ()
You can’t perform that action at this time.
0 commit comments