|
TPCCLIB
|
Non-linear optimization. More...
#include "tpcclibConfig.h"#include <stdio.h>#include <stdlib.h>#include <math.h>#include <time.h>#include <string.h>#include "tpcextensions.h"#include "tpcrand.h"#include "tpcnlopt.h"Go to the source code of this file.
Functions | |
| void | nloptInit (NLOPT *nlo) |
| void | nloptFree (NLOPT *nlo) |
| int | nloptAllocate (NLOPT *nlo, unsigned int parNr) |
| int | nloptDuplicate (NLOPT *nlo1, NLOPT *nlo2) |
| int | nloptAddP (NLOPT *nlo, double *p, double funval) |
| int | nloptSortP (NLOPT *nlo) |
| int | nloptMeanP (NLOPT *nlo, unsigned int nr, double *meanp, double *sdp) |
| void | nloptPrintP (NLOPT *nlo, unsigned int nr, FILE *fp) |
| void | nloptWrite (NLOPT *d, FILE *fp) |
| unsigned int | nloptLimitFixedNr (NLOPT *d) |
| unsigned int | nloptFixedNr (NLOPT *d) |
| void | nloptRemoveEmpties (NLOPT *d) |
| void | nloptdataInit (NLOPT_DATA *d) |
| int nloptAddP | ( | NLOPT * | nlo, |
| double * | p, | ||
| double | funval ) |
Add parameters and value in NLOPT plist.
Parameters are added starting at index plist[(funCalls-1)*(totalNr+1)], and function value at index plist[(funCalls-1)*(totalNr+1)+totalNr], after plist[] size is increased by (totalNr+1).
| nlo | Pointer to initiated NLOPT structure; any old contents are deleted. |
| p | Pointer to parameter array of length nlo->totalNr. |
| funval | Value of objective function. |
Definition at line 149 of file nlopt.c.
Referenced by nlopt1D(), nloptIATGO(), and nloptSimplex().
| int nloptAllocate | ( | NLOPT * | nlo, |
| unsigned int | parNr ) |
Allocate memory for NLOPT data. Any previous contents are deleted.
| nlo | Pointer to initiated NLOPT structure; any old contents are deleted. |
| parNr | Nr of parameters. |
Definition at line 74 of file nlopt.c.
Referenced by nloptDuplicate().
| void nloptdataInit | ( | NLOPT_DATA * | d | ) |
Initiate the NLOPT_DATA structure before any use.
| d | Pointer to NLOPT_DATA. |
Make a duplicate of NLOPT data.
NLOPT plist is not copied but usePList parameter is copied.
| nlo1 | Pointer to existing NLOPT structure to be duplicated. |
| nlo2 | Pointer to the target NLOPT; must be initiated; any old contents are deleted. |
Definition at line 112 of file nlopt.c.
Referenced by nloptITGO1(), and nloptITGO2().
| unsigned int nloptFixedNr | ( | NLOPT * | d | ) |
Determine the number of fixed parameters, based on constraints or delta.
| d | Pointer to NLOPT |
Definition at line 354 of file nlopt.c.
Referenced by nlopt1D(), and nloptSimplex().
| void nloptFree | ( | NLOPT * | nlo | ) |
Free memory allocated for NLOPT data. All contents are destroyed.
| nlo | Pointer to initiated NLOPT structure. |
Definition at line 52 of file nlopt.c.
Referenced by nloptAddP(), nloptAllocate(), nloptDuplicate(), nloptITGO1(), and nloptITGO2().
| void nloptInit | ( | NLOPT * | nlo | ) |
Initiate the NLOPT structure before any use.
| nlo | Pointer to NLOPT |
Definition at line 25 of file nlopt.c.
Referenced by nloptFree(), nloptITGO1(), and nloptITGO2().
| unsigned int nloptLimitFixedNr | ( | NLOPT * | d | ) |
Determine the number of fixed parameters, based on constraints.
| d | Pointer to NLOPT. |
Definition at line 333 of file nlopt.c.
Referenced by nloptIATGO(), nloptITGO1(), nloptITGO2(), nloptMPSO(), nloptSimplexARRS(), and nloptSimplexMS().
| int nloptMeanP | ( | NLOPT * | nlo, |
| unsigned int | nr, | ||
| double * | meanp, | ||
| double * | sdp ) |
Calculate mean point from NLOPT plist.
Missing values are omitted from the mean.
Notice that if plist contains fixed parameters, their mean and SD may not be exactly correct because of limited accuracy of calculation with floating points; you may therefore need to set the mean to the limit and SD to zero afterwards.
| nlo | Pointer to NLOPT structure. |
| nr | Number of points to include; enter 0 to use all. |
| meanp | Pointer to array of size totalNr where mean point is saved. |
| sdp | Pointer to array of size totalNr where point SD is saved; enter NULL, if not needed. |
Definition at line 219 of file nlopt.c.
Referenced by nloptIATGO(), and nloptSimplexARRS().
| void nloptPrintP | ( | NLOPT * | nlo, |
| unsigned int | nr, | ||
| FILE * | fp ) |
Print the contents of NLOPT plist.
| nlo | Pointer to NLOPT structure. |
| nr | Number of points to print; enter 0 or a large number to print all. |
| fp | File pointer for the output. |
Definition at line 274 of file nlopt.c.
Referenced by nloptIATGO(), and nloptSimplexARRS().
| void nloptRemoveEmpties | ( | NLOPT * | d | ) |
Remove any empty parameters from NLOPT structure.
Parameters which have NaN in place of xfull[] or xdelta[] are removed from the list; if found, totalNr is reduced accordingly.
Definition at line 398 of file nlopt.c.
| int nloptSortP | ( | NLOPT * | nlo | ) |
Sort NLOPT plist into the order of increasing function values.
The first 'funCalls' items in plist are sorted.
| nlo | Pointer to NLOPT structure. |
Definition at line 182 of file nlopt.c.
Referenced by nloptIATGO(), and nloptSimplexARRS().
| void nloptWrite | ( | NLOPT * | d, |
| FILE * | fp ) |
Write the contents of NLOPT structure to the specified file pointer.
| d | Pointer to NLOPT |
| fp | Output file pointer |
Definition at line 302 of file nlopt.c.