Click here to Skip to main content
16,005,037 members
Home / Discussions / Article Writing
   

Article Writing

 
GeneralWin32 CGI Pin
Matt Newman10-Dec-01 14:34
Matt Newman10-Dec-01 14:34 
GeneralRe: Win32 CGI Pin
Jon Sagara10-Dec-01 14:37
Jon Sagara10-Dec-01 14:37 
GeneralMYCIN Source CODE Pin
9-Dec-01 4:31
suss9-Dec-01 4:31 
QuestionConnecting to Proxy Servers using Socks4 or 5? Pin
fadi7-Dec-01 4:39
fadi7-Dec-01 4:39 
GeneralFTP Class Pin
Matt Newman6-Dec-01 11:07
Matt Newman6-Dec-01 11:07 
GeneralRe: FTP Class Pin
Andrew Peace6-Dec-01 11:43
Andrew Peace6-Dec-01 11:43 
GeneralRe: FTP Class Pin
Matt Newman6-Dec-01 15:18
Matt Newman6-Dec-01 15:18 
GeneralGenetic algorithm Pin
4-Dec-01 2:57
suss4-Dec-01 2:57 
Please !!!! I need help to complete this below C++ source code.
Please its urgent......can somebody give me a hand.



/* Evolutionary Systems Guided Practical Exercise 2

Genetic algorithm for Hinton and Nowlan's experiment

Guide:

A. Read and understand Hinton and Nowlan's paper (given out in the lecture)
If you missed the lecture then photocopy a friend's or ask ADC next lecture
B. Read through the code in this question and make sure you understand what
each part should do
C. Fill in the CCCC to complete the code that calculates the genotype fitnesses
D. Fill in the DDDD to complete the code that selects parents for reproduction
E. Fill in the EEEE to produce the child genotype using crossover
F. Test that your program compiles and runs
To compile: g++ -o EvSysEx2 EvSysEx2.cc
Then to run: ./EvSysEx2

*/


#include <stdlib.h>
#include <time.h>
#include <iostream.h>


const int numGenotypes = 1000;
const int genotypeLength = 20;
const int numLearningTrials = 1000;
const int numGenerations = 50;


void randomise() // seed the random number generator from the system clock
{
srand(time(0));
}

int random(int n) // return a random integer between 0 and n-1
{
return (int) (((double) n)*rand()/(RAND_MAX+1.0));
}


enum Gene {zero=0,one=1,questionMark=2};

Gene genotypes[numGenotypes][genotypeLength];

int fitness[numGenotypes];
// fitness = 1000*"1+19n/1000" where n = number of learning trials remaining
// or rather numLearningTrials + 19 * n

void calculateFitnessArray() // calculate fitness[]
{
int i;
for (i=0;i
GeneralUsing the Microsoft Hierarchical FlexGrid Control Pin
4-Dec-01 0:12
suss4-Dec-01 0:12 
GeneralRe: Using the Microsoft Hierarchical FlexGrid Control Pin
4-Dec-01 0:34
suss4-Dec-01 0:34 
GeneralSearching files and folders Pin
3-Dec-01 19:13
suss3-Dec-01 19:13 
GeneralRe: Searching files and folders Pin
Michael Dunn3-Dec-01 20:06
sitebuilderMichael Dunn3-Dec-01 20:06 
GeneralRe: Searching files and folders Pin
4-Dec-01 13:42
suss4-Dec-01 13:42 
GeneralOpen a running file for read Pin
1-Dec-01 7:05
suss1-Dec-01 7:05 
GeneralRe: Open a running file for read Pin
3-Dec-01 17:49
suss3-Dec-01 17:49 
Generalsorting array using template Pin
vbsonic30-Nov-01 18:52
vbsonic30-Nov-01 18:52 
GeneralMicrosoft Layer for Unicode Pin
Franz Klein30-Nov-01 5:29
Franz Klein30-Nov-01 5:29 
GeneralExtending Active Directory UI Pin
Hendrik Kurniawan27-Nov-01 16:33
Hendrik Kurniawan27-Nov-01 16:33 
GeneralRe: Extending Active Directory UI Pin
Erik Thompson4-Dec-01 8:48
sitebuilderErik Thompson4-Dec-01 8:48 
GeneralMap rectangle to quadrilateral Pin
Chris Losinger27-Nov-01 9:18
professionalChris Losinger27-Nov-01 9:18 
GeneralControlling the Keyboard Pin
27-Nov-01 5:15
suss27-Nov-01 5:15 
GeneralRe: Controlling the Keyboard Pin
(Steven Hicks)n+130-Nov-01 5:01
(Steven Hicks)n+130-Nov-01 5:01 
GeneralControlling the mouse Pin
26-Nov-01 6:40
suss26-Nov-01 6:40 
GeneralRe: Controlling the mouse Pin
Nish Nishant26-Nov-01 7:35
sitebuilderNish Nishant26-Nov-01 7:35 
QuestionHow to delete system files??? Pin
Huu Quynh25-Nov-01 23:46
Huu Quynh25-Nov-01 23:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.