ROL
Loading...
Searching...
No Matches
ROL::Problem< Real > Class Template Reference

#include <ROL_Problem.hpp>

Public Member Functions

virtual ~Problem ()
 Problem (const Ptr< Objective< Real > > &obj, const Ptr< Vector< Real > > &x, const Ptr< Vector< Real > > &g=nullPtr)
 Default constructor for OptimizationProblem.
 Problem (const Problem &problem)
 Copy constructor for OptimizationProblem.
void addBoundConstraint (const Ptr< BoundConstraint< Real > > &bnd)
 Add a bound constraint.
void removeBoundConstraint ()
 Remove an existing bound constraint.
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.
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.
void addConstraint (std::string name, const Ptr< Constraint< Real > > &pcon, const Ptr< Vector< Real > > &pmul, const Ptr< Projection< Real > > &proj, const Ptr< Vector< Real > > &pres=nullPtr, bool reset=false)
 Add a projection constraint.
void removeConstraint (std::string name)
 Remove an existing constraint.
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.
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.
void removeLinearConstraint (std::string name)
 Remove an existing linear constraint.
void setProjectionAlgorithm (ParameterList &parlist)
 Set polyhedral projection algorithm.
void addProximableObjective (const Ptr< Objective< Real > > &nobj)
 Set Proximable objective function.
void removeProximableObjective ()
 Remove Proximable objective function.
void addConstraintGroup (const std::string &group_name, const std::vector< std::string > &constraint_names)
 Combine a set of constraints into a group.
void removeConstraintGroup (const std::string &group_name)
 Remove a group of constraints.
const Ptr< Objective< Real > > & getObjective ()
 Get the objective function.
const Ptr< Objective< Real > > & getProximableObjective ()
 Get proximable objective.
const Ptr< Vector< Real > > & getPrimalOptimizationVector ()
 Get the primal optimization space vector.
const Ptr< Vector< Real > > & getDualOptimizationVector ()
 Get the dual optimization space vector.
const Ptr< BoundConstraint< Real > > & getBoundConstraint ()
 Get the bound constraint.
const Ptr< Constraint< Real > > & getConstraint ()
 Get the equality constraint.
const Ptr< Vector< Real > > & getMultiplierVector ()
 Get the dual constraint space vector.
const Ptr< Vector< Real > > & getResidualVector ()
 Get the primal constraint space vector.
const Ptr< PolyhedralProjection< Real > > & getPolyhedralProjection ()
 Get the polyhedral projection object. This is a null pointer if no linear constraints and/or bounds are present.
EProblem getProblemType ()
 Get the optimization problem type (U, B, E, G, or P).
Ptr< ConstraintData< Real > > getConstraintData (const std::string &constraint_name)
const std::vector< std::string > & getUngroupedEqualityConstraintNames ()
const std::vector< std::string > & getUngroupedLinearEqualityConstraintNames ()
const std::vector< std::string > getGroupNames ()
const Ptr< ConstraintData< Real > > getGroupConstraintData (const std::string &group_name)
Real checkLinearity (bool printToStream=false, std::ostream &outStream=std::cout) const
 Check if user-supplied linear constraints are affine.
void checkVectors (bool printToStream=false, std::ostream &outStream=std::cout) const
 Run vector checks for user-supplied vectors.
void checkDerivatives (bool printToStream=false, std::ostream &outStream=std::cout, const Ptr< Vector< Real > > &x0=nullPtr, Real scale=Real(1)) const
 Run derivative checks for user-supplied objective function and constraints.
void check (bool printToStream=false, std::ostream &outStream=std::cout, const Ptr< Vector< Real > > &x0=nullPtr, Real scale=Real(1)) const
 Run vector, linearity and derivative checks for user-supplied vectors, objective function and constraints.
virtual void finalize (bool lumpConstraints=false, bool printToStream=false, std::ostream &outStream=std::cout, bool useSlackVariables=true)
 Tranform user-supplied constraints. Problem cannot be modified after finalize has been called without calling the edit function.
bool isFinalized () const
 Indicate whether or no finalize has been called.
virtual void edit ()
 Resume editting optimization problem after finalize has been called.
void finalizeIteration ()
 Transform the optimization variables to the native parameterization after an optimization algorithm has finished.

Protected Attributes

Ptr< Objective< Real > > INPUT_obj_
Ptr< Objective< Real > > INPUT_nobj_
Ptr< Vector< Real > > INPUT_xprim_
Ptr< Vector< Real > > INPUT_xdual_
Ptr< BoundConstraint< Real > > INPUT_bnd_
std::unordered_map< std::string, ConstraintData< Real > > INPUT_con_
std::unordered_map< std::string, ConstraintData< Real > > INPUT_linear_con_
std::unordered_map< std::string, ConstraintData< Real > > INPUT_proj_
std::unordered_map< std::string, std::vector< std::string > > groups_
std::unordered_set< std::string > grouped_constraint_names_
std::vector< std::string > ungrouped_equality_constraint_names_
std::vector< std::string > ungrouped_linear_equality_constraint_names_

Private Attributes

bool isFinalized_
bool hasBounds_
bool hasEquality_
bool hasInequality_
bool hasLinearEquality_
bool hasLinearInequality_
bool hasProximableObjective_
unsigned cnt_econ_
unsigned cnt_icon_
unsigned cnt_linear_econ_
unsigned cnt_linear_icon_
ParameterList ppa_list_
Ptr< Objective< Real > > obj_
Ptr< Objective< Real > > nobj_
Ptr< Vector< Real > > xprim_
Ptr< Vector< Real > > xdual_
Ptr< BoundConstraint< Real > > bnd_
Ptr< Constraint< Real > > con_
Ptr< Vector< Real > > mul_
Ptr< Vector< Real > > res_
Ptr< PolyhedralProjection< Real > > proj_
Ptr< Vector< Real > > xfeas_
Ptr< ReduceLinearConstraint< Real > > rlc_
EProblem problemType_

Detailed Description

template<typename Real>
class ROL::Problem< Real >

Definition at line 27 of file ROL_Problem.hpp.

Constructor & Destructor Documentation

◆ ~Problem()

template<typename Real>
virtual ROL::Problem< Real >::~Problem ( )
inlinevirtual

Definition at line 74 of file ROL_Problem.hpp.

◆ Problem() [1/2]

template<typename Real>
ROL::Problem< Real >::Problem ( const Ptr< Objective< Real > > & obj,
const Ptr< Vector< Real > > & x,
const Ptr< Vector< Real > > & g = nullPtr )

Default constructor for OptimizationProblem.

Parameters
[in]objobjective function object
[in]xprimal optimization space vector
[in]gdual optimization space vector

Referenced by Problem().

◆ Problem() [2/2]

Member Function Documentation

◆ addBoundConstraint()

◆ removeBoundConstraint()

template<typename Real>
void ROL::Problem< Real >::removeBoundConstraint ( )

Remove an existing bound constraint.

◆ addConstraint() [1/3]

◆ addConstraint() [2/3]

template<typename Real>
void ROL::Problem< Real >::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.

Parameters
[in]namethe unique constraint identifier
[in]iconconstraint object
[in]imuldual constraint space vector
[in]ibndbound constraint
[in]iresprimal constraint space vector
[in]resetwhether or not to clear constraint container

◆ addConstraint() [3/3]

template<typename Real>
void ROL::Problem< Real >::addConstraint ( std::string name,
const Ptr< Constraint< Real > > & pcon,
const Ptr< Vector< Real > > & pmul,
const Ptr< Projection< Real > > & proj,
const Ptr< Vector< Real > > & pres = nullPtr,
bool reset = false )

Add a projection constraint.

Parameters
[in]namethe unique constraint identifier
[in]pconconstraint object
[in]pmuldual constraint space vector
[in]projprojection
[in]presprimal constraint space vector
[in]resetwhether or not to clear constraint container

◆ removeConstraint()

template<typename Real>
void ROL::Problem< Real >::removeConstraint ( std::string name)

◆ addLinearConstraint() [1/2]

template<typename Real>
void ROL::Problem< Real >::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 )

◆ addLinearConstraint() [2/2]

template<typename Real>
void ROL::Problem< Real >::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.

Parameters
[in]namethe unique constraint identifier
[in]linear_iconconstraint object
[in]linear_imuldual constraint space vector
[in]linear_ibndbound constraint
[in]linear_iresprimal constraint space vector
[in]resetwhether or not to clear linear constraint container

◆ removeLinearConstraint()

template<typename Real>
void ROL::Problem< Real >::removeLinearConstraint ( std::string name)

◆ setProjectionAlgorithm()

template<typename Real>
void ROL::Problem< Real >::setProjectionAlgorithm ( ParameterList & parlist)

Set polyhedral projection algorithm.

Parameters
[in]ppapolyhedral projection algorithm

Referenced by ROL::TypeG::StabilizedLCLAlgorithm< Real >::run().

◆ addProximableObjective()

template<typename Real>
void ROL::Problem< Real >::addProximableObjective ( const Ptr< Objective< Real > > & nobj)

Set Proximable objective function.

◆ removeProximableObjective()

template<typename Real>
void ROL::Problem< Real >::removeProximableObjective ( )

Remove Proximable objective function.

◆ addConstraintGroup()

template<typename Real>
void ROL::Problem< Real >::addConstraintGroup ( const std::string & group_name,
const std::vector< std::string > & constraint_names )

Combine a set of constraints into a group.

Parameters
[in]group_namegroup name
[in]constraint_namesconstraint names

◆ removeConstraintGroup()

template<typename Real>
void ROL::Problem< Real >::removeConstraintGroup ( const std::string & group_name)

Remove a group of constraints.

Parameters
[in]group_namegroup name

◆ getObjective()

◆ getProximableObjective()

template<typename Real>
const Ptr< Objective< Real > > & ROL::Problem< Real >::getProximableObjective ( )

Get proximable objective.

Referenced by ROL::TypeP::Algorithm< Real >::run().

◆ getPrimalOptimizationVector()

◆ getDualOptimizationVector()

template<typename Real>
const Ptr< Vector< Real > > & ROL::Problem< Real >::getDualOptimizationVector ( )

◆ getBoundConstraint()

◆ getConstraint()

template<typename Real>
const Ptr< Constraint< Real > > & ROL::Problem< Real >::getConstraint ( )

◆ getMultiplierVector()

template<typename Real>
const Ptr< Vector< Real > > & ROL::Problem< Real >::getMultiplierVector ( )

◆ getResidualVector()

template<typename Real>
const Ptr< Vector< Real > > & ROL::Problem< Real >::getResidualVector ( )

◆ getPolyhedralProjection()

template<typename Real>
const Ptr< PolyhedralProjection< Real > > & ROL::Problem< Real >::getPolyhedralProjection ( )

◆ getProblemType()

◆ getConstraintData()

template<typename Real>
Ptr< ConstraintData< Real > > ROL::Problem< Real >::getConstraintData ( const std::string & constraint_name)

◆ getUngroupedEqualityConstraintNames()

template<typename Real>
const std::vector< std::string > & ROL::Problem< Real >::getUngroupedEqualityConstraintNames ( )

◆ getUngroupedLinearEqualityConstraintNames()

template<typename Real>
const std::vector< std::string > & ROL::Problem< Real >::getUngroupedLinearEqualityConstraintNames ( )

◆ getGroupNames()

template<typename Real>
const std::vector< std::string > ROL::Problem< Real >::getGroupNames ( )

◆ getGroupConstraintData()

template<typename Real>
const Ptr< ConstraintData< Real > > ROL::Problem< Real >::getGroupConstraintData ( const std::string & group_name)

◆ checkLinearity()

template<typename Real>
Real ROL::Problem< Real >::checkLinearity ( bool printToStream = false,
std::ostream & outStream = std::cout ) const

Check if user-supplied linear constraints are affine.

This function computes the error

\[ \|c(x+\alpha y) - (c(x)+\alpha (c(y)-c(0)))\| \]

for each user-supplied linear constraint and returns the maximum.

Parameters
[in]printToStreamdetermines whether to print to the supplied std::ostream
[in,out]outStreamuser supplied std::ostream

◆ checkVectors()

template<typename Real>
void ROL::Problem< Real >::checkVectors ( bool printToStream = false,
std::ostream & outStream = std::cout ) const

Run vector checks for user-supplied vectors.

Parameters
[in]printToStreamdetermines whether to print to the supplied std::ostream
[in,out]outStreamuser supplied std::ostream

◆ checkDerivatives()

template<typename Real>
void ROL::Problem< Real >::checkDerivatives ( bool printToStream = false,
std::ostream & outStream = std::cout,
const Ptr< Vector< Real > > & x0 = nullPtr,
Real scale = Real(1) ) const

Run derivative checks for user-supplied objective function and constraints.

Parameters
[in]printToStreamdetermines whether to print to the supplied std::ostream
[in,out]outStreamuser supplied std::ostream

◆ check()

template<typename Real>
void ROL::Problem< Real >::check ( bool printToStream = false,
std::ostream & outStream = std::cout,
const Ptr< Vector< Real > > & x0 = nullPtr,
Real scale = Real(1) ) const

Run vector, linearity and derivative checks for user-supplied vectors, objective function and constraints.

Parameters
[in]printToStreamdetermines whether to print to the supplied std::ostream
[in,out]outStreamuser supplied std::ostream

Referenced by ROL::TypeE::StabilizedLCLAlgorithm< Real >::run(), and ROL::TypeG::StabilizedLCLAlgorithm< Real >::run().

◆ finalize()

template<typename Real>
virtual void ROL::Problem< Real >::finalize ( bool lumpConstraints = false,
bool printToStream = false,
std::ostream & outStream = std::cout,
bool useSlackVariables = true )
virtual

◆ isFinalized()

template<typename Real>
bool ROL::Problem< Real >::isFinalized ( ) const

Indicate whether or no finalize has been called.

Referenced by ROL::StochasticProblem< Real >::finalize().

◆ edit()

template<typename Real>
virtual void ROL::Problem< Real >::edit ( )
virtual

Resume editting optimization problem after finalize has been called.

Referenced by ROL::StochasticProblem< Real >::edit(), ROL::TypeE::StabilizedLCLAlgorithm< Real >::run(), and ROL::TypeG::StabilizedLCLAlgorithm< Real >::run().

◆ finalizeIteration()

template<typename Real>
void ROL::Problem< Real >::finalizeIteration ( )

Transform the optimization variables to the native parameterization after an optimization algorithm has finished.

Referenced by ROL::TypeB::Algorithm< Real >::run(), ROL::TypeE::StabilizedLCLAlgorithm< Real >::run(), ROL::TypeG::Algorithm< Real >::run(), ROL::TypeG::StabilizedLCLAlgorithm< Real >::run(), and ROL::TypeP::Algorithm< Real >::run().

Member Data Documentation

◆ isFinalized_

template<typename Real>
bool ROL::Problem< Real >::isFinalized_
private

Definition at line 29 of file ROL_Problem.hpp.

Referenced by Problem().

◆ hasBounds_

template<typename Real>
bool ROL::Problem< Real >::hasBounds_
private

Definition at line 30 of file ROL_Problem.hpp.

Referenced by Problem().

◆ hasEquality_

template<typename Real>
bool ROL::Problem< Real >::hasEquality_
private

Definition at line 31 of file ROL_Problem.hpp.

Referenced by Problem().

◆ hasInequality_

template<typename Real>
bool ROL::Problem< Real >::hasInequality_
private

Definition at line 32 of file ROL_Problem.hpp.

Referenced by Problem().

◆ hasLinearEquality_

template<typename Real>
bool ROL::Problem< Real >::hasLinearEquality_
private

Definition at line 33 of file ROL_Problem.hpp.

Referenced by Problem().

◆ hasLinearInequality_

template<typename Real>
bool ROL::Problem< Real >::hasLinearInequality_
private

Definition at line 34 of file ROL_Problem.hpp.

Referenced by Problem().

◆ hasProximableObjective_

template<typename Real>
bool ROL::Problem< Real >::hasProximableObjective_
private

Definition at line 35 of file ROL_Problem.hpp.

Referenced by Problem().

◆ cnt_econ_

template<typename Real>
unsigned ROL::Problem< Real >::cnt_econ_
private

Definition at line 36 of file ROL_Problem.hpp.

Referenced by Problem().

◆ cnt_icon_

template<typename Real>
unsigned ROL::Problem< Real >::cnt_icon_
private

Definition at line 37 of file ROL_Problem.hpp.

Referenced by Problem().

◆ cnt_linear_econ_

template<typename Real>
unsigned ROL::Problem< Real >::cnt_linear_econ_
private

Definition at line 38 of file ROL_Problem.hpp.

Referenced by Problem().

◆ cnt_linear_icon_

template<typename Real>
unsigned ROL::Problem< Real >::cnt_linear_icon_
private

Definition at line 39 of file ROL_Problem.hpp.

Referenced by Problem().

◆ ppa_list_

template<typename Real>
ParameterList ROL::Problem< Real >::ppa_list_
private

Definition at line 41 of file ROL_Problem.hpp.

Referenced by Problem().

◆ obj_

template<typename Real>
Ptr<Objective<Real> > ROL::Problem< Real >::obj_
private

Definition at line 43 of file ROL_Problem.hpp.

◆ nobj_

template<typename Real>
Ptr<Objective<Real> > ROL::Problem< Real >::nobj_
private

Definition at line 44 of file ROL_Problem.hpp.

◆ xprim_

template<typename Real>
Ptr<Vector<Real> > ROL::Problem< Real >::xprim_
private

Definition at line 45 of file ROL_Problem.hpp.

◆ xdual_

