Skip to content

Commit 5fc932f

Browse files
authored
Merge pull request #194 from KnorpelSenf/verbose
feat: add set_display_verbosity and show_output
2 parents bf71eb7 + 8957caf commit 5fc932f

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/model.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,15 +1217,27 @@ impl<T> Model<T> {
12171217
self.scip.print_version()
12181218
}
12191219

1220-
/// Hides the output of the optimization model by setting the `display/verblevel` parameter to 0.
1220+
/// Sets the `display/verblevel` parameter to the provided value.
12211221
#[allow(unused_mut)]
1222-
pub fn hide_output(mut self) -> Self {
1222+
pub fn set_display_verbosity(mut self, level: i32) -> Self {
12231223
self.scip
1224-
.set_int_param("display/verblevel", 0)
1225-
.expect("Failed to set display/verblevel to 0");
1224+
.set_int_param("display/verblevel", level)
1225+
.unwrap_or_else(|_| panic!("Failed to set display/verblevel to {level}"));
12261226
self
12271227
}
12281228

1229+
/// Shows the output of the optimization model by setting the `display/verblevel` parameter to its default value 4.
1230+
#[allow(unused_mut)]
1231+
pub fn show_output(mut self) -> Self {
1232+
self.set_display_verbosity(4)
1233+
}
1234+
1235+
/// Hides the output of the optimization model by setting the `display/verblevel` parameter to 0.
1236+
#[allow(unused_mut)]
1237+
pub fn hide_output(mut self) -> Self {
1238+
self.set_display_verbosity(0)
1239+
}
1240+
12291241
/// Sets the time limit for the optimization model.
12301242
///
12311243
/// # Arguments

0 commit comments

Comments
 (0)