1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! Wiring test for the μ-strategy auto-fallback switch (pounce#138).
//!
//! `optimize_tnlp` consults `mu_strategy_fallback` to decide
//! whether to retry a `Solved_To_Acceptable_Level` solve with the opposite
//! `mu_strategy`. This test pins the option's registration, its default (on since
//! pounce#748), and the
//! `"yes"`/`"no"` string round-trip the GAMS link depends on (the link
//! forwards unknown keys via `AddIpoptStrOption`, so the bool must accept the
//! string form). It does not run a solve — the end-to-end promotion is
//! exercised through the GAMS princetonlib instances in the issue.
use pounce_algorithm::application::IpoptApplication;
/// pounce#748 flipped this default from off to on. The registered default
/// and the `unwrap_or` fallback in
/// `IpoptApplication::is_mu_strategy_fallback_enabled` must agree, or the
/// behaviour depends on how the option table was built; this pins the
/// registered half.
#[test]
fn fallback_option_defaults_on() {
let mut app = IpoptApplication::new();
let (value, _found) = app
.options_mut()
.get_bool_value("mu_strategy_fallback", "")
.expect("option must be registered");
assert!(value, "μ-strategy fallback must default to on (pounce#748)");
}
#[test]
fn fallback_option_accepts_string_yes() {
// The GAMS link sets bool options via their string form ("yes"/"no");
// mirror that exact path rather than set_bool_value.
let mut app = IpoptApplication::new();
app.options_mut()
.set_string_value("mu_strategy_fallback", "yes", true, false)
.expect("string 'yes' must round-trip into the bool option");
let (value, found) = app
.options_mut()
.get_bool_value("mu_strategy_fallback", "")
.unwrap();
assert!(found && value, "after set 'yes', the switch reads true");
app.options_mut()
.set_string_value("mu_strategy_fallback", "no", true, false)
.unwrap();
let (value, _) = app
.options_mut()
.get_bool_value("mu_strategy_fallback", "")
.unwrap();
assert!(!value, "after set 'no', the switch reads false");
}