Skip to main content

IpoptApplication

Struct IpoptApplication 

Source
pub struct IpoptApplication { /* private fields */ }

Implementations§

Source§

impl IpoptApplication

Source

pub fn new() -> Self

New application with empty options and a default journalist. Equivalent to IpoptApplication::IpoptApplication(true,true).

Source

pub fn options(&self) -> &OptionsList

Source

pub fn options_mut(&mut self) -> &mut OptionsList

Source

pub fn registered_options(&self) -> &Rc<RegisteredOptions>

Source

pub fn journalist(&self) -> &Rc<Journalist>

Source

pub fn set_linear_backend_factory(&mut self, factory: LinearBackendFactory)

Plug a custom symmetric-linear-solver factory. Useful for tests that want to swap MA57 for a stub. Production callers should leave this unset — the default (default_backend_factory) returns the workspace’s MA57 binding.

Source

pub fn set_restoration_factory(&mut self, factory: RestorationFactory)

Plug a restoration-phase factory. Called once per optimize_tnlp invocation to mint a fresh Box<dyn RestorationPhase> that the outer algorithm uses as its line-search restoration fallback. Lives behind a setter (rather than at construction) because the concrete restoration strategies live in pounce-restoration, which depends on this crate; consumers in pounce-cli / integration tests wire the factory at the application boundary.

Source

pub fn set_diagnostics(&mut self, diag: Rc<DiagnosticsState>)

Install the shared diagnostics state. Once set, every subsequent optimize_tnlp call forwards the state into the algorithm via IpoptAlgorithm::with_diagnostics so the KKT solver can emit --dump kkt:... artifacts.

Source

pub fn set_debug_hook(&mut self, hook: Rc<RefCell<dyn DebugHook>>)

Install an interactive debugger hook for the next optimize_* call. The hook is moved into the main IpoptAlgorithm and consumed by that solve; reinstall it to debug a subsequent solve.

Source

pub fn diagnostics(&self) -> Option<Rc<DiagnosticsState>>

Read-side accessor for the installed diagnostics state, if any. Lets the CLI write the top-level manifest/timing files after the solve completes.

Source

pub fn set_restoration_factory_provider( &mut self, provider: RestorationFactoryProvider, )

