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

Public Member Functions

 State (int n, const Scalar_x *x0, Scalar_fx fx0)
 
void step (std::vector< Scalar_x > &y, Scalar_fx y_cost)
 

Public Attributes

std::vector< Scalar_x > x
 
std::vector< Scalar_x > best_x
 
Scalar_fx cost
 
Scalar_fx best_cost
 

Constructor & Destructor Documentation

◆ State()

template<typename Scalar_x, typename Scalar_fx>
CSA::State< Scalar_x, Scalar_fx >::State ( int  n,
const Scalar_x *  x0,
Scalar_fx  fx0 
)
inline

Contruct a state from an initial solution.

Parameters
nThe dimension of x0.
x0The initial solution guess.
fx0The value of the cost function associated with x0.

Member Function Documentation

◆ step()

template<typename Scalar_x, typename Scalar_fx>
void CSA::State< Scalar_x, Scalar_fx >::step ( std::vector< Scalar_x > &  y,
Scalar_fx  y_cost 
)
inline

Move the current solution to y. Internally, this just swaps the pointers of x and y.

Parameters
yThe new solution.
y_costThe value of the cost function associated with y.

Member Data Documentation

◆ best_cost

template<typename Scalar_x, typename Scalar_fx>
Scalar_fx CSA::State< Scalar_x, Scalar_fx >::best_cost

The cost associated with best_x.

◆ best_x

template<typename Scalar_x, typename Scalar_fx>
std::vector<Scalar_x> CSA::State< Scalar_x, Scalar_fx >::best_x

The solution with the best cost so far.

◆ cost

template<typename Scalar_x, typename Scalar_fx>
Scalar_fx CSA::State< Scalar_x, Scalar_fx >::cost

The current cost at x.

◆ x

template<typename Scalar_x, typename Scalar_fx>
std::vector<Scalar_x> CSA::State< Scalar_x, Scalar_fx >::x

The current solution.


The documentation for this class was generated from the following file: