Struct argmin::core::test_utils::TestProblem
source · pub struct TestProblem {}
Expand description
Implementations§
Trait Implementations§
source§impl Anneal for TestProblem
impl Anneal for TestProblem
source§fn 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)?;
source§impl Clone for TestProblem
impl Clone for TestProblem
source§fn clone(&self) -> TestProblem
fn clone(&self) -> TestProblem
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl CostFunction for TestProblem
impl CostFunction for TestProblem
source§fn 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)?;
source§fn bulk_cost<P>(&self, params: &[P]) -> Result<Vec<Self::Output>, Error>
fn bulk_cost<P>(&self, params: &[P]) -> Result<Vec<Self::Output>, Error>
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.source§fn 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.source§impl Debug for TestProblem
impl Debug for TestProblem
source§impl Default for TestProblem
impl Default for TestProblem
source§fn default() -> TestProblem
fn default() -> TestProblem
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for TestProblem
impl<'de> Deserialize<'de> for TestProblem
source§fn 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
source§impl Gradient for TestProblem
impl Gradient for TestProblem
source§fn 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)?;
source§fn bulk_gradient<P>(&self, params: &[P]) -> Result<Vec<Self::Gradient>, Error>
fn bulk_gradient<P>(&self, params: &[P]) -> Result<Vec<Self::Gradient>, Error>
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.source§fn 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.source§impl Hash for TestProblem
impl Hash for TestProblem
source§impl Hessian for TestProblem
impl Hessian for TestProblem
source§fn 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)?;
source§fn bulk_hessian<P>(&self, params: &[P]) -> Result<Vec<Self::Hessian>, Error>
fn bulk_hessian<P>(&self, params: &[P]) -> Result<Vec<Self::Hessian>, Error>
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.source§fn 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.source§impl Jacobian for TestProblem
impl Jacobian for TestProblem
source§fn 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)?;
source§fn bulk_jacobian<P>(&self, params: &[P]) -> Result<Vec<Self::Jacobian>, Error>
fn bulk_jacobian<P>(&self, params: &[P]) -> Result<Vec<Self::Jacobian>, Error>
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.source§fn 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.source§impl Operator for TestProblem
impl Operator for TestProblem
source§fn 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)?;
source§fn bulk_apply<P>(&self, params: &[P]) -> Result<Vec<Self::Output>, Error>
fn bulk_apply<P>(&self, params: &[P]) -> Result<Vec<Self::Output>, Error>
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.source§fn 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.source§impl PartialEq for TestProblem
impl PartialEq for TestProblem
source§fn 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 ==
.source§impl Serialize for TestProblem
impl Serialize for TestProblem
impl Copy for TestProblem
impl Eq for TestProblem
impl StructuralPartialEq for TestProblem
Auto Trait Implementations§
impl Freeze for TestProblem
impl RefUnwindSafe for TestProblem
impl Send for TestProblem
impl Sync for TestProblem
impl Unpin for TestProblem
impl UnwindSafe for TestProblem
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.