Skip to content
Snippets Groups Projects
Commit 079e6dd0 authored by a.croix's avatar a.croix
Browse files

Test reformat plugin

parent dbb77237
No related branches found
No related tags found
No related merge requests found
Pipeline #1088 passed
...@@ -36,7 +36,7 @@ public class SolutionDistance ...@@ -36,7 +36,7 @@ public class SolutionDistance
* Generator * Generator
* *
* @param weights_number int * @param weights_number int
* @param seed int * @param seed int
*/ */
public SolutionDistance(final int weights_number, final int seed) { public SolutionDistance(final int weights_number, final int seed) {
Random rnd = new Random(seed); Random rnd = new Random(seed);
...@@ -66,7 +66,7 @@ public class SolutionDistance ...@@ -66,7 +66,7 @@ public class SolutionDistance
* @param expected * @param expected
*/ */
final void computeScoreTo(final List<double[]> data, final void computeScoreTo(final List<double[]> data,
final double[] expected final double[] expected
) { ) {
this.distance = 0; this.distance = 0;
......
...@@ -32,16 +32,16 @@ public class Trainer { ...@@ -32,16 +32,16 @@ public class Trainer {
List<SolutionDistance> current_population List<SolutionDistance> current_population
= this.generateInitialPopulationAndComputeDistances( = this.generateInitialPopulationAndComputeDistances(
this.getParameters().getPopulationSize(), this.getParameters().getPopulationSize(),
data, data,
expected); expected);
//Collections.sort(current_population); //Collections.sort(current_population);
SolutionDistance best_solution SolutionDistance best_solution
= this.findBestSolution(current_population); = this.findBestSolution(current_population);
for (int generation = 0; for (int generation = 0;
generation < this.parameters.getMaxGenerationNumber(); generation < this.parameters.getMaxGenerationNumber();
generation++) { generation++) {
current_population = this.performReproduction( current_population = this.performReproduction(
current_population, data, expected); current_population, data, expected);
SolutionDistance best_solution_of_current_population SolutionDistance best_solution_of_current_population
...@@ -134,7 +134,7 @@ public class Trainer { ...@@ -134,7 +134,7 @@ public class Trainer {
if (solutions.size() < count) { if (solutions.size() < count) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Not enough elements in population to select " "Not enough elements in population to select "
+ count + "parents" + count + "parents"
); );
} }
...@@ -272,10 +272,10 @@ public class Trainer { ...@@ -272,10 +272,10 @@ public class Trainer {
* @return * @return
*/ */
final void reproduce(final SolutionDistance dad, final void reproduce(final SolutionDistance dad,
final SolutionDistance mom, final SolutionDistance mom,
final List<SolutionDistance> solutions, final List<SolutionDistance> solutions,
final int cut_position, final int cut_position,
final double beta) { final double beta) {
double p_new1_w = dad.getWeightsW()[cut_position] - beta double p_new1_w = dad.getWeightsW()[cut_position] - beta
* (dad.getWeightsW()[cut_position] * (dad.getWeightsW()[cut_position]
...@@ -364,9 +364,9 @@ public class Trainer { ...@@ -364,9 +364,9 @@ public class Trainer {
int number_of_weights = data.get(0).length; int number_of_weights = data.get(0).length;
List<SolutionDistance> initial_population List<SolutionDistance> initial_population
= this.generateInitialPopulation( = this.generateInitialPopulation(
number_of_weights, number_of_weights,
population_size population_size
); );
return this.computeDistances(initial_population, data, expected); return this.computeDistances(initial_population, data, expected);
} }
......
...@@ -76,6 +76,10 @@ public class TrainerParameters { ...@@ -76,6 +76,10 @@ public class TrainerParameters {
return logger; return logger;
} }
private void setLogger(final Logger logger) {
this.logger = logger;
}
/** /**
* Getter for population_size. * Getter for population_size.
* *
...@@ -166,8 +170,4 @@ public class TrainerParameters { ...@@ -166,8 +170,4 @@ public class TrainerParameters {
this.max_generation_number = max_generation_number; this.max_generation_number = max_generation_number;
} }
private void setLogger(final Logger logger) {
this.logger = logger;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment