|
| Solver () |
|
int | minimize (int n, Scalar_x *x, Scalar_fx(*fx)(void *, Scalar_x *), void(*step)(void *, Scalar_x *y, const Scalar_x *, float tgen), void(*progress)(void *, Scalar_fx cost, float tgen, float tacc, int opt_id, int iter), void *instance) |
|
◆ Solver()
template<typename Scalar_x , typename Scalar_fx >
◆ minimize()
template<typename Scalar_x , typename Scalar_fx >
int CSA::Solver< Scalar_x, Scalar_fx >::minimize |
( |
int |
n, |
|
|
Scalar_x * |
x, |
|
|
Scalar_fx(*)(void *, Scalar_x *) |
fx, |
|
|
void(*)(void *, Scalar_x *y, const Scalar_x *, float tgen) |
step, |
|
|
void(*)(void *, Scalar_fx cost, float tgen, float tacc, int opt_id, int iter) |
progress, |
|
|
void * |
instance |
|
) |
| |
|
inline |
Run the CSA process to minimize the target function.
- Parameters
-
n | The size of the input array x . |
x | The input array, representing an initial guess of the solution. This array will be modified with the best solution found. |
fx | The function to minimize. The first argument to the function is a pointer (possibly NULL) to the callback object instance . |
step | The step function. Should populate the array y with a a random step based on the current position x and the generation schedule tgen . Like fx the first argument to the function should be a pointer to the callback object instance . |
progress | An optional function that receives updates when a new best solution is found. Like fx and step , the first argument is a pointer to the callback object instance . The next arguments, in order, are the current cost, the current generation temperature, the current acceptance temperature, the thread ID, and the iteration number. |
instance | An optional pointer to a callback object. |
- Warning
- By default, the iterations of the main loop are not processed monotonically by the threads, so the
iter
parameter that the progress
function receives will appear to be random. This behavior can be changed by setting the macro CSA_ITER_MONO to a non-zero value. However, this may result in a significant slow-down.
◆ desired_variance
template<typename Scalar_x , typename Scalar_fx >
float CSA::Solver< Scalar_x, Scalar_fx >::desired_variance = 0.99 |
The desired variance of the acceptance probabilities.
template<typename Scalar_x , typename Scalar_fx >
The number of threads and coupled annealing processes.
◆ max_iterations
template<typename Scalar_x , typename Scalar_fx >
int CSA::Solver< Scalar_x, Scalar_fx >::max_iterations = 1000000 |
The maximum number of iterations/steps.
◆ tacc_initial
template<typename Scalar_x , typename Scalar_fx >
float CSA::Solver< Scalar_x, Scalar_fx >::tacc_initial = 0.9 |
The initial value of the acceptance temperature.
◆ tacc_schedule
template<typename Scalar_x , typename Scalar_fx >
float CSA::Solver< Scalar_x, Scalar_fx >::tacc_schedule = 0.01 |
Determines the factor by which tacc
is increased or decreased during each update.
◆ tgen_initial
template<typename Scalar_x , typename Scalar_fx >
float CSA::Solver< Scalar_x, Scalar_fx >::tgen_initial = 0.01 |
The initial value of the generation temperature.
◆ tgen_schedule
template<typename Scalar_x , typename Scalar_fx >
float CSA::Solver< Scalar_x, Scalar_fx >::tgen_schedule = 0.99999 |
Determines the factor that tgen
is multiplied by during each update.
The documentation for this class was generated from the following file: