RsBundle  Diff

Differences From Artifact [a38a95144d]:

  • File src/lib.rs — part of check-in [264ce5184e] at 2022-06-15 16:22:58 on branch solver-state — Improve error handling of `Saveable` implementors (user: fifr size: 1773)

To Artifact [db46d13247]:

  • File src/lib.rs — part of check-in [5ec346f328] at 2022-06-17 13:46:02 on branch solver-state — Move `Saveable` to submodule `saveable` (user: fifr size: 1218) [more...]

12
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
51
52
53
54
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see  <http://www.gnu.org/licenses/>
//

//! Proximal bundle method implementation.

use std::result::Result;

#[macro_export]
macro_rules! dvec {
    ( $ elem : expr ; $ n : expr ) => { DVector(vec![$elem; $n]) };
    ( $ ( $ x : expr ) , * ) => { DVector(vec![$($x),*]) };
    ( $ ( $ x : expr , ) * ) => { DVector(vec![$($x,)*]) };
}

/// A trait for all solvers that can be saved and restored to a persistent state.
pub trait Saveable {
    /// Type of the persistent state.
    type State: Send + Clone;

    /// Type of errors.
    type Err: std::error::Error + Send;

    /// Return a persistent state.
    fn get_state(&self) -> Result<Self::State, Self::Err>;

    /// Set the persistent state.
    ///
    /// Note that this method must not fail, i.e. a `State` object
    /// must always be valid.
    fn set_state(&mut self, state: Self::State) -> Result<(), Self::Err>;
}

mod data;
pub use data::{Aggregatable, DVector, Minorant, Real, Vector};



pub mod problem;

pub mod solver;

pub mod weighter;








<
<







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


>
>







12
13
14
15
16
17
18


19
20
21
22
23
24
25


















26
27
28
29
30
31
32
33
34
35
36
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see  <http://www.gnu.org/licenses/>
//

//! Proximal bundle method implementation.



#[macro_export]
macro_rules! dvec {
    ( $ elem : expr ; $ n : expr ) => { DVector(vec![$elem; $n]) };
    ( $ ( $ x : expr ) , * ) => { DVector(vec![$($x),*]) };
    ( $ ( $ x : expr , ) * ) => { DVector(vec![$($x,)*]) };
}



















mod data;
pub use data::{Aggregatable, DVector, Minorant, Real, Vector};

pub mod saveable;

pub mod problem;

pub mod solver;

pub mod weighter;