Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] View of /trunk/paramin-beta/armijo.h
[mareframe] / trunk / paramin-beta / armijo.h Repository:
ViewVC logotype

View of /trunk/paramin-beta/armijo.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (download) (annotate)
Mon Feb 10 17:09:07 2014 UTC (10 years, 3 months ago) by agomez
File size: 2541 byte(s)
Initial version based on Gadget 2.2.00
#ifndef armijo_h
#define armijo_h

#include "linesearch.h"

/**
 * \class Armijo
 * \brief This class performs a linestearch along a given line without using derivatives. The method works as follows, a sequence of alpha_n = beta^n*s is generated and if f(x)-f(x+alpha_n*s) >= - sigma * alpha_n * grad(f,x)'*s otherwise the method continues
 */
class Armijo : public LineSearch {
public:
  /**
   * \brief This is the default Armijo constructor
   */
  Armijo();
  /**
   * \brief This is the default Armijo destructor
   */
  virtual ~Armijo();
  /**
   * \brief This function will return the best value for alpha obtained by the search
   * \return alpha
   */
  double getAlpha();
  /**
   * \brief Returns 1 if the Armijo condition is satisfied 0 otherwise
   * \param y is the functionvalue
   */
  int conditionSatisfied(double y);
  /**
   * \brief doArmijo does the Armijo linesearch
   * \param v1 is the inital starting point
   * \param fx is the f-value at v1
   * \param dery is the dot product of the gradient and search direction
   * \param h 
   * \param netI 
   * \param s is the starting alpha value
   */
  void doArmijo(const DoubleVector& v1, double fx, double dery, const DoubleVector& h, NetInterface* netI, double s);
  /**
   * \brief Prepares the linesearch by setting the first f-value as initalf (corresponds to alpha = 0)
   */
  void prepareNewLineSearch();
  /**
   * \brief Starts "number of available hosts" function evaluations 
   */
  void initiateAlphas();
  /**
   * \brief Keeps the nodes busy by sending the next alpha value
   */
  int setData();
  /**
   * \param s is the new value for sigma
   */
  void setSigma(double s);
  /**
   * \param b is the new value for beta
   */
  void setBeta(double b);
  /**
   * \brief Returns beta 
   */
  double getBeta();
  /**
   * \brief Returns n in alpha = beta^n * s
   */
  int getPower();
  /**
   * \brief Returns the number of function evaluations that has not been finished
   */
  int outstandingRequests();
  /**
   * \brief Computes the conditionfunction and supplies nodes new jobs 
   */
  int computeConditionFunction();
private:
  /**
   * \brief Linesearch done from initialx
   */
  DoubleVector initialx;    
  /**
   * \brief The function value at initialx.
   */
  double initialf;    
  /**
   * \brief The derivative of g(alpha)=f(x + alpha * h).
   */
  double df;          
  DoubleVector hvec;
  double s;
  double sigma;
  NetInterface* net;
  Condition* cond;
  int numVar;
  double alpha;
  int power;
  double beta;
};

#endif

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge