RsBundle  Diff

Differences From Artifact [f1452c9905]:

  • File src/mpi/problem.rs — part of check-in [d02e699a01] at 2023-04-05 21:24:04 on branch mpi — Fix many clippy/linter warnings (user: fifr size: 10354)

To Artifact [f49e50fad4]:

  • File src/mpi/problem.rs — part of check-in [c2dc4bf3de] at 2023-04-06 14:56:10 on branch mpi — mpi: add doc comments to `DistributedFirstOrderProblem` (user: fifr size: 11628)

49
50
51
52
53
54
55





56
57












58
59
60
61
62
63
64
65
66
67
68
69






70
71
72
73
74






75
76
77
78
79
80
81
    Remote,
    /// Original oracle error.
    #[error("Error by underlying oracle")]
    OracleError(E),
}

pub trait DistributedFirstOrderProblem: FirstOrderProblem + Send + Sync {





    type Update: Serialize + DeserializeOwned + Clone + Send + Sync;













    #[allow(unused_variables)]
    fn create_update<U>(
        &self,
        state: U,
        apply: impl FnOnce(Self::Update) -> Result<(), Self::Err> + Send + 'static,
    ) -> Result<bool, Self::Err>
    where
        U: UpdateState<<Self::Minorant as Minorant>::Primal>,
    {
        Ok(false)
    }







    #[allow(unused_variables)]
    fn apply_update(&mut self, update: &Self::Update) -> Result<(), Self::Err> {
        Ok(())
    }







    #[allow(unused_variables)]
    fn send_update<S>(&self, update: &Self::Update, tx: S) -> Result<(), Self::Err>
    where
        S: UpdateSender<Self> + 'static,
        Self: Sized,
    {
        Ok(())







>
>
>
>
>


>
>
>
>
>
>
>
>
>
>
>
>












>
>
>
>
>
>





>
>
>
>
>
>







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
    Remote,
    /// Original oracle error.
    #[error("Error by underlying oracle")]
    OracleError(E),
}

pub trait DistributedFirstOrderProblem: FirstOrderProblem + Send + Sync {
    /// Abstract information about a model update.
    ///
    /// The update must be a serializable representation of a model
    /// change, which can be transferred to different nodes in a
    /// distributed computing platform.
    type Update: Serialize + DeserializeOwned + Clone + Send + Sync;

    /// Compute an update of the problem.
    ///
    /// The update should be computed (e.g. which variables should be
    /// added) but not yet applied to the problem. The update will be
    /// applied later by calling [`apply_update`].
    ///
    /// The function may return immediately and compute the update in
    /// background.
    ///
    /// # Parameters
    /// - `state` is the current state of the model on which the update is based
    /// - `apply` callback to which the update should be passed
    #[allow(unused_variables)]
    fn create_update<U>(
        &self,
        state: U,
        apply: impl FnOnce(Self::Update) -> Result<(), Self::Err> + Send + 'static,
    ) -> Result<bool, Self::Err>
    where
        U: UpdateState<<Self::Minorant as Minorant>::Primal>,
    {
        Ok(false)
    }

    /// Apply an update to the problem.
    ///
    /// The update has been computed by an preceding call to [`create_update`].
    ///
    /// Note that the update may have been computed on a different
    /// node in a distributed computing platform.
    #[allow(unused_variables)]
    fn apply_update(&mut self, update: &Self::Update) -> Result<(), Self::Err> {
        Ok(())
    }

    /// Send an update to the main algorithm.
    ///
    /// This function is usually called after an update has been
    /// applied (to all compute nodes). It's task is to transmit the
    /// update to the main algorithm using the [`UpdateSender`]
    /// parameter `tx`.
    #[allow(unused_variables)]
    fn send_update<S>(&self, update: &Self::Update, tx: S) -> Result<(), Self::Err>
    where
        S: UpdateSender<Self> + 'static,
        Self: Sized,
    {
        Ok(())