template<typename Real>
Ptr<Vector<Real> > ROL::Problem< Real >::xdual_
private

Definition at line 46 of file ROL_Problem.hpp.

◆ bnd_

template<typename Real>
Ptr<BoundConstraint<Real> > ROL::Problem< Real >::bnd_
private

Definition at line 47 of file ROL_Problem.hpp.

◆ con_

template<typename Real>
Ptr<Constraint<Real> > ROL::Problem< Real >::con_
private

Definition at line 48 of file ROL_Problem.hpp.

◆ mul_

template<typename Real>
Ptr<Vector<Real> > ROL::Problem< Real >::mul_
private

Definition at line 49 of file ROL_Problem.hpp.

◆ res_

template<typename Real>
Ptr<Vector<Real> > ROL::Problem< Real >::res_
private

Definition at line 50 of file ROL_Problem.hpp.

◆ proj_

template<typename Real>
Ptr<PolyhedralProjection<Real> > ROL::Problem< Real >::proj_
private

Definition at line 51 of file ROL_Problem.hpp.

◆ xfeas_

template<typename Real>
Ptr<Vector<Real> > ROL::Problem< Real >::xfeas_
private

Definition at line 53 of file ROL_Problem.hpp.

◆ rlc_

template<typename Real>
Ptr<ReduceLinearConstraint<Real> > ROL::Problem< Real >::rlc_
private

Definition at line 54 of file ROL_Problem.hpp.

◆ problemType_

template<typename Real>
EProblem ROL::Problem< Real >::problemType_
private

Definition at line 56 of file ROL_Problem.hpp.

◆ INPUT_obj_

template<typename Real>
Ptr<Objective<Real> > ROL::Problem< Real >::INPUT_obj_
protected

Definition at line 60 of file ROL_Problem.hpp.

Referenced by Problem().

◆ INPUT_nobj_

template<typename Real>
Ptr<Objective<Real> > ROL::Problem< Real >::INPUT_nobj_
protected

Definition at line 61 of file ROL_Problem.hpp.

Referenced by Problem().

◆ INPUT_xprim_

template<typename Real>
Ptr<Vector<Real> > ROL::Problem< Real >::INPUT_xprim_
protected

Definition at line 62 of file ROL_Problem.hpp.

Referenced by Problem().

◆ INPUT_xdual_

template<typename Real>
Ptr<Vector<Real> > ROL::Problem< Real >::INPUT_xdual_
protected

Definition at line 63 of file ROL_Problem.hpp.

Referenced by Problem().

◆ INPUT_bnd_

template<typename Real>
Ptr<BoundConstraint<Real> > ROL::Problem< Real >::INPUT_bnd_
protected

Definition at line 64 of file ROL_Problem.hpp.

Referenced by Problem().

◆ INPUT_con_

template<typename Real>
std::unordered_map<std::string,ConstraintData<Real> > ROL::Problem< Real >::INPUT_con_
protected

Definition at line 65 of file ROL_Problem.hpp.

Referenced by Problem().

◆ INPUT_linear_con_

template<typename Real>
std::unordered_map<std::string,ConstraintData<Real> > ROL::Problem< Real >::INPUT_linear_con_
protected

Definition at line 66 of file ROL_Problem.hpp.

Referenced by Problem().

◆ INPUT_proj_

template<typename Real>
std::unordered_map<std::string,ConstraintData<Real> > ROL::Problem< Real >::INPUT_proj_
protected

Definition at line 67 of file ROL_Problem.hpp.

Referenced by Problem().

◆ groups_

template<typename Real>
std::unordered_map<std::string,std::vector<std::string> > ROL::Problem< Real >::groups_
protected

Definition at line 68 of file ROL_Problem.hpp.

Referenced by Problem().

◆ grouped_constraint_names_

template<typename Real>
std::unordered_set<std::string> ROL::Problem< Real >::grouped_constraint_names_
protected

Definition at line 69 of file ROL_Problem.hpp.

Referenced by Problem().

◆ ungrouped_equality_constraint_names_

template<typename Real>
std::vector<std::string> ROL::Problem< Real >::ungrouped_equality_constraint_names_
protected

Definition at line 70 of file ROL_Problem.hpp.

Referenced by Problem().

◆ ungrouped_linear_equality_constraint_names_

template<typename Real>
std::vector<std::string> ROL::Problem< Real >::ungrouped_linear_equality_constraint_names_
protected

Definition at line 71 of file ROL_Problem.hpp.

Referenced by Problem().


The documentation for this class was generated from the following file: