-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdriver.h
More file actions
35 lines (27 loc) · 1.31 KB
/
Copy pathdriver.h
File metadata and controls
35 lines (27 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/////////////////////////////////////////////////////////////////////
/// @file driver.cpp
/// @author Joshua McCarville-Schueths CS348 Fall 2011
/// @brief Header for random search, Assignment 1a.
/////////////////////////////////////////////////////////////////////
#ifndef __DRIVER_H__
#define __DRIVER_H__
#include <iostream>
#include <fstream>
#include <ctime>
#include <cstring>
#include <cstdlib>
#include "ConfigFile.h"
#include "config.h"
using std::ifstream;
void read_network(ifstream& network, int &num_hosts, int &num_routers);
void read_connections(ifstream& network, int hosts, bool** connections);
int fitness(bool * router, int num_routers);
int penalty(bool * router, int num_routers, bool ** connection, int num_hosts, int coeff);
void mutate(float probability, bool * solution, int size);
void parent_selection(config ¶ms, bool ** mu_pop, int * fitness, int * list);
void sort_pop(bool ** mu_pop, int * fitness, config params);
void recombine(config params, int * parents_selected, bool ** parents, bool ** children, int size);
void uniform_crossover(config params, int * parents_selected, bool ** parents, bool ** children, int size);
void n_crossover(config params, int * parents_selected, bool ** parents, bool ** children, int size);
bool termination(config params, int total_evals, int evals_change);
#endif