TPCCLIB
Loading...
Searching...
No Matches
tpcnlopt.h
Go to the documentation of this file.
1
6#ifndef _TPCNLOPT_H_
7#define _TPCNLOPT_H_
8/*****************************************************************************/
9
10/*****************************************************************************/
11#include "tpcclibConfig.h"
12/*****************************************************************************/
13#include <stdio.h>
14#include <stdlib.h>
15#include <string.h>
16#include <math.h>
17/*****************************************************************************/
18#include "tpcextensions.h"
19#include "tpcrand.h"
20/*****************************************************************************/
21
22/*****************************************************************************/
25typedef struct NLOPT {
27 unsigned int totalNr;
29 double *xfull;
31 double *xlower;
33 double *xupper;
36 double *xdelta;
39 double *xtol;
42 double (*_fun)(int, double*, void*);
44 void *fundata;
46 unsigned int maxFunCalls;
48 unsigned int funCalls;
50 double funval;
52 unsigned int usePList;
56 double *plist;
57} NLOPT;
58/*****************************************************************************/
59
60/*****************************************************************************/
65typedef struct NLOPT_DATA {
67 unsigned int n;
69 double *x;
71 double *y;
73 double *w;
75 double *sy;
79 FILE *fp;
81/*****************************************************************************/
82
83/*****************************************************************************/
84/* nlopt */
85extern void nloptInit(NLOPT *nlo);
86extern void nloptFree(NLOPT *nlo);
87extern int nloptAllocate(NLOPT *nlo, unsigned int parNr);
88extern int nloptDuplicate(NLOPT *nlo1, NLOPT *nlo2);
89extern int nloptAddP(NLOPT *nlo, double *p, double funval);
90extern int nloptSortP(NLOPT *nlo);
91extern int nloptMeanP(NLOPT *nlo, unsigned int nr, double *meanp, double *sdp);
92extern void nloptPrintP(NLOPT *nlo, unsigned int nr, FILE *fp);
93extern void nloptWrite(NLOPT *d, FILE *fp);
94extern unsigned int nloptLimitFixedNr(NLOPT *d);
95extern unsigned int nloptFixedNr(NLOPT *d);
96extern void nloptRemoveEmpties(NLOPT *d);
97extern void nloptdataInit(NLOPT_DATA *d);
98/*****************************************************************************/
99
100/*****************************************************************************/
101/* rndpoint */
102extern int nloptRandomPoint(double *p, double *low, double *up, unsigned int n, MERTWI *mt);
103extern int nloptGaussianPoint(
104 double *p, double *mean, double *sd, double *low, double *up, unsigned int n, MERTWI *mt
105);
106/*****************************************************************************/
107
108/*****************************************************************************/
109/* constraints */
110extern unsigned int nloptCheckParameters(
111 unsigned int n, double *pLower, double *pUpper, double *p,
112 double *pAccept, double *penalty
113);
114extern unsigned int nloptForceLimits(unsigned int n, double *pLower, double *pUpper, double *p);
115/*****************************************************************************/
116
117/*****************************************************************************/
118/* nlopt1d */
119extern int nlopt1D(NLOPT *nlo, unsigned int maxIter, TPCSTATUS *);
120/*****************************************************************************/
121
122/*****************************************************************************/
123/* simplex */
124extern int nloptSimplex(NLOPT *nlo, unsigned int maxIter, TPCSTATUS *);
125extern int nloptSimplexARRS(NLOPT *nlo, unsigned int maxIter, TPCSTATUS *status);
126extern int nloptSimplexMS(NLOPT *nlo, unsigned int maxIter, TPCSTATUS *status);
127/*****************************************************************************/
128
129/*****************************************************************************/
130/* praxis */
131extern int nloptPowellBrent(NLOPT *nlo, unsigned int ktm, TPCSTATUS *);
132/*****************************************************************************/
133
134/*****************************************************************************/
135/* mpso */
136extern int nloptMPSO(
137 NLOPT *nlo, unsigned int maxIter, unsigned int nSwarms, unsigned int nParticles, double wInertia,
138 double wParticle, double wSwarm, double wGlobal, double pDeath, double pImmigration,
139 const int doLocal, TPCSTATUS *
140);
141/*****************************************************************************/
142
143/*****************************************************************************/
144/* tgo */
145extern int nloptITGO1(
146 NLOPT *nlo, const int doLocal, unsigned int tgoNr, unsigned int sampleNr,
147 unsigned int neighNr, TPCSTATUS *status
148);
149extern int nloptITGO2(
150 NLOPT *nlo, const int doLocal, unsigned int tgoNr, unsigned int sampleNr,
151 unsigned int neighNr, TPCSTATUS *status
152);
153extern int nloptIATGO(NLOPT *nlo, const int doLocal, unsigned int maxIterNr,
154 double neighFract, TPCSTATUS *status
155);
156/*****************************************************************************/
157
158/*****************************************************************************/
159#endif /* TPCNLOPT */
double * w
Definition tpcnlopt.h:73
double * y
Definition tpcnlopt.h:71
double * sy
Definition tpcnlopt.h:75
FILE * fp
Definition tpcnlopt.h:79
double * x
Definition tpcnlopt.h:69
unsigned int n
Definition tpcnlopt.h:67
int verbose
Definition tpcnlopt.h:77
double(* _fun)(int, double *, void *)
Definition tpcnlopt.h:42
double funval
Definition tpcnlopt.h:50
unsigned int maxFunCalls
Definition tpcnlopt.h:46
double * xupper
Definition tpcnlopt.h:33
double * xlower
Definition tpcnlopt.h:31
void * fundata
Definition tpcnlopt.h:44
double * xfull
Definition tpcnlopt.h:29
unsigned int funCalls
Definition tpcnlopt.h:48
double * xdelta
Definition tpcnlopt.h:36
unsigned int usePList
Definition tpcnlopt.h:52
double * xtol
Definition tpcnlopt.h:39
double * plist
Definition tpcnlopt.h:56
unsigned int totalNr
Definition tpcnlopt.h:27
Header file for library libtpcextensions.
int nloptSimplexMS(NLOPT *nlo, unsigned int maxIter, TPCSTATUS *status)
Definition simplex.c:624
int nloptRandomPoint(double *p, double *low, double *up, unsigned int n, MERTWI *mt)
Definition rndpoint.c:28
unsigned int nloptForceLimits(unsigned int n, double *pLower, double *pUpper, double *p)
Enforce the model parameters within given limits.
Definition constraints.c:76
int nloptPowellBrent(NLOPT *nlo, unsigned int ktm, TPCSTATUS *)
Powell-Brent (Praxis) non-linear unconstrained optimization.
Definition praxis.c:59
void nloptInit(NLOPT *nlo)
Definition nlopt.c:25
unsigned int nloptCheckParameters(unsigned int n, double *pLower, double *pUpper, double *p, double *pAccept, double *penalty)
Check that model parameters are within given limits.
Definition constraints.c:30
int nloptAllocate(NLOPT *nlo, unsigned int parNr)
Definition nlopt.c:74
int nloptIATGO(NLOPT *nlo, const int doLocal, unsigned int maxIterNr, double neighFract, TPCSTATUS *status)
Definition tgo.c:681
int nloptITGO1(NLOPT *nlo, const int doLocal, unsigned int tgoNr, unsigned int sampleNr, unsigned int neighNr, TPCSTATUS *status)
Definition tgo.c:59
unsigned int nloptLimitFixedNr(NLOPT *d)
Definition nlopt.c:333
int nloptMeanP(NLOPT *nlo, unsigned int nr, double *meanp, double *sdp)
Definition nlopt.c:219
int nlopt1D(NLOPT *nlo, unsigned int maxIter, TPCSTATUS *)
Definition nlopt1d.c:25
unsigned int nloptFixedNr(NLOPT *d)
Definition nlopt.c:354
int nloptMPSO(NLOPT *nlo, unsigned int maxIter, unsigned int nSwarms, unsigned int nParticles, double wInertia, double wParticle, double wSwarm, double wGlobal, double pDeath, double pImmigration, const int doLocal, TPCSTATUS *)
Definition mpso.c:129
void nloptRemoveEmpties(NLOPT *d)
Definition nlopt.c:398
void nloptPrintP(NLOPT *nlo, unsigned int nr, FILE *fp)
Definition nlopt.c:274
void nloptFree(NLOPT *nlo)
Definition nlopt.c:52
int nloptGaussianPoint(double *p, double *mean, double *sd, double *low, double *up, unsigned int n, MERTWI *mt)
Definition rndpoint.c:70
int nloptAddP(NLOPT *nlo, double *p, double funval)
Definition nlopt.c:149
void nloptdataInit(NLOPT_DATA *d)
Definition nlopt.c:423
int nloptITGO2(NLOPT *nlo, const int doLocal, unsigned int tgoNr, unsigned int sampleNr, unsigned int neighNr, TPCSTATUS *status)
Definition tgo.c:342
int nloptSimplex(NLOPT *nlo, unsigned int maxIter, TPCSTATUS *)
Definition simplex.c:32
int nloptSimplexARRS(NLOPT *nlo, unsigned int maxIter, TPCSTATUS *status)
Definition simplex.c:373
int nloptDuplicate(NLOPT *nlo1, NLOPT *nlo2)
Definition nlopt.c:112
void nloptWrite(NLOPT *d, FILE *fp)
Definition nlopt.c:302
int nloptSortP(NLOPT *nlo)
Definition nlopt.c:182
Header file for libtpcrand.