Skip to main content

solve_nlp_batch_parallel

Function solve_nlp_batch_parallel 

Source
pub fn solve_nlp_batch_parallel<T, C>(
    problems: Vec<T>,
    configure: C,
) -> Vec<NlpBatchResult>
where T: TNLP + Send + 'static, C: Fn(usize, &mut IpoptApplication) + Sync,
Expand description

Solve a batch of independent NLPs in parallel across instances on rayon’s global pool, returning one result per input in input order regardless of completion order. Best for many small / medium instances where cross-instance throughput beats parallelizing each factor internally.

Each worker owns its instance end-to-end: the T: TNLP + Send moves in, and the application, backend, and restoration strategy are all constructed inside the worker via configure (which must therefore be Sync — it is shared by reference and called once per instance, with the instance index so per-instance options are possible). For the outer-parallel / inner-serial win, have configure install an inner-serial backend — install_serial_feral_backend after setting options.