Skip to main content

format_sol_with_options

Function format_sol_with_options 

Source
pub fn format_sol_with_options(
    payload: &SolutionFile<'_>,
    ampl_options: &[i64],
) -> String
Expand description

Format payload into AMPL .sol ASCII text, echoing ampl_options.

ampl_options are the model’s own option words, read verbatim from .nl header line 0 (NlProblem::ampl_options). Ipopt and the ASL’s writesol.c echo them back unchanged rather than interpreting them, and the values are per-model: bearing_400 (g3 1 1 0) yields 3 / 1 / 1 / 0, while arki0003 and camshape_6400 (g3 10 1 0) yield 3 / 10 / 1 / 0. Verified against Ipopt 3.14.20 -AMPL output.

Pass an empty slice when there is no originating header — problems built through NlProblem::from_expressions, the WASM entry point — and a generic 3 / 1 / 1 / 0 goes out instead. That is a valid block (see the count discussion below); it simply is not this model’s.