use crate::{constraints, FunctionCallResult};
use std::marker::PhantomData;
pub struct Problem<'a, GradientType, ConstraintType, CostType, T = f64>
where
GradientType: Fn(&[T], &mut [T]) -> FunctionCallResult,
CostType: Fn(&[T], &mut T) -> FunctionCallResult,
ConstraintType: constraints::Constraint<T>,
{
pub(crate) constraints: &'a ConstraintType,
pub(crate) gradf: GradientType,
pub(crate) cost: CostType,
marker: PhantomData<T>,
}
impl<'a, GradientType, ConstraintType, CostType, T>
Problem<'a, GradientType, ConstraintType, CostType, T>
where
GradientType: Fn(&[T], &mut [T]) -> FunctionCallResult,
CostType: Fn(&[T], &mut T) -> FunctionCallResult,
ConstraintType: constraints::Constraint<T>,
{
pub fn new(
constraints: &'a ConstraintType,
cost_gradient: GradientType,
cost: CostType,
) -> Problem<'a, GradientType, ConstraintType, CostType, T> {
Problem {
constraints,
gradf: cost_gradient,
cost,
marker: PhantomData,
}
}
}