SDDSlib
|
Implementation of one-dimensional optimization functions. More...
#include "mdb.h"
Go to the source code of this file.
Macros | |
#define | DEFAULT_MAXEVALS 100 |
#define | DEFAULT_MAXPASSES 5 |
Functions | |
long | checkVariableLimits (double *x, double *xlo, double *xhi, long n) |
long | OneDScanOptimize (double *yReturn, double *xGuess, double *dxGuess, double *xLowerLimit, double *xUpperLimit, short *disable, long dimensions, double target, double tolerance, double(*func)(double *x, long *invalid), void(*report)(double ymin, double *xmin, long pass, long evals, long dims), long maxSteps, long maxDivisions, long maxRepeats, unsigned long flags) |
Performs one-dimensional scan optimization on a multi-dimensional function. | |
long | OneDParabolicOptimization (double *yReturn, double *xGuess, double dx, double xLower, double xUpper, double(*func)(double x, long *invalid), long maxCycles, double dxLimit, double tolerance, long maximize) |
Optimizes a single-variable function using parabolic interpolation. | |
Implementation of one-dimensional optimization functions.
Definition in file onedoptimize.c.
#define DEFAULT_MAXEVALS 100 |
Definition at line 17 of file onedoptimize.c.
#define DEFAULT_MAXPASSES 5 |
Definition at line 18 of file onedoptimize.c.
long checkVariableLimits | ( | double * | x, |
double * | xlo, | ||
double * | xhi, | ||
long | n ) |
long OneDParabolicOptimization | ( | double * | yReturn, |
double * | xGuess, | ||
double | dx, | ||
double | xLower, | ||
double | xUpper, | ||
double(* | func )(double x, long *invalid), | ||
long | maxCycles, | ||
double | dxLimit, | ||
double | tolerance, | ||
long | maximize ) |
Optimizes a single-variable function using parabolic interpolation.
This function performs optimization (minimization or maximization) of a single-variable function using parabolic interpolation. It iteratively adjusts the variable to find the function's minimum or maximum by fitting a parabola to three points and locating its vertex. The optimization continues until convergence criteria based on step size or function value tolerance are met, or until the maximum number of cycles is reached.
yReturn | Pointer to store the optimized function value. |
xGuess | Initial guess for the variable. |
dx | Initial step size for searching. |
xLower | The lower bound for the variable. |
xUpper | The upper bound for the variable. |
func | Pointer to the function to be optimized. It takes the variable and a pointer to an invalid flag. |
maxCycles | The maximum number of optimization cycles to perform. |
dxLimit | The minimum step size below which the optimization will stop. |
tolerance | The tolerance for convergence based on the difference in function values. |
maximize | If non-zero, the function will perform maximization instead of minimization. |
Definition at line 299 of file onedoptimize.c.
long OneDScanOptimize | ( | double * | yReturn, |
double * | xGuess, | ||
double * | dxGuess, | ||
double * | xLowerLimit, | ||
double * | xUpperLimit, | ||
short * | disable, | ||
long | dimensions, | ||
double | target, | ||
double | tolerance, | ||
double(* | func )(double *x, long *invalid), | ||
void(* | report )(double ymin, double *xmin, long pass, long evals, long dims), | ||
long | maxSteps, | ||
long | maxDivisions, | ||
long | maxRepeats, | ||
unsigned long | flags ) |
Performs one-dimensional scan optimization on a multi-dimensional function.
This function optimizes a given multi-dimensional function by performing a one-dimensional scan along each active dimension. It iteratively adjusts each variable within its specified limits to minimize the target function value. The optimization process continues until the target is achieved, the tolerance is met, or the maximum number of repeats is reached.
yReturn | Pointer to store the optimized function value. |
xGuess | Initial guess for the variables. |
dxGuess | Initial step sizes for each variable. |
xLowerLimit | Pointer to the array of lower limits for each variable. |
xUpperLimit | Pointer to the array of upper limits for each variable. |
disable | Pointer to an array indicating which dimensions to disable (1 to disable, 0 to enable). |
dimensions | The number of dimensions (variables) in the optimization. |
target | The target function value to achieve. Optimization stops if any value is <= this. |
tolerance | The tolerance for convergence. If <0, it is treated as fractional; if >0, as absolute. |
func | Pointer to the function to be optimized. It takes the variables array and a pointer to an invalid flag. |
report | Pointer to a reporting function that is called with the current minimum, variables, pass number, evaluations, and dimensions. |
maxSteps | The maximum number of steps to try in a good direction for each scan. |
maxDivisions | The maximum number of divisions (direction changes) allowed during scanning. |
maxRepeats | The maximum number of optimization passes to perform. |
flags | Optimization flags that modify the behavior of the optimization process. |
Definition at line 48 of file onedoptimize.c.