13#ifndef INCLUDE_PIPAL_PROBLEM_HXX
14#define INCLUDE_PIPAL_PROBLEM_HXX
26 template <
typename Real>
29 static_assert(std::is_floating_point_v<Real>,
30 "Pipal::Problem<Real>: Real must be a floating-point type.");
32 std::string
m_name{
"(Unnamed Pipal Problem)"};
84 std::string
const &
name()
const {
return this->m_name;}
90 void name(std::string
const & t_name) {this->m_name = t_name;}
170 template <
typename Real>
213 std::string
const & t_name,
221 BoundsFunc const & t_constraints_lower_bounds,
virtual bool primal_lower_bounds(Vector< Real > &out) const =0
Lower bounds on the primal variables.
virtual ~Problem()=default
Default destructor.
virtual bool lagrangian_hessian(Vector< Real > const &x, Vector< Real > const &l, SparseMatrix< Real > &out) const =0
Evaluate the Hessian of the Lagrangian function with respect to the primal variables.
std::unique_ptr< Problem > UniquePtr
Definition Problem.hxx:35
std::string m_name
Definition Problem.hxx:32
void name(std::string const &t_name)
Set the name of the optimization problem.
Definition Problem.hxx:90
Problem(std::string t_name)
Problem constructor.
Definition Problem.hxx:49
Problem & operator=(Problem const &)=delete
Deleted assignment operator.
virtual bool constraints_lower_bounds(Vector< Real > &out) const =0
Lower bounds on the constraints.
virtual bool primal_upper_bounds(Vector< Real > &out) const =0
Upper bounds on the primal variables.
virtual bool objective(Vector< Real > const &x, Real &out) const =0
Evaluate the objective function.
virtual bool constraints_upper_bounds(Vector< Real > &out) const =0
Upper bounds on the constraints.
virtual bool constraints(Vector< Real > const &x, Vector< Real > &out) const =0
Evaluate the constraints function.
Problem(Problem &&)=delete
Deleted move constructor.
Problem(Problem const &)=delete
Deleted copy constructor.
virtual bool constraints_jacobian(Vector< Real > const &x, SparseMatrix< Real > &out) const =0
Evaluate the Jacobian of the constraints function with respect to the primal variables.
Problem & operator=(Problem &&)=delete
Deleted move assignment operator.
Problem()=default
Default constructor.
std::string const & name() const
Get the name of the optimization problem.
Definition Problem.hxx:84
virtual bool objective_gradient(Vector< Real > const &x, Vector< Real > &out) const =0
Evaluate the gradient of the objective function.
bool constraints_upper_bounds(Vector< Real > &out) const override
Upper bounds on the constraints.
Definition Problem.hxx:468
std::function< bool(Vector< Real > &)> BoundsFunc
Definition Problem.hxx:179
void primal_lower_bounds(BoundsFunc const &primal_lower_bounds)
Set the lower bounds on the primal variables function.
Definition Problem.hxx:311
BoundsFunc & constraints_lower_bounds()
Get the lower bounds on the constraints function.
Definition Problem.hxx:335
void constraints_upper_bounds(BoundsFunc const &constraints_upper_bounds)
Set the upper bounds on the constraints function.
Definition Problem.hxx:356
LagrangianHessianFunc m_lagrangian_hessian
Definition Problem.hxx:187
ConstraintsJacobianFunc m_constraints_jacobian
Definition Problem.hxx:186
bool constraints_lower_bounds(Vector< Real > &out) const override
Lower bounds on the constraints.
Definition Problem.hxx:458
void objective_gradient(ObjectiveGradientFunc const &objective_gradient)
Set the gradient of the objective function.
Definition Problem.hxx:266
BoundsFunc m_constraints_lower_bounds
Definition Problem.hxx:192
void lagrangian_hessian(LagrangianHessianFunc const &lagrangian_hessian)
Set the Hessian of the Lagrangian function.
Definition Problem.hxx:371
std::function< bool(Vector< Real > const &, Vector< Real > &)> ObjectiveGradientFunc
Definition Problem.hxx:176
bool primal_lower_bounds(Vector< Real > &out) const override
Lower bounds on the primal variables.
Definition Problem.hxx:438
bool constraints_jacobian(Vector< Real > const &x, SparseMatrix< Real > &out) const override
Evaluate the Jacobian of the constraints function.
Definition Problem.hxx:415
BoundsFunc m_primal_lower_bounds
Definition Problem.hxx:190
bool lagrangian_hessian(Vector< Real > const &x, Vector< Real > const &l, SparseMatrix< Real > &out) const override
Evaluate the Hessian of the Lagrangian function.
Definition Problem.hxx:427
void constraints_lower_bounds(BoundsFunc const &constraints_lower_bounds)
Set the lower bounds on the constraints function.
Definition Problem.hxx:341
ConstraintsFunc m_constraints
Definition Problem.hxx:185
std::function< bool(Vector< Real > const &, Vector< Real > const &, SparseMatrix< Real > &)> LagrangianHessianFunc
Definition Problem.hxx:178
void constraints(ConstraintsFunc const &constraints)
Set the constraints function.
Definition Problem.hxx:281
std::function< bool(Vector< Real > const &, Real &)> ObjectiveFunc
Definition Problem.hxx:174
void constraints_jacobian(ConstraintsJacobianFunc const &constraints_jacobian)
Set the Jacobian of the constraints function.
Definition Problem.hxx:296
BoundsFunc m_constraints_upper_bounds
Definition Problem.hxx:193
ProblemWrapper(std::string const &t_name, ObjectiveFunc const &t_objective, ObjectiveGradientFunc const &t_objective_gradient, ConstraintsFunc const &t_constraints, ConstraintsJacobianFunc const &t_constraints_jacobian, LagrangianHessianFunc const &t_lagrangian_hessian, BoundsFunc const &t_primal_lower_bounds, BoundsFunc const &t_primal_upper_bounds, BoundsFunc const &t_constraints_lower_bounds, BoundsFunc const &t_constraints_upper_bounds)
Constructor for the ProblemWrapper class (without the Hessian of the Lagrangian).
Definition Problem.hxx:212
ObjectiveGradientFunc m_objective_gradient
Definition Problem.hxx:184
ObjectiveFunc & objective()
Get the objective function.
Definition Problem.hxx:245
~ProblemWrapper() override
Default destructor for the ProblemWrapper class.
Definition Problem.hxx:239
ObjectiveFunc m_objective
Definition Problem.hxx:183
ObjectiveGradientFunc & objective_gradient()
Get the gradient of the objective function.
Definition Problem.hxx:260
void objective(ObjectiveFunc const &objective)
Set the objective function.
Definition Problem.hxx:251
ConstraintsJacobianFunc & constraints_jacobian()
Get the Jacobian of the constraints function.
Definition Problem.hxx:290
void primal_upper_bounds(BoundsFunc const &primal_upper_bounds)
Set the upper bounds on the primal variables function.
Definition Problem.hxx:326
BoundsFunc m_primal_upper_bounds
Definition Problem.hxx:191
bool constraints(Vector< Real > const &x, Vector< Real > &out) const override
Evaluate the constraints function.
Definition Problem.hxx:404
LagrangianHessianFunc & lagrangian_hessian()
Get the Hessian of the Lagrangian function.
Definition Problem.hxx:365
BoundsFunc & constraints_upper_bounds()
Get the upper bounds on the constraints function.
Definition Problem.hxx:350
BoundsFunc & primal_upper_bounds()
Get the upper bounds on the primal variables function.
Definition Problem.hxx:320
BoundsFunc & primal_lower_bounds()
Get the lower bounds on the primal variables function.
Definition Problem.hxx:305
bool objective_gradient(Vector< Real > const &x, Vector< Real > &out) const override
Evaluate the gradient of the objective function.
Definition Problem.hxx:393
std::function< bool(Vector< Real > const &, Vector< Real > &)> ConstraintsFunc
Definition Problem.hxx:175
ConstraintsFunc & constraints()
Get the constraints function.
Definition Problem.hxx:275
bool objective(Vector< Real > const &x, Real &out) const override
Evaluate the objective function.
Definition Problem.hxx:382
bool primal_upper_bounds(Vector< Real > &out) const override
Upper bounds on the primal variables.
Definition Problem.hxx:448
std::function< bool(Vector< Real > const &, SparseMatrix< Real > &)> ConstraintsJacobianFunc
Definition Problem.hxx:177
Namespace for the Pipal library.
Definition Acceptance.hxx:16
Eigen::SparseMatrix< Real > SparseMatrix
Definition Types.hxx:114
Eigen::Vector< Real, Eigen::Dynamic > Vector
Definition Types.hxx:112