int dbg_movement = 0;
int dbg_init = 0;
int dbg_overlaps = 0;
+int dbg_rank = 0;
int page_width_int;
int page_height_int;
void rank_population(void);
void plan_individual(struct individual *individual);
+int cmp_individual(const void *a, const void *b);
+
void make_bitmap(struct variant *v, struct symbol *sym);
void make_bitmap_icon(struct variant *v, struct sym_icon *si);
void make_bitmap_point(struct variant *v, struct sym_point *sp);
return overlap;
}
+int cmp_individual(const void *a, const void *b)
+{
+ struct individual **ia = (struct individual **) a;
+ struct individual **ib = (struct individual **) b;
+
+ return (*ia)->penalty - (*ib)->penalty;
+}
+
void rank_population(void)
{
- // FIXME
+ int penalty;
+
+ for (int i=0; i<conf_pop_size; i++)
+ {
+ if (dbg_rank)
+ printf("Individual %d\n", i);
+ population1[i]->penalty = 0;
+
+ penalty = individual_overlap(population1[i]);
+ if (dbg_rank)
+ printf("Increasing penalty by %d for overlap\n", penalty);
+ population1[i]->penalty += penalty;
+ }
}
struct map_part **get_map_parts(struct placement *p)
double randdouble(void)
{
- // FIXME: How the hell shall double in range <0, 1> be generated? O:)
- return 0.5;
+ return ((double) rand() / (double) RAND_MAX);
}
void cleanup(void)