/
bioCfsqp.h
119 lines (103 loc) · 2.59 KB
/
bioCfsqp.h
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
//-*-c++-*------------------------------------------------------------
//
// File name : bioCfsqp.h
// Author : Michel Bierlaire
// Date : Tue Aug 13 08:59:34 2019
//
//--------------------------------------------------------------------
#ifndef bioCfsqp_h
#define bioCfsqp_h
/**
This class defines a C++ interface to the cfsqp routine, by Lawrence, Zhou and Tits (1998).
*/
#include "biogeme.h"
#include <iostream>
#define DEBUG_MESSAGE(message) {std::cout << message << std::endl ;}
#define GENERAL_MESSAGE(message) {std::cout << message << std::endl ;}
#define DETAILED_MESSAGE(message) {std::cout << message << std::endl ;}
#define WARNING(message) {std::cout << message << std::endl ;}
#define FATAL(message) {std::cout << message << std::endl ;}
class bioCfsqp {
public:
/**
*/
bioCfsqp(biogeme* bio) ;
/**
*/
virtual ~bioCfsqp() ;
/**
*/
void defineStartingPoint(const std::vector<bioReal>& x0) ;
/**
*/
std::vector<bioReal> getStartingPoint() ;
/**
*/
std::vector<bioReal> getSolution() ;
/**
*/
bioReal getValueSolution() ;
/**
*/
std::vector<bioReal> getLowerBoundsLambda() ;
/**
*/
std::vector<bioReal> getUpperBoundsLambda() ;
/**
@return Diagnostic from cfsqp
*/
bioString run() ;
/**
@return number of iterations. If there is any error, 0 is returned.
*/
bioUInt nbrIter() ;
void setParameters(int _mode,
int _iprint,
int _miter,
bioReal _eps,
bioReal _epseqn,
bioReal _udelta) ;
private:
std::vector<bioReal> startingPoint ;
std::vector<bioReal> solution ;
std::vector<bioReal> lowerBoundsLambda ;
std::vector<bioReal> upperBoundsLambda ;
std::vector<bioReal> lowerBounds ;
std::vector<bioReal> upperBounds ;
std::vector<bioReal> fixedBetas ;
biogeme* theBiogeme ;
int mode;
int iprint;
int miter;
bioReal eps;
bioReal epseqn;
bioReal udelta ;
int nIter ;
};
/**
User functions required by cfsqp. See User's guide.
*/
void obj(int nparam, int j, bioReal* x, bioReal* fj, void* cd) ;
/**
User functions required by cfsqp. See User's guide.
*/
void constr(int nparam,int j,bioReal* x, bioReal* gj, void* cd) ;
/**
User functions required by cfsqp. See User's guide.
*/
void gradob(int nparam,
int j,
bioReal* x,
bioReal* gradfj,
void (* dummy)(int, int, bioReal *, bioReal *, void *),
void* cd) ;
/**
User functions required by cfsqp. See User's guide.
*/
void gradcn(int nparam,
int j,
bioReal* x,
bioReal* gradgj,
void (* dummy)(int, int, bioReal *, bioReal *, void *),
void* cd) ;
#endif