44 #ifndef ROL_LINEARREGRESSION_H
45 #define ROL_LINEARREGRESSION_H
52 #include "ROL_Problem.hpp"
69 const Ptr<RegressionError<Real>>
error_;
70 const Ptr<SampleGenerator<Real>>
data_;
72 Ptr<RandVarFunctional<Real>>
em_;
73 Ptr<StochasticObjective<Real>>
obj_;
75 Ptr<RiskVector<Real>>
c_;
79 Ptr<BoundConstraint<Real>>
bnd_;
80 Ptr<RiskBoundConstraint<Real>>
rbnd_;
89 int dim =
data_->getMyPoint(0).size();
90 cdata_ = makePtr<std::vector<Real>>(
dim,0);
91 c_ = makePtr<RiskVector<Real>>(makePtr<StdVector<Real>>(
cdata_));
96 em_ = ErrorMeasureFactory<Real>(parlist);
103 lower_ = makePtr<std::vector<Real>>(lower);
107 upper_ = makePtr<std::vector<Real>>(upper);
120 bnd_ = makePtr<StdBoundConstraint<Real>>(*
lower_,
true);
123 bnd_ = makePtr<StdBoundConstraint<Real>>(*
upper_,
false);
128 if (
bnd_ != nullPtr) {
129 rbnd_ = makePtr<RiskBoundConstraint<Real>>(
bnd_);
130 return makePtr<OptimizationProblem<Real>>(
obj_,
c_,
rbnd_);
132 return makePtr<OptimizationProblem<Real>>(
obj_,
c_);
139 Ptr<Problem<Real>> prob
140 = makePtr<Problem<Real>>(
obj_,
c_);
142 bnd_ = makePtr<StdBoundConstraint<Real>>(*
lower_,
true);
145 bnd_ = makePtr<StdBoundConstraint<Real>>(*
upper_,
false);
150 if (
bnd_ != nullPtr) {
151 rbnd_ = makePtr<RiskBoundConstraint<Real>>(
bnd_);
152 prob->addBoundConstraint(
rbnd_);
161 void print(std::ostream &out = std::cout,
const std::string delim =
" ")
const {
164 for (
int i = 0; i <
dim; ++i) {
165 out << delim << (*cdata_)[i];
167 out << std::endl << std::endl;
Contains definitions for std::vector bound constraints.
void setUpperBound(const std::vector< Real > &upper)
Provides the interface to evaluate linear regression error.
Ptr< RiskVector< Real > > c_
Ptr< BoundConstraint< Real > > bnd_
Ptr< RiskBoundConstraint< Real > > rbnd_
void print(std::ostream &out=std::cout, const std::string delim=" ") const
Provides the interface to construct linear regression problem.
Ptr< std::vector< Real > > upper_
void setLowerBound(const std::vector< Real > &lower)
Ptr< std::vector< Real > > cdata_
void setErrorMeasure(ROL::ParameterList &parlist, bool reset=false)
Ptr< std::vector< Real > > lower_
const Ptr< OptimizationProblem< Real > > getOptimizationProblem(void)
const Ptr< RegressionError< Real > > error_
LinearRegression(const Ptr< SampleGenerator< Real >> &data)
const Ptr< SampleGenerator< Real > > data_
const Ptr< Problem< Real > > getProblem(void)
const Ptr< std::vector< Real > > getCoefficients(void) const
Ptr< StochasticObjective< Real > > obj_
Ptr< RandVarFunctional< Real > > em_