Plug a restoration-phase factory provider for drivers that need to run the inner IPM more than once per optimize_tnlp call (notably the Phase-3 ℓ₁-exact penalty-barrier outer loop, pounce#10). On each inner solve, the application consults the provider to mint a fresh RestorationFactory, replacing any stale one, so the default one-shot restoration factory does not panic on its second invocation. If both set_restoration_factory and this are configured, the provider wins.

Source

pub fn set_on_converged(&mut self, cb: ConvergedCallback)

Register a callback to run once the IPM has converged (status ApplicationReturnStatus::SolveSucceeded or ApplicationReturnStatus::SolvedToAcceptableLevel) but before finalize_solution flows back to the TNLP. See ConvergedCallback for the use case (post-optimal sensitivity).

Source

pub fn enable_iter_history(&mut self)

Enable per-iteration trajectory capture. After the solve returns, Self::statistics() exposes pounce_nlp::solve_statistics::SolveStatistics::iterations populated with one pounce_nlp::solve_statistics::IterRecord per accepted iterate. Off by default — the pounce_sens and pounce binaries opt in when --json-output is passed.

Source

pub fn initialize_with_options_file( &mut self, path: &Path, ) -> Result<(), SolverException>

Read an ipopt.opt-format options file. Equivalent to IpoptApplication::Initialize(const std::string& options_file).

Source

pub fn initialize_with_options_str( &mut self, s: &str, ) -> Result<(), SolverException>

Read options from a string in ipopt.opt format. Useful for tests and embedded callers.

Source

pub fn initialize(&mut self) -> Result<(), SolverException>

No-op initialize (just succeeds). Mirrors IpoptApplication::Initialize(bool allow_clobber) with no options file.

Source

pub fn open_output_file(&mut self, fname: &str, print_level: i32) -> bool

Mirror IpoptApplication::OpenOutputFile. Sets the output_file / file_print_level options and attaches a matching FileJournal named OutputFile:<fname> to the journalist. Returns false if the file could not be opened or the option store rejected the request (e.g. clamped print level).

Source

pub fn problem_dimensions(&self, tnlp: &mut dyn TNLP) -> Option<NlpInfo>

Wrap a TNLP and report problem dimensions. Used in tests until the full IPM path covers every entry shape.

Source

pub fn statistics(&self) -> SolveStatistics

Source

pub fn timing_stats(&self) -> Rc<TimingStatistics>

Shared timing accumulator from the most recent optimize_tnlp call. Each subsystem (algorithm, NLP, KKT solver) bumped its own fields during the solve; consumers read totals out of the returned Rc. The instance is replaced at the top of every subsequent solve, so cloning the Rc and holding it past a re-solve will give you the previous solve’s timings — by design.

Source

pub fn linear_solver_summary(&self) -> Option<LinearSolverSummary>

Aggregate linear-solver post-mortem from the most recent optimize_tnlp call. Some when the workspace-default FERAL backend ran at least one factor; None when no factors were recorded (custom factory plugged via Self::set_linear_backend_factory, or solve aborted before the first KKT factor). Reset at the top of every solve.

Source

pub fn optimize_tnlp( &mut self, tnlp: Rc<RefCell<dyn TNLP>>, ) -> ApplicationReturnStatus

Drive a solve.

  • Constrained problems (m > 0) take the primal-dual IPM path: build a TNLPAdapterOrigIpoptNlp, run the AlgorithmBuilder with the workspace MA57 backend, and call IpoptAlgorithm::optimize. The SolverReturnApplicationReturnStatus mapping mirrors the table in ref/Ipopt/AGENT_REFERENCE/MAIN_LOOP.md (“exception → SolverReturn map”).
  • Unconstrained problems (m == 0) keep going through the in-pounce-nlp Newton driver so the trivial path is independent of the linear-solver backend.
Source

pub fn set_sqp_warm_start(&mut self, warm: SqpIterates)

Has the user set algorithm = active-set-sqp? Reads the string option and matches case-insensitively against the design-note §7.1 spelling. Any value other than “active-set-sqp” (including absence) routes to the default IPM path. Stash a warm-start iterate for the SQP path. Consumed by the next optimize_tnlp call when the algorithm option resolves to active-set-sqp; the IPM path ignores it. Phase 5c (§6) — the parametric / MPC warm-start hand-off.

The iterate is auto-cleared after use, so a follow-up solve without an intervening set_sqp_warm_start call cold-starts.

Source

pub fn clear_sqp_warm_start(&mut self)

Drop any pending warm-start iterate without solving.

Source

pub fn set_warm_start_iterate(&mut self, snap: IterateSnapshot)

Install a full primal-dual warm-start iterate for the next IPM optimize_tnlp. Captured by the debugger’s resolve so the re-solve continues from the paused interior point. The caller is responsible for also enabling warm_start_init_point=yes (and usually warm_start_target_mu=<μ>) so the re-optimize branch of WarmStartIterateInitializer preserves the installed iterate. Consumed once per solve, then auto-cleared.

Source

pub fn last_sqp_working_set(&self) -> Option<&WorkingSet>

Return the final QP working set from the most recent SQP solve, or None if the last solve wasn’t SQP, didn’t produce a working set (cold-start declared the iterate optimal before solving any QP), or no SQP solve has run.

Source

pub fn reoptimize_tnlp( &mut self, tnlp: Rc<RefCell<dyn TNLP>>, ) -> ApplicationReturnStatus

Stub. Re-solve with a warm start. Phase 7+.

Source

pub fn algorithm_builder_from_options(&self) -> AlgorithmBuilder

Build an AlgorithmBuilder populated from the app’s OptionsList. Public so callers wiring the restoration factory can hand the inner IPM a builder that mirrors the outer’s mu_strategy/mu_oracle/line-search choices — matching upstream IpAlgBuilder::BuildRestoIpoptAlgorithm, which reads the same mu_strategy option with prefix `“resto.”

  • prefix` and falls back to the outer setting.

Trait Implementations§

Source§

impl Debug for IpoptApplication

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IpoptApplication

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more