RsBundle  Diff

Differences From Artifact [5bf7e11a8c]:

  • File src/solver/sync.rs — part of check-in [57ea9c19e3] at 2022-03-28 14:20:36 on branch trunk — Remove `std::error::Error` requirement on `FirstOrderProblem::Err` (user: fifr size: 29001)

To Artifact [4f15366f3f]:

  • File src/solver/sync.rs — part of check-in [20e4ee96a4] at 2022-03-28 14:50:24 on branch trunk — Remove many unnecessary `'static` requirements (user: fifr size: 28838)

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

/// The minimal bundle solver.
pub type NoBundleSolver<P> = Solver<P, StandardTerminator, HKWeighter, crate::master::MinimalMasterBuilder>;

/// Error raised by the parallel bundle [`Solver`].
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error<PErr, MErr>
where
    PErr: 'static,
    MErr: 'static,
{
    #[error("master problem creation failed")]
    BuildMaster(#[source] MErr),
    #[error("error solving the master problem")]
    Master(#[source] MasterError<PErr, MErr>),
    #[error("iteration limit ({limit}) has been reached")]
    IterationLimit { limit: usize },
    #[error("problem evaluation failed")]







|
<
<
<
<







48
49
50
51
52
53
54
55




56
57
58
59
60
61
62

/// The minimal bundle solver.
pub type NoBundleSolver<P> = Solver<P, StandardTerminator, HKWeighter, crate::master::MinimalMasterBuilder>;

/// Error raised by the parallel bundle [`Solver`].
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error<PErr, MErr> {




    #[error("master problem creation failed")]
    BuildMaster(#[source] MErr),
    #[error("error solving the master problem")]
    Master(#[source] MasterError<PErr, MErr>),
    #[error("iteration limit ({limit}) has been reached")]
    IterationLimit { limit: usize },
    #[error("problem evaluation failed")]
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
        <P as FirstOrderProblem>::Err,
        <<M as MasterBuilder<<P as FirstOrderProblem>::Minorant>>::MasterProblem as MasterProblem<
            <P as FirstOrderProblem>::Minorant,
        >>::Err,
    >,
>;

impl<PErr, MErr> From<MasterError<PErr, MErr>> for Error<PErr, MErr>
where
    PErr: 'static,
    MErr: 'static,
{
    fn from(err: MasterError<PErr, MErr>) -> Error<PErr, MErr> {
        Error::Master(err)
    }
}

impl<PErr, MErr> From<RecvError> for Error<PErr, MErr>
where
    PErr: 'static,
    MErr: 'static,
{
    fn from(err: RecvError) -> Error<PErr, MErr> {
        Error::DisconnectedReceiver(err)
    }
}

#[derive(Debug, Clone)]
pub struct Parameters {







|
<
<
<
<





|
<
<
<
<







86
87
88
89
90
91
92
93




94
95
96
97
98
99




100
101
102
103
104
105
106
        <P as FirstOrderProblem>::Err,
        <<M as MasterBuilder<<P as FirstOrderProblem>::Minorant>>::MasterProblem as MasterProblem<
            <P as FirstOrderProblem>::Minorant,
        >>::Err,
    >,
>;

impl<PErr, MErr> From<MasterError<PErr, MErr>> for Error<PErr, MErr> {




    fn from(err: MasterError<PErr, MErr>) -> Error<PErr, MErr> {
        Error::Master(err)
    }
}

impl<PErr, MErr> From<RecvError> for Error<PErr, MErr> {




    fn from(err: RecvError) -> Error<PErr, MErr> {
        Error::DisconnectedReceiver(err)
    }
}

#[derive(Debug, Clone)]
pub struct Parameters {
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
}

/// Implementation of a parallel bundle method.
pub struct Solver<P, T = StandardTerminator, W = HKWeighter, M = crate::master::FullMasterBuilder>
where
    P: FirstOrderProblem,
    M: MasterBuilder<P::Minorant>,
    P::Err: 'static,
{
    /// Parameters for the solver.
    pub params: Parameters,

    /// Termination predicate.
    pub terminator: T,








<







331
332
333
334
335
336
337

338
339
340
341
342
343
344
}

/// Implementation of a parallel bundle method.
pub struct Solver<P, T = StandardTerminator, W = HKWeighter, M = crate::master::FullMasterBuilder>
where
    P: FirstOrderProblem,
    M: MasterBuilder<P::Minorant>,

{
    /// Parameters for the solver.
    pub params: Parameters,

    /// Termination predicate.
    pub terminator: T,

393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
    /// This is actually the time of the last call to `Solver::init`.
    start_time: Instant,
}

impl<P, T, W, M> Solver<P, T, W, M>
where
    P: FirstOrderProblem,
    P::Err: Send + 'static,
    T: Terminator<SolverData> + Default,
    W: Weighter<SolverData> + Default,
    M: MasterBuilder<P::Minorant>,
{
    /// Create a new parallel bundle solver.
    pub fn new(problem: P) -> Self
    where







|







380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
    /// This is actually the time of the last call to `Solver::init`.
    start_time: Instant,
}

impl<P, T, W, M> Solver<P, T, W, M>
where
    P: FirstOrderProblem,
    P::Err: Send,
    T: Terminator<SolverData> + Default,
    W: Weighter<SolverData> + Default,
    M: MasterBuilder<P::Minorant>,
{
    /// Create a new parallel bundle solver.
    pub fn new(problem: P) -> Self
    where