ElfPSP_ParallelABC
Protein Structure Prediction using Parallel Artificial Bee Colony Optimization
|
Routines for manipulating Solution objects, such as creation, randomization, perturbation etc. More...
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <fitness/fitness.h>
#include <movelem.h>
#include <random.h>
#include "solution_structure_private.h"
Go to the source code of this file.
Macros | |
#define | FITNESS_MIN -1E9 |
#define | SOLUTION_INLINE inline |
Typedefs | |
typedef struct Solution_ | Solution |
Functions | |
SOLUTION_INLINE Solution | Solution_blank (int hpSize) |
Returns a Solution whose fields are all uninitialized, but with due memory allocated. More... | |
SOLUTION_INLINE Solution | Solution_copy (Solution sol, int hpSize) |
Returns a deep copy (all memory recursively duplicated) of the given solution. More... | |
SOLUTION_INLINE void | Solution_free (Solution sol) |
Frees memory allocated for given solution. | |
SOLUTION_INLINE Solution | Solution_random (int hpSize) |
Returns a Solution whose movement chain is uniformly random. More... | |
SOLUTION_INLINE Solution | Solution_perturb_relative (Solution perturb, Solution other, int hpSize) |
Chooses a random element ELEM1 in 'perturb'. More... | |
SOLUTION_INLINE double | Solution_fitness (Solution sol) |
Returns the fitness of the given solution, calculating it only if needed. More... | |
SOLUTION_INLINE void | Solution_set_fitness (Solution *sol, double fitness) |
Sets the fitness of a solution. | |
SOLUTION_INLINE int | Solution_idle_iterations (Solution sol) |
Returns the number of iterations through which the solution didn't improve. More... | |
SOLUTION_INLINE void | Solution_inc_idle_iterations (Solution *sol) |
Increments the number of idle solutions of the given solution. More... | |
SOLUTION_INLINE const MovElem * | Solution_chain (Solution sol) |
Returns the MovChain of the given solution. More... | |
Routines for manipulating Solution objects, such as creation, randomization, perturbation etc.
SOLUTION_INLINE Solution Solution_blank | ( | int | hpSize | ) |
Returns a Solution whose fields are all uninitialized, but with due memory allocated.
Returns the MovChain of the given solution.
Returns a deep copy (all memory recursively duplicated) of the given solution.
SOLUTION_INLINE double Solution_fitness | ( | Solution | sol | ) |
Returns the fitness of the given solution, calculating it only if needed.
sol
. SOLUTION_INLINE int Solution_idle_iterations | ( | Solution | sol | ) |
Returns the number of iterations through which the solution didn't improve.
sol
. SOLUTION_INLINE void Solution_inc_idle_iterations | ( | Solution * | sol | ) |
Increments the number of idle solutions of the given solution.
Chooses a random element ELEM1 in 'perturb'.
Then chooses a random element ELEM2 in 'other'. Takes the distance DIST between ELEM1 and ELEM2 Changes 'perturb' so that its ELEM1 approaches ELEM2 by a random amount, from 0 to 100%. The solution 'perturb' is returned.
The returned Solution has its idle_iterations set to 0. The returned Solution won't have its fitness calculated.
SOLUTION_INLINE Solution Solution_random | ( | int | hpSize | ) |
Returns a Solution whose movement chain is uniformly random.
The returned Solution has its idle_iterations set to 0. The returned Solution won't have its fitness calculated.