44#ifndef ROL_PROBLEM_HPP
45#define ROL_PROBLEM_HPP
48#include <unordered_map>
59template<
typename Real>
75 Ptr<Objective<Real>>
obj_;
78 Ptr<BoundConstraint<Real>>
bnd_;
79 Ptr<Constraint<Real>>
con_;
80 Ptr<Vector<Real>>
mul_;
81 Ptr<Vector<Real>>
res_;
82 Ptr<PolyhedralProjection<Real>>
proj_;
85 Ptr<ReduceLinearConstraint<Real>>
rlc_;
95 std::unordered_map<std::string,ConstraintData<Real>>
INPUT_con_;
281 Real
checkLinearity(
bool printToStream =
false, std::ostream &outStream = std::cout)
const;
288 void checkVectors(
bool printToStream =
false, std::ostream &outStream = std::cout)
const;
295 void checkDerivatives(
bool printToStream =
false, std::ostream &outStream = std::cout,
const Ptr<
Vector<Real>> &x0 = nullPtr, Real scale = Real(1))
const;
303 void check(
bool printToStream =
false, std::ostream &outStream = std::cout,
const Ptr<
Vector<Real>> &x0 = nullPtr, Real scale = Real(1))
const;
317 virtual void finalize(
bool lumpConstraints =
false,
bool printToStream =
false,
318 std::ostream &outStream = std::cout);
Contains definitions of custom data types in ROL.
Provides the interface to apply upper and lower bound constraints.
Defines the general constraint operator interface.
Provides the interface to evaluate objective functions.
Ptr< BoundConstraint< Real > > INPUT_bnd_
Problem(const Problem &problem)
Copy constructor for OptimizationProblem.
const Ptr< PolyhedralProjection< Real > > & getPolyhedralProjection()
Get the polyhedral projection object. This is a null pointer if no linear constraints and/or bounds a...
Ptr< Objective< Real > > INPUT_obj_
void addLinearConstraint(std::string name, const Ptr< Constraint< Real > > &linear_icon, const Ptr< Vector< Real > > &linear_imul, const Ptr< BoundConstraint< Real > > &linear_ibnd, const Ptr< Vector< Real > > &linear_ires=nullPtr, bool reset=false)
Add a linear inequality constraint.
const Ptr< Vector< Real > > & getPrimalOptimizationVector()
Get the primal optimization space vector.
void removeConstraint(std::string name)
Remove an existing constraint.
const Ptr< Vector< Real > > & getDualOptimizationVector()
Get the dual optimization space vector.
void removeLinearConstraint(std::string name)
Remove an existing linear constraint.
bool isFinalized() const
Indicate whether or no finalize has been called.
const Ptr< Vector< Real > > & getMultiplierVector()
Get the dual constraint space vector.
const Ptr< Constraint< Real > > & getConstraint()
Get the equality constraint.
void checkVectors(bool printToStream=false, std::ostream &outStream=std::cout) const
Run vector checks for user-supplied vectors.
Ptr< Constraint< Real > > con_
std::unordered_map< std::string, ConstraintData< Real > > INPUT_linear_con_
void removeBoundConstraint()
Remove an existing bound constraint.
Ptr< Vector< Real > > xprim_
EProblem getProblemType()
Get the optimization problem type (U, B, E, or G).
void addLinearConstraint(std::string name, const Ptr< Constraint< Real > > &linear_econ, const Ptr< Vector< Real > > &linear_emul, const Ptr< Vector< Real > > &linear_eres=nullPtr, bool reset=false)
Add a linear equality constraint.
Ptr< Vector< Real > > mul_
void addBoundConstraint(const Ptr< BoundConstraint< Real > > &bnd)
Add a bound constraint.
Ptr< BoundConstraint< Real > > bnd_
void setProjectionAlgorithm(ParameterList &parlist)
Set polyhedral projection algorithm.
unsigned cnt_linear_econ_
void finalizeIteration()
Transform the optimization variables to the native parameterization after an optimization algorithm h...
Ptr< Vector< Real > > INPUT_xdual_
Ptr< Vector< Real > > xfeas_
unsigned cnt_linear_icon_
Ptr< PolyhedralProjection< Real > > proj_
virtual void edit()
Resume editting optimization problem after finalize has been called.
std::unordered_map< std::string, ConstraintData< Real > > INPUT_con_
void addConstraint(std::string name, const Ptr< Constraint< Real > > &econ, const Ptr< Vector< Real > > &emul, const Ptr< Vector< Real > > &eres=nullPtr, bool reset=false)
Add an equality constraint.
Ptr< Vector< Real > > res_
Ptr< Objective< Real > > obj_
void check(bool printToStream=false, std::ostream &outStream=std::cout) const
Run vector, linearity and derivative checks for user-supplied vectors, objective function and constra...
Ptr< Vector< Real > > xdual_
Ptr< Vector< Real > > INPUT_xprim_
void checkDerivatives(bool printToStream=false, std::ostream &outStream=std::cout) const
Run derivative checks for user-supplied objective function and constraints.
Ptr< ReduceLinearConstraint< Real > > rlc_
virtual void finalize(bool lumpConstraints=false, bool printToStream=false, std::ostream &outStream=std::cout)
Tranform user-supplied constraints to consist of only bounds and equalities. Optimization problem can...
const Ptr< Objective< Real > > & getObjective()
Get the objective function.
const Ptr< BoundConstraint< Real > > & getBoundConstraint()
Get the bound constraint.
const Ptr< Vector< Real > > & getResidualVector()
Get the primal constraint space vector.
Real checkLinearity(bool printToStream=false, std::ostream &outStream=std::cout) const
Check if user-supplied linear constraints are affine.
Problem(const Ptr< Objective< Real > > &obj, const Ptr< Vector< Real > > &x, const Ptr< Vector< Real > > &g=nullPtr)
Default constructor for OptimizationProblem.
bool hasLinearInequality_
void addConstraint(std::string name, const Ptr< Constraint< Real > > &icon, const Ptr< Vector< Real > > &imul, const Ptr< BoundConstraint< Real > > &ibnd, const Ptr< Vector< Real > > &ires=nullPtr, bool reset=false)
Add an inequality constraint.
Defines the linear algebra or vector space interface.