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;
|