Question: ARITIFICAL INTELLIGENCE CODING IS IN JAVA If you use file reader please show example of the .txt file you used. I beleive the only coding

ARITIFICAL INTELLIGENCE

CODING IS IN JAVA

If you use file reader please show example of the .txt file you used.

I beleive the only coding needed is in the GeneticlAlgorithm.java

(which is the code I pasted at the very bottom)

ARITIFICAL INTELLIGENCE CODING IS IN JAVA If you use file reader pleaseshow example of the .txt file you used. I beleive the onlycoding needed is in the GeneticlAlgorithm.java (which is the code I pastedat the very bottom) //Generic algo package ga; public class GeneticAlgorithm {

//Generic algo

package ga;

public class GeneticAlgorithm {

protected int mPopulationSize;

protected int mTournamentsSize;

protected double mCrossoverProb;

protected double mMutationProb;

public GeneticAlgorithm(int populationSize,

int tournamentsSize, double crossoverProb, double mutationProb) {

mPopulationSize = populationSize;

mTournamentsSize = tournamentsSize;

mCrossoverProb = crossoverProb;

mMutationProb = mutationProb;

// ...

createInitialPopulation();

}

public void createInitialPopulation() {

// to be implemented

}

public void runOneGeneration() {

// to be implemented

}

public double getAverageFitness() {

// to be implemented; remove 0.0

return 0.0;

}

public double getBestFitness() {

// to be implemented; remove 0.0

return 0.0;

}

// other methods to be implemented

}

ARITIFICAL INTELLIGENCE

CODING IS IN JAVA

If you use file reader please show example of the .txt file you used.

I beleive the only coding needed is in the GeneticlAlgorithm.java

(which is the code I pasted at the very bottom)

protected int mPopulationSize; protected int mTournamentsSize; protected double mCrossoverProb; protected double mMutationProb;public GeneticAlgorithm(int populationSize, int tournamentsSize, double crossoverProb, double mutationProb) { mPopulationSize =populationSize; mTournamentsSize = tournamentsSize; mCrossoverProb = crossoverProb; mMutationProb = mutationProb; // ...createInitialPopulation(); } public void createInitialPopulation() { // to be implemented } public

//Generic algo

package ga;

public class GeneticAlgorithm {

protected int mPopulationSize;

protected int mTournamentsSize;

protected double mCrossoverProb;

protected double mMutationProb;

public GeneticAlgorithm(int populationSize,

int tournamentsSize, double crossoverProb, double mutationProb) {

mPopulationSize = populationSize;

mTournamentsSize = tournamentsSize;

mCrossoverProb = crossoverProb;

mMutationProb = mutationProb;

// ...

createInitialPopulation();

}

public void createInitialPopulation() {

// to be implemented

}

public void runOneGeneration() {

// to be implemented

}

public double getAverageFitness() {

// to be implemented; remove 0.0

return 0.0;

}

public double getBestFitness() {

// to be implemented; remove 0.0

return 0.0;

}

// other methods to be implemented

}

Description Your task is to implement a Genetic algorithm (GA) to find the maximum of the following function: 3 .3 where x and y are real numbers between -3 and 3. You can represent the problem variables as a chromosome by concatenating x and y as a binary string using 8-bits for each variable: 10 0010100 0l111 0 11 The calculation of x and y of a chromosome is done as follows: 1. A chromosome (string of 16 bits) is partitioned into two 8-bit strings 10 0 0 1 0 10and0 011 101 1 2. These strings are converted from binary (base 2) to decimal (base 10): (10001010)2 -Ix27 +0x26+0x25 +0x24 +1x23 +0x22+1x21 +0x20 138)10 and (0011 101)2-0x27 +0x26+lx25+lx24+1x23+0x22+1x21 +1x20 - (59)10 Description Your task is to implement a Genetic algorithm (GA) to find the maximum of the following function: 3 .3 where x and y are real numbers between -3 and 3. You can represent the problem variables as a chromosome by concatenating x and y as a binary string using 8-bits for each variable: 10 0010100 0l111 0 11 The calculation of x and y of a chromosome is done as follows: 1. A chromosome (string of 16 bits) is partitioned into two 8-bit strings 10 0 0 1 0 10and0 011 101 1 2. These strings are converted from binary (base 2) to decimal (base 10): (10001010)2 -Ix27 +0x26+0x25 +0x24 +1x23 +0x22+1x21 +0x20 138)10 and (0011 101)2-0x27 +0x26+lx25+lx24+1x23+0x22+1x21 +1x20 - (59)10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!