10#ifndef ROL_PROBLEM_HPP
11#define ROL_PROBLEM_HPP
14#include <unordered_map>
15#include <unordered_set>
26template<
typename Real>
47 Ptr<BoundConstraint<Real>>
bnd_;
48 Ptr<Constraint<Real>>
con_;
51 Ptr<PolyhedralProjection<Real>>
proj_;
54 Ptr<ReduceLinearConstraint<Real>>
rlc_;
65 std::unordered_map<std::string,ConstraintData<Real>>
INPUT_con_;
67 std::unordered_map<std::string,ConstraintData<Real>>
INPUT_proj_;
68 std::unordered_map<std::string,std::vector<std::string>>
groups_;
239 const std::vector<std::string> &constraint_names);
316 Real
checkLinearity(
bool printToStream =
false, std::ostream &outStream = std::cout)
const;
323 void checkVectors(
bool printToStream =
false, std::ostream &outStream = std::cout)
const;
330 void checkDerivatives(
bool printToStream =
false, std::ostream &outStream = std::cout,
const Ptr<
Vector<Real>> &x0 = nullPtr, Real scale = Real(1))
const;
338 void check(
bool printToStream =
false, std::ostream &outStream = std::cout,
const Ptr<
Vector<Real>> &x0 = nullPtr, Real scale = Real(1))
const;
352 virtual void finalize(
bool lumpConstraints =
false,
353 bool printToStream =
false,
354 std::ostream &outStream = std::cout,
355 bool useSlackVariables =
true);
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.
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 constra...
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...
Problem(const Problem &problem)
Copy constructor for OptimizationProblem.
Ptr< Vector< Real > > INPUT_xdual_
const Ptr< PolyhedralProjection< Real > > & getPolyhedralProjection()
Get the polyhedral projection object. This is a null pointer if no linear constraints and/or bounds a...
bool hasProximableObjective_
const std::vector< std::string > & getUngroupedEqualityConstraintNames()
const std::vector< std::string > getGroupNames()
Ptr< PolyhedralProjection< Real > > proj_
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.
Ptr< Vector< Real > > xprim_
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.
Ptr< Objective< Real > > INPUT_obj_
const Ptr< Vector< Real > > & getMultiplierVector()
Get the dual constraint space vector.
std::vector< std::string > ungrouped_linear_equality_constraint_names_
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< Vector< Real > > res_
Ptr< ConstraintData< Real > > getConstraintData(const std::string &constraint_name)
void removeBoundConstraint()
Remove an existing bound constraint.
const Ptr< Objective< Real > > & getProximableObjective()
Get proximable objective.
EProblem getProblemType()
Get the optimization problem type (U, B, E, G, or P).
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 addConstraintGroup(const std::string &group_name, const std::vector< std::string > &constraint_names)
Combine a set of constraints into a group.
void addBoundConstraint(const Ptr< BoundConstraint< Real > > &bnd)
Add a bound constraint.
std::vector< std::string > ungrouped_equality_constraint_names_
Ptr< ReduceLinearConstraint< Real > > rlc_
void setProjectionAlgorithm(ParameterList &parlist)
Set polyhedral projection algorithm.
unsigned cnt_linear_econ_
Ptr< Objective< Real > > nobj_
void finalizeIteration()
Transform the optimization variables to the native parameterization after an optimization algorithm h...
unsigned cnt_linear_icon_
Ptr< Vector< Real > > xdual_
virtual void edit()
Resume editting optimization problem after finalize has been called.
Ptr< Vector< Real > > xfeas_
std::unordered_map< std::string, ConstraintData< Real > > INPUT_proj_
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 addProximableObjective(const Ptr< Objective< Real > > &nobj)
Set Proximable objective function.
const std::vector< std::string > & getUngroupedLinearEqualityConstraintNames()
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.
std::unordered_map< std::string, std::vector< std::string > > groups_
Ptr< Objective< Real > > obj_
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.
Ptr< Constraint< Real > > con_
std::unordered_map< std::string, ConstraintData< Real > > INPUT_linear_con_
Ptr< Vector< Real > > mul_
const Ptr< ConstraintData< Real > > getGroupConstraintData(const std::string &group_name)
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.
void removeConstraintGroup(const std::string &group_name)
Remove a group of constraints.
void removeProximableObjective()
Remove Proximable objective function.
Ptr< BoundConstraint< Real > > INPUT_bnd_
Real checkLinearity(bool printToStream=false, std::ostream &outStream=std::cout) const
Check if user-supplied linear constraints are affine.
Ptr< Vector< Real > > INPUT_xprim_
Problem(const Ptr< Objective< Real > > &obj, const Ptr< Vector< Real > > &x, const Ptr< Vector< Real > > &g=nullPtr)
Default constructor for OptimizationProblem.
std::unordered_map< std::string, ConstraintData< Real > > INPUT_con_
Ptr< BoundConstraint< Real > > bnd_
bool hasLinearInequality_
std::unordered_set< std::string > grouped_constraint_names_
Ptr< Objective< Real > > INPUT_nobj_
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.