Skip to main content

solve_sequence

Function solve_sequence 

Source
pub fn solve_sequence(
    problem: &PortfolioProblem,
    settings: Option<SolverSettings>,
    steps: &[RebalanceStep],
) -> Result<Vec<Solution>, PortfolioError>
Expand description

Solves a whole rolling sequence in one call: one Solution per step, in order (roadmap 2.5).

The first step is applied to the base problem before its solve, so pass RebalanceStep::default() first to solve the base data as-is. Warm starts and factorization reuse are managed internally; for streaming workloads where dates arrive one at a time, hold a PortfolioSequence (via PortfolioProblem::sequence) and call PortfolioSequence::solve_next instead.

A solve that stops at MaxIterations does not abort the sequence; inspect each returned SolveStatus.

§Errors

Returns PortfolioError on invalid base data or on the first invalid step, together with the index-free context of that step’s validation error. Solutions for the steps before the failure are dropped.