-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbacktrackinglinesearch.h
More file actions
51 lines (40 loc) · 1.92 KB
/
backtrackinglinesearch.h
File metadata and controls
51 lines (40 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef BACKTRACKINGLINESEARCH_H
#define BACKTRACKINGLINESEARCH_H
#include <limits>
#include <vector>
#include "optimizer.h"
using namespace std;
typedef enum {NO_WOLFE_CONDITION,WOLFE_CONDITION} Condition_Type;
class backtrackingLineSearch: public optimizer
{
// Algorithm Parameters
double alpha; // step size
double alpha_dec; // decrease factor of the step size
double alpha_inc; // increase factor of the step size
double beta_max=numeric_limits<double>::max(); // the inf value for the max stepsize
double wolfe_para; // the wolfe parameter for the wolfe condition(s)
double tol; // the tolerance for the value stepsize change
// The optimization variable
vector<double> x; // the optimization variable(s) in a vector form
Condition_Type type; // include wolfe condition or not
public:
// Constructors
backtrackingLineSearch(vector<double> x);
backtrackingLineSearch(vector<double> x,\
double alpha,\
double alpha_dec,\
double alpha_inc,\
double wolfe_para,\
double tol,\
Condition_Type type,
double (&f)(vector<double>),
vector<double> (&df)(vector<double>),
int verbose,
string logFileName);
vector<double> optimize();
double (*f)(vector<double>);
vector<double> (*df)(vector<double>);
// setters functions
void set_x0(vector<double> x0);
};
#endif // BACKTRACKINGLINESEARCH_H