SDDS ToolKit Programs and Libraries for C and Python
|
Definitions and implementations for non-dominated sorting and crowding distance routines used in multi-objective optimization.
This file provides the core functions for performing non-dominated sorting on a population of individuals, calculating crowding distances, and sorting the population based on dominance and crowding. It includes utility functions for managing linked lists used in the sorting process.
Definition in file non_dominated_sort.c.
#include "mdb.h"
#include "non_dominated_sort.h"
Go to the source code of this file.
Functions | |
void | insert_node (list *node, long x) |
list * | del_node (list *node) |
long | check_dominance (individual *a, individual *b, long nobj) |
void | assign_crowding_distance_list (population *pop, list *lst, long front_size, long start_i, int64_t *sorted_index) |
void | assign_crowding_distance_indices (population *pop, long c1, long c2, long nobj) |
void | quicksort_front_obj (population *pop, long objcount, long obj_array[], long obj_array_size) |
void | q_sort_front_obj (population *pop, long objcount, long obj_array[], long left, long right) |
void | quicksort_dist (population *pop, long *dist, long front_size) |
void | q_sort_dist (population *pop, long *dist, long left, long right) |
void | assign_crowding_distance (population *pop, long *dist, long **obj_array, long front_size, long nobj) |
int64_t * | non_dominated_sort (population *new_pop) |
Performs non-dominated sorting on a population and assigns ranks and crowding distances. | |
void | fill_population (population *pop, long rows, long columns, double **columnValue, long *maximize, double *const_violation) |
Initializes and fills the population structure with individuals and their objective values. | |
void | free_pop_mem (population *pop) |
Frees all dynamically allocated memory associated with a population. | |
void assign_crowding_distance | ( | population * | pop, |
long * | dist, | ||
long ** | obj_array, | ||
long | front_size, | ||
long | nobj ) |
Definition at line 238 of file non_dominated_sort.c.
void assign_crowding_distance_indices | ( | population * | pop, |
long | c1, | ||
long | c2, | ||
long | nobj ) |
Definition at line 133 of file non_dominated_sort.c.
void assign_crowding_distance_list | ( | population * | pop, |
list * | lst, | ||
long | front_size, | ||
long | start_i, | ||
int64_t * | sorted_index ) |
Definition at line 96 of file non_dominated_sort.c.
long check_dominance | ( | individual * | a, |
individual * | b, | ||
long | nobj ) |
Definition at line 60 of file non_dominated_sort.c.
list * del_node | ( | list * | node | ) |
Definition at line 41 of file non_dominated_sort.c.
void fill_population | ( | population * | pop, |
long | rows, | ||
long | columns, | ||
double ** | columnValue, | ||
long * | maximize, | ||
double * | const_violation ) |
Initializes and fills the population structure with individuals and their objective values.
This function allocates memory for the population's individuals, sets up their objective values based on the provided column values, and initializes constraint violations if provided.
pop | Pointer to the population structure to be filled. |
rows | The number of individuals in the population. |
columns | The number of objective functions. |
columnValue | 2D array containing the objective values for each individual and objective. |
maximize | Array indicating which objectives should be maximized (non-zero value) or minimized. |
const_violation | Array containing constraint violation values for each individual, or NULL if no constraints. |
Definition at line 370 of file non_dominated_sort.c.
void free_pop_mem | ( | population * | pop | ) |
Frees all dynamically allocated memory associated with a population.
This function deallocates memory for all individuals in the population, including their objective values, binary variables, constraints, genes, and other dynamically allocated fields.
pop | Pointer to the population structure whose memory is to be freed. |
Definition at line 411 of file non_dominated_sort.c.
void insert_node | ( | list * | node, |
long | x ) |
Definition at line 24 of file non_dominated_sort.c.
int64_t * non_dominated_sort | ( | population * | new_pop | ) |
Performs non-dominated sorting on a population and assigns ranks and crowding distances.
This function sorts the population into different fronts based on non-domination, assigns a rank to each individual indicating its front, and computes the crowding distance to maintain diversity within each front.
new_pop | Pointer to the population structure to be sorted. |
Definition at line 275 of file non_dominated_sort.c.
void q_sort_dist | ( | population * | pop, |
long * | dist, | ||
long | left, | ||
long | right ) |
Definition at line 207 of file non_dominated_sort.c.
void q_sort_front_obj | ( | population * | pop, |
long | objcount, | ||
long | obj_array[], | ||
long | left, | ||
long | right ) |
Definition at line 170 of file non_dominated_sort.c.
void quicksort_dist | ( | population * | pop, |
long * | dist, | ||
long | front_size ) |
Definition at line 201 of file non_dominated_sort.c.
void quicksort_front_obj | ( | population * | pop, |
long | objcount, | ||
long | obj_array[], | ||
long | obj_array_size ) |
Definition at line 163 of file non_dominated_sort.c.