ElfPSP_ParallelABC
Protein Structure Prediction using Parallel Artificial Bee Colony Optimization
Functions
hive.h File Reference

Routines for manipulating the bee hive global object. More...

#include <solution/solution.h>

Go to the source code of this file.

Functions

void HIVE_initialize ()
 Initializes the global HIVE object. More...
 
void HIVE_destroy ()
 Frees memory allocated in HIVE. More...
 
int HIVE_nSols ()
 Returns the number of solutions in the hive. More...
 
int HIVE_cycle ()
 Returns the number of cycles elapsed within the hive. More...
 
SolutionHIVE_solutions ()
 Returns the vector of solutions within the hive. More...
 
Solution HIVE_solution (int idx)
 Returns a specific solution. More...
 
Solution HIVE_best_sol ()
 Returns a pointer to the best solution found so far in the hive. More...
 
int HIVE_hp_size ()
 Returns the size of the protein being predicted. More...
 
void HIVE_nullify_best ()
 Nullifies the best solution, without freeing it. More...
 
void HIVE_increment_cycle ()
 Tells the HIVE to increment one cycle in the cycle counter.
 
void HIVE_add_solution (Solution sol, int index, int hpSize)
 Adds solution 'sol' as the index-th solution of the HIVE. More...
 
void HIVE_increment_idle (int index)
 Increments the idle_iterations of the solution desired. More...
 
Solution HIVE_perturb_solution (int index, int hpSize)
 Causes a minor variation in the solution at given index. More...
 
void HIVE_try_replace_solution (Solution alt, int index, int hpSize)
 The current Solution with index 'index' is SOL1. More...
 
void HIVE_force_replace_solution (Solution alt, int index)
 Replaces solution at index 'index', unconditionally. More...
 
void HIVE_replace_best (Solution newBest)
 Replaces the best solution with the given solution. More...
 

Detailed Description

Routines for manipulating the bee hive global object.

Function Documentation

◆ HIVE_add_solution()

void HIVE_add_solution ( Solution  sol,
int  index,
int  hpSize 
)

Adds solution 'sol' as the index-th solution of the HIVE.

No deep copy is made.

Also checks the fitness of 'sol' and replaces the best solution in the HIVE if needed This procedure does not free the current solution in that spot.

◆ HIVE_best_sol()

Solution HIVE_best_sol ( )

Returns a pointer to the best solution found so far in the hive.

◆ HIVE_cycle()

int HIVE_cycle ( )

Returns the number of cycles elapsed within the hive.

◆ HIVE_destroy()

void HIVE_destroy ( )

Frees memory allocated in HIVE.

Does not free the best solution

◆ HIVE_force_replace_solution()

void HIVE_force_replace_solution ( Solution  alt,
int  index 
)

Replaces solution at index 'index', unconditionally.

Does not check if 'alt' is the new best solution of the hive.

◆ HIVE_hp_size()

int HIVE_hp_size ( )

Returns the size of the protein being predicted.

◆ HIVE_increment_idle()

void HIVE_increment_idle ( int  index)

Increments the idle_iterations of the solution desired.

◆ HIVE_initialize()

void HIVE_initialize ( )

Initializes the global HIVE object.

◆ HIVE_nSols()

int HIVE_nSols ( )

Returns the number of solutions in the hive.

◆ HIVE_nullify_best()

void HIVE_nullify_best ( )

Nullifies the best solution, without freeing it.

◆ HIVE_perturb_solution()

Solution HIVE_perturb_solution ( int  index,
int  hpSize 
)

Causes a minor variation in the solution at given index.

The Solution with index 'index' is SOL1, we take a random SOL2 and a random spot SPOT in the Solutions' movement chain. SOL1's movement at spot SPOT is made to approach the value in SOL2's movement at the same spot.

◆ HIVE_replace_best()

void HIVE_replace_best ( Solution  newBest)

Replaces the best solution with the given solution.

A deep copy is not made, so modifying 'newBest' after calling this function is unsafe.

◆ HIVE_solution()

Solution HIVE_solution ( int  idx)

Returns a specific solution.

◆ HIVE_solutions()

Solution* HIVE_solutions ( )

Returns the vector of solutions within the hive.

◆ HIVE_try_replace_solution()

void HIVE_try_replace_solution ( Solution  alt,
int  index,
int  hpSize 
)

The current Solution with index 'index' is SOL1.

Checks if 'alt' has a better fitness, and if that is so, replaces SOL1 with 'alt'. If 'alt' is worse, this function frees it, so manipulating 'alt' later is unsafe, and the idle interations of SOL1 is increased. Checks if 'alt' is the new best solution of the hive.