CSA
CSA::Solver< Scalar_x, Scalar_fx > Class Template Reference

Public Member Functions

 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)
 

Public Attributes

int m = 4
 
int max_iterations = 1000000
 
float tgen_initial = 0.01
 
float tgen_schedule = 0.99999
 
float tacc_initial = 0.9
 
float tacc_schedule = 0.01
 
float desired_variance = 0.99
 

Constructor & Destructor Documentation

◆ Solver()

template<typename Scalar_x , typename Scalar_fx >
CSA::Solver< Scalar_x, Scalar_fx >::Solver ( )
inline

Default constructor.

Member Function Documentation

◆ 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
nThe size of the input array x.
xThe input array, representing an initial guess of the solution. This array will be modified with the best solution found.
fxThe function to minimize. The first argument to the function is a pointer (possibly NULL) to the callback object instance.
stepThe 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.
progressAn 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.
instanceAn 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.

Member Data Documentation

◆ 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.

◆ m

template<typename Scalar_x , typename Scalar_fx >
int CSA::Solver< Scalar_x, Scalar_fx >::m = 4

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: