RsBundle  Diff

Differences From Artifact [31e10de5ac]:

  • File src/problem.rs — part of check-in [be42fa28cd] at 2020-07-18 12:24:34 on branch minorant-primal — Add `primal` field to `Minorant` (user: fifr size: 6392)

To Artifact [cde3bd7e80]:

  • File src/problem.rs — part of check-in [30a0059850] at 2020-07-18 12:41:26 on branch minorant-primal — Move `SubgradientExtender` to `minorant` module (user: fifr size: 6228) [more...]

13
14
15
16
17
18
19

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40




41
42
43
44
45
46
47







+




















-
-
-
-







 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */

//! An asynchronous first-order oracle.

pub use crate::data::minorant::SubgradientExtender;
use crate::{Aggregatable, DVector, Minorant, Real};
use std::sync::Arc;

/// Channel to send evaluation results to.
pub trait ResultSender<P>: Send
where
    P: FirstOrderProblem,
{
    type Err: std::error::Error + Send;

    /// Send a new objective `value`.
    fn objective(&self, value: Real) -> Result<(), Self::Err>;

    /// Send a new `minorant` with associated `primal`.
    fn minorant(&self, minorant: Minorant<P::Primal>) -> Result<(), Self::Err>;

    /// Send an error message.
    fn error(&self, err: P::Err) -> Result<(), Self::Err>;
}

/// The subgradient extender is a callback used to update existing minorants
/// given their associated primal data.
pub type SubgradientExtender<P, E> = dyn FnMut(usize, &P, &[usize]) -> Result<DVector, E> + Send;

/// Channel to send problem updates to.
pub trait UpdateSender<P>: Send
where
    P: FirstOrderProblem,
{
    type Err: std::error::Error + Send;