1 #ifndef ITERATIVE_SOLVER_H 2 #define ITERATIVE_SOLVER_H 5 #include <blitz/array.h> 6 #include <boost/shared_ptr.hpp> 97 {
return Accepted_points.size()-1; }
134 {
return Accepted_points; }
158 {
return Cost_at_accepted_points; }
169 virtual void solve() = 0;
216 virtual const char *
const status_str()
const;
223 virtual void print(std::ostream& Os)
const 224 { Os <<
"IterativeSolver"; }
248 Accepted_points.push_back(point);
270 { Cost_at_accepted_points.push_back(cost); }
275 std::vector< blitz::Array<double, 1> > Accepted_points;
276 std::vector< double > Cost_at_accepted_points;
virtual const char *const status_str() const
Returns the string version of the solver status.
solve method called but an error was encountered
virtual ~IterativeSolver()
void record_cost_at_accepted_point(double cost)
Called to record the cost function value at an accepted point.
solve method called and a solution found
solve method was called but stalled
status_t
Enum type for the status of the iterative solver.
void add_observer_do(Observer< IterativeSolver > &Obs, IterativeSolver &t)
Add an observer.
virtual void solve()=0
The method that solves the optimization problem.
virtual int num_accepted_steps() const
Returns the number of the accepted steps.
void remove_observer_do(Observer< IterativeSolver > &Obs, IterativeSolver &t)
Remove an observer.
This is a Mixin for classes that can be printed.
void notify_update_do(const IterativeSolver &Self)
Function to call to notify Observers of a state change.
virtual void remove_observer(Observer< IterativeSolver > &Obs)
Remove an observer.
solve method called but did not converge to a solution
solve method not called yet
Mixin for a class that allows other classes to observe it state.
virtual status_t status() const
Returns a value of IterativeSolver::status_t type.
void record_accepted_point(const blitz::Array< double, 1 > &point)
Called to record an accepted point.
virtual std::vector< blitz::Array< double, 1 > > accepted_points() const
Returns a vector (std) of accepted points.
virtual std::vector< double > cost_at_accepted_points() const
Returns a vector (std) of cost function values at accepted points.
virtual void print(std::ostream &Os) const
Prints description of object.
Contains classes to abstract away details in various Spurr Radiative Transfer software.
IterativeSolver(int max_cost_function_calls, bool vrbs)
Constructor.
The base class for all iterative optimizers.
virtual void add_observer(Observer< IterativeSolver > &Obs)
Add an observer.