21 #ifndef __mast__function_evaluation_h__ 22 #define __mast__function_evaluation_h__ 37 #include "libmesh/parallel_object.h" 43 class OptimizationInterface;
46 public libMesh::ParallelObject {
51 libMesh::ParallelObject (comm_in),
73 unsigned int n_eq()
const {
98 virtual void init_dvar(std::vector<Real>& x,
99 std::vector<Real>& xmin,
100 std::vector<Real>& xmax) = 0;
106 virtual void evaluate(
const std::vector<Real>& dvars,
109 std::vector<Real>& obj_grad,
110 std::vector<Real>& fvals,
111 std::vector<bool>& eval_grads,
112 std::vector<Real>& grads) = 0;
130 _output->open(nm.c_str(), std::ofstream::out);
138 virtual void output(
unsigned int iter,
139 const std::vector<Real>& x,
141 const std::vector<Real>& fval,
142 bool if_write_to_optim_file);
154 const unsigned int iter,
155 std::vector<Real> &x);
168 const unsigned int iter1,
169 const unsigned int iter2,
173 #if MAST_ENABLE_SNOPT == 1 174 typedef void (*funobj) (
int* mode,
182 typedef void (*funcon) (
int* mode,
197 get_objective_evaluation_function() {
201 libmesh_assert(
false);
211 get_constraint_evaluation_function() {
215 libmesh_assert(
false);
232 std::vector<Real>& xmin,
233 std::vector<Real>& xmax);
245 std::vector<Real>& obj_grad,
246 std::vector<Real>& fvals,
247 std::vector<bool>& eval_grads,
248 std::vector<Real>& grads);
256 const std::vector<Real>& x,
258 const std::vector<Real>& fval,
259 bool if_write_to_optim_file);
283 #endif // __mast__function_evaluation_h__
virtual void output(unsigned int iter, const std::vector< Real > &x, Real obj, const std::vector< Real > &fval, bool if_write_to_optim_file)
outputs the the current iterate to libMesh::out, and to the output file if it was set for this rank...
virtual void parametric_line_study(const std::string &nm, const unsigned int iter1, const unsigned int iter2, unsigned int divs)
computes a parametric evaluation along a line from iter1 to iter2 in file nm with divs runs between t...
void sanitize_parallel()
make sure that the analysis is setup consistently across all parallel processes
virtual void init_dvar(std::vector< Real > &x, std::vector< Real > &xmin, std::vector< Real > &xmax)=0
FunctionEvaluation(const libMesh::Parallel::Communicator &comm_in)
MAST::OptimizationInterface * _optimization_interface
unsigned int max_iters() const
virtual void evaluate(const std::vector< Real > &dvars, Real &obj, bool eval_obj_grad, std::vector< Real > &obj_grad, std::vector< Real > &fvals, std::vector< bool > &eval_grads, std::vector< Real > &grads)=0
grads(k): Derivative of f_i(x) with respect to x_j, where k = (j-1)*M + i.
unsigned int n_ineq() const
virtual ~FunctionEvaluation()
void set_output_file(const std::string &nm)
sets the output file and the function evaluation will write the optimization iterates to this file...
virtual void _evaluate_wrapper(const std::vector< Real > &dvars, Real &obj, bool eval_obj_grad, std::vector< Real > &obj_grad, std::vector< Real > &fvals, std::vector< bool > &eval_grads, std::vector< Real > &grads)
This serves as a wrapper around evaluate() and makes sure that the derived class's implementation is ...
void attach_optimization_interface(MAST::OptimizationInterface &opt)
unsigned int _n_rel_change_iters
Provides the basic interface API for classes the provide implement optimization problems.
unsigned int n_vars() const
void initialize_dv_from_output_file(const std::string &nm, const unsigned int iter, std::vector< Real > &x)
This reads and initializes the DV vector from a previous optimization history output file...
virtual void _output_wrapper(unsigned int iter, const std::vector< Real > &x, Real obj, const std::vector< Real > &fval, bool if_write_to_optim_file)
This serves as a wrapper around evaluate() and makes sure that the derived class's implementation is ...
virtual void _init_dvar_wrapper(std::vector< Real > &x, std::vector< Real > &xmin, std::vector< Real > &xmax)
This serves as a wrapper around init_dvar() and makes sure that the derived class's implementation pr...
unsigned int n_eq() const
unsigned int n_iters_relative_change() const
virtual bool verify_gradients(const std::vector< Real > &dvars)
verifies the gradients at the specified design point