Struct argmin::core::test_utils::TestProblem
source · [−]pub struct TestProblem {}
Expand description
Implementations
sourceimpl TestProblem
impl TestProblem
Trait Implementations
sourceimpl Anneal for TestProblem
impl Anneal for TestProblem
sourcefn anneal(&self, p: &Self::Param, _t: Self::Float) -> Result<Self::Output, Error>
fn anneal(&self, p: &Self::Param, _t: Self::Float) -> Result<Self::Output, Error>
Returns a clone of parameter p
.
Example
use argmin::core::test_utils::TestProblem;
use argmin::solver::simulatedannealing::Anneal;
let problem = TestProblem::new();
let param = vec![1.0, 2.0];
let res = problem.anneal(¶m, 1.0)?;
sourceimpl Clone for TestProblem
impl Clone for TestProblem
sourcefn clone(&self) -> TestProblem
fn clone(&self) -> TestProblem
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl CostFunction for TestProblem
impl CostFunction for TestProblem
sourcefn cost(&self, _p: &Self::Param) -> Result<Self::Output, Error>
fn cost(&self, _p: &Self::Param) -> Result<Self::Output, Error>
Returns 1.0f64
.
Example
use argmin::core::test_utils::TestProblem;
use argmin::core::CostFunction;
let problem = TestProblem::new();
let param = vec![1.0, 2.0];
let res = problem.cost(¶m)?;
sourcefn bulk_cost<'a, P>(&self, params: &'a [P]) -> Result<Vec<Self::Output>, Error> where
P: Borrow<Self::Param> + SyncAlias,
Self::Output: SendAlias,
Self: SyncAlias,
fn bulk_cost<'a, P>(&self, params: &'a [P]) -> Result<Vec<Self::Output>, Error> where
P: Borrow<Self::Param> + SyncAlias,
Self::Output: SendAlias,
Self: SyncAlias,
Compute cost
in bulk. If the rayon
feature is enabled, multiple calls to cost
will be run in parallel using rayon
, otherwise they will execute sequentially. If the rayon
feature is enabled, parallelization can still be turned off by overwriting parallelize
to return false
. This can be useful in cases where it is preferable to parallelize only certain parts. Note that even if parallelize
is set to false, the parameter vectors and the problem are still required to be Send
and Sync
. Those bounds are linked to the rayon
feature. This method can be overwritten.
sourcefn parallelize(&self) -> bool
fn parallelize(&self) -> bool
Indicates whether to parallelize calls to cost
when using bulk_cost
. By default returns true, but can be set manually to false
if needed. This allows users to turn off parallelization for certain traits implemented on their problem. Note that parallelization requires the rayon
feature to be enabled, otherwise calls to cost
will be executed sequentially independent of how parallelize
is set.
sourceimpl Debug for TestProblem
impl Debug for TestProblem
sourceimpl Default for TestProblem
impl Default for TestProblem
sourcefn default() -> TestProblem
fn default() -> TestProblem
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for TestProblem
impl<'de> Deserialize<'de> for TestProblem
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Gradient for TestProblem
impl Gradient for TestProblem
sourcefn gradient(&self, p: &Self::Param) -> Result<Self::Param, Error>
fn gradient(&self, p: &Self::Param) -> Result<Self::Param, Error>
Returns a clone of parameter p
.
Example
use argmin::core::test_utils::TestProblem;
use argmin::core::Gradient;
let problem = TestProblem::new();
let param = vec![1.0, 2.0];
let res = problem.gradient(¶m)?;
sourcefn bulk_gradient<'a, P>(
&self,
params: &'a [P]
) -> Result<Vec<Self::Gradient>, Error> where
P: Borrow<Self::Param> + SyncAlias,
Self::Gradient: SendAlias,
Self: SyncAlias,
fn bulk_gradient<'a, P>(
&self,
params: &'a [P]
) -> Result<Vec<Self::Gradient>, Error> where
P: Borrow<Self::Param> + SyncAlias,
Self::Gradient: SendAlias,
Self: SyncAlias,
Compute gradient
in bulk. If the rayon
feature is enabled, multiple calls to gradient
will be run in parallel using rayon
, otherwise they will execute sequentially. If the rayon
feature is enabled, parallelization can still be turned off by overwriting parallelize
to return false
. This can be useful in cases where it is preferable to parallelize only certain parts. Note that even if parallelize
is set to false, the parameter vectors and the problem are still required to be Send
and Sync
. Those bounds are linked to the rayon
feature. This method can be overwritten.
sourcefn parallelize(&self) -> bool
fn parallelize(&self) -> bool
Indicates whether to parallelize calls to gradient
when using bulk_gradient
. By default returns true, but can be set manually to false
if needed. This allows users to turn off parallelization for certain traits implemented on their problem. Note that parallelization requires the rayon
feature to be enabled, otherwise calls to gradient
will be executed sequentially independent of how parallelize
is set.
sourceimpl Hash for TestProblem
impl Hash for TestProblem
sourceimpl Hessian for TestProblem
impl Hessian for TestProblem
sourcefn hessian(&self, p: &Self::Param) -> Result<Self::Hessian, Error>
fn hessian(&self, p: &Self::Param) -> Result<Self::Hessian, Error>
Returns vec![p, p]
.
Example
use argmin::core::test_utils::TestProblem;
use argmin::core::Hessian;
let problem = TestProblem::new();
let param = vec![1.0, 2.0];
let res = problem.hessian(¶m)?;
sourcefn bulk_hessian<'a, P>(
&self,
params: &'a [P]
) -> Result<Vec<Self::Hessian>, Error> where
P: Borrow<Self::Param> + SyncAlias,
Self::Hessian: SendAlias,
Self: SyncAlias,
fn bulk_hessian<'a, P>(
&self,
params: &'a [P]
) -> Result<Vec<Self::Hessian>, Error> where
P: Borrow<Self::Param> + SyncAlias,
Self::Hessian: SendAlias,
Self: SyncAlias,
Compute hessian
in bulk. If the rayon
feature is enabled, multiple calls to hessian
will be run in parallel using rayon
, otherwise they will execute sequentially. If the rayon
feature is enabled, parallelization can still be turned off by overwriting parallelize
to return false
. This can be useful in cases where it is preferable to parallelize only certain parts. Note that even if parallelize
is set to false, the parameter vectors and the problem are still required to be Send
and Sync
. Those bounds are linked to the rayon
feature. This method can be overwritten.
sourcefn parallelize(&self) -> bool
fn parallelize(&self) -> bool
Indicates whether to parallelize calls to hessian
when using bulk_hessian
. By default returns true, but can be set manually to false
if needed. This allows users to turn off parallelization for certain traits implemented on their problem. Note that parallelization requires the rayon
feature to be enabled, otherwise calls to hessian
will be executed sequentially independent of how parallelize
is set.
sourceimpl Jacobian for TestProblem
impl Jacobian for TestProblem
sourcefn jacobian(&self, p: &Self::Param) -> Result<Self::Jacobian, Error>
fn jacobian(&self, p: &Self::Param) -> Result<Self::Jacobian, Error>
Returns vec![p, p]
.
Example
use argmin::core::test_utils::TestProblem;
use argmin::core::Jacobian;
let problem = TestProblem::new();
let param = vec![1.0, 2.0];
let res = problem.jacobian(¶m)?;
sourcefn bulk_jacobian<'a, P>(
&self,
params: &'a [P]
) -> Result<Vec<Self::Jacobian>, Error> where
P: Borrow<Self::Param> + SyncAlias,
Self::Jacobian: SendAlias,
Self: SyncAlias,
fn bulk_jacobian<'a, P>(
&self,
params: &'a [P]
) -> Result<Vec<Self::Jacobian>, Error> where
P: Borrow<Self::Param> + SyncAlias,
Self::Jacobian: SendAlias,
Self: SyncAlias,
Compute jacobian
in bulk. If the rayon
feature is enabled, multiple calls to jacobian
will be run in parallel using rayon
, otherwise they will execute sequentially. If the rayon
feature is enabled, parallelization can still be turned off by overwriting parallelize
to return false
. This can be useful in cases where it is preferable to parallelize only certain parts. Note that even if parallelize
is set to false, the parameter vectors and the problem are still required to be Send
and Sync
. Those bounds are linked to the rayon
feature. This method can be overwritten.
sourcefn parallelize(&self) -> bool
fn parallelize(&self) -> bool
Indicates whether to parallelize calls to jacobian
when using bulk_jacobian
. By default returns true, but can be set manually to false
if needed. This allows users to turn off parallelization for certain traits implemented on their problem. Note that parallelization requires the rayon
feature to be enabled, otherwise calls to jacobian
will be executed sequentially independent of how parallelize
is set.
sourceimpl Operator for TestProblem
impl Operator for TestProblem
sourcefn apply(&self, p: &Self::Param) -> Result<Self::Output, Error>
fn apply(&self, p: &Self::Param) -> Result<Self::Output, Error>
Returns a clone of parameter p
.
Example
use argmin::core::test_utils::TestProblem;
use argmin::core::Operator;
let problem = TestProblem::new();
let param = vec![1.0, 2.0];
let res = problem.apply(¶m)?;
sourcefn bulk_apply<'a, P>(&self, params: &'a [P]) -> Result<Vec<Self::Output>, Error> where
P: Borrow<Self::Param> + SyncAlias,
Self::Output: SendAlias,
Self: SyncAlias,
fn bulk_apply<'a, P>(&self, params: &'a [P]) -> Result<Vec<Self::Output>, Error> where
P: Borrow<Self::Param> + SyncAlias,
Self::Output: SendAlias,
Self: SyncAlias,
Compute apply
in bulk. If the rayon
feature is enabled, multiple calls to apply
will be run in parallel using rayon
, otherwise they will execute sequentially. If the rayon
feature is enabled, parallelization can still be turned off by overwriting parallelize
to return false
. This can be useful in cases where it is preferable to parallelize only certain parts. Note that even if parallelize
is set to false, the parameter vectors and the problem are still required to be Send
and Sync
. Those bounds are linked to the rayon
feature. This method can be overwritten.
sourcefn parallelize(&self) -> bool
fn parallelize(&self) -> bool
Indicates whether to parallelize calls to apply
when using bulk_apply
. By default returns true, but can be set manually to false
if needed. This allows users to turn off parallelization for certain traits implemented on their problem. Note that parallelization requires the rayon
feature to be enabled, otherwise calls to apply
will be executed sequentially independent of how parallelize
is set.
sourceimpl PartialEq<TestProblem> for TestProblem
impl PartialEq<TestProblem> for TestProblem
sourcefn eq(&self, other: &TestProblem) -> bool
fn eq(&self, other: &TestProblem) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourceimpl Serialize for TestProblem
impl Serialize for TestProblem
impl Copy for TestProblem
impl Eq for TestProblem
impl StructuralEq for TestProblem
impl StructuralPartialEq for TestProblem
Auto Trait Implementations
impl RefUnwindSafe for TestProblem
impl Send for TestProblem
impl Sync for TestProblem
impl Unpin for TestProblem
impl UnwindSafe for TestProblem
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more