#include <stdlib.h>
#include <string.h>
#include "assert.h"
#include "modsup.h"
#include "chromo.h"
#include "error.h"
#include "params.h"
Functions | |
| int | cache_init () |
| Prepare fitness cache for use. | |
| void | cache_exit () |
| Free memory used by fitness cache. | |
| static int | cache_table_changed (table *t1, table *t2) |
| Compare variable chromosomes of two timetables. | |
| static void | cache_table_copy (table *dest, table *source) |
| Copy variable chromosomes and fitness information from source to destination timetable. | |
| static int | cache_find (table *tab) |
| Find a matching timetable in fitness cache. | |
| void | cache_table_fitness (table *tab) |
| Assign a fitness to a table by first checking the cache and then calling all fitness functions. | |
Variables | |
| static table ** | cache_array = NULL |
| Cache of timetable fitness values. | |
| static int | cache_next = 0 |
| Cache line that will be overwriten on the next cache miss. | |
| static long long int | cache_hit = 0 |
| Number of cache hits. | |
| static long long int | cache_miss = 0 |
| Number of cache misses. | |
| static int cache_find | ( | table * | tab | ) | [static] |
Find a matching timetable in fitness cache.
| tab | Timetable to search for. |
| int cache_init | ( | ) |
Prepare fitness cache for use.
Must be run after parser_main().
Compare variable chromosomes of two timetables.
| t1 | Pointer to the first timetable structure. | |
| t2 | Pointer to the second timetable structure. |
Copy variable chromosomes and fitness information from source to destination timetable.
| dest | Pointer to the destination timetable. | |
| source | Pointer to the source timetable. |
| void cache_table_fitness | ( | table * | tab | ) |
Assign a fitness to a table by first checking the cache and then calling all fitness functions.
Uses table_fitness() if no matching timetable was found in fitness cache.
| tab | Pointer to the table to be fitnessd. |
table** cache_array = NULL [static] |
Cache of timetable fitness values.
This is an array of par_cachesize timetable structures. Only variable chromosomes and fitness values (members table_t::fitness, table_t::possible and table_t::subtotals) are valid in these structures. As far as caching logic is concerned if two timetables have identical variable chromosomes they are identical.
1.5.2