Skip to content

Commit 1eae0df

Browse files
committed
feat: update project files
1 parent 905dd7a commit 1eae0df

39 files changed

+1804
-592
lines changed

Diff for: .idea/runConfigurations/Exp1.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: .idea/runConfigurations/Gridsearch.xml

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: .idea/runConfigurations/Montecarlo.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: .idea/workspace.xml

+271-314
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: README.adoc

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ To run the genetic algorithm with a specific config file:
66

77
[source, shell]
88
----
9-
cd laboratory
109
./gradlew runGA --args="config/exp1.json"
1110
----
1211

@@ -16,10 +15,16 @@ To run the genetic algorithm with a Montecarlo selector, to define a baseline, r
1615

1716
[source, shell]
1817
----
19-
cd laboratory
2018
./gradlew runRandomSelectorGA --args="config/exp1.json"
2119
----
2220

21+
To run the genetic algorithm over a set of parameters defined in the `GridSearchRunner` class, run:
22+
23+
[source, shell]
24+
----
25+
./gradlew runGAWithGridSearch --args="config/base.json"
26+
----
27+
2328
To compare a set of behavior trees over multiple configurations of the test environment
2429
and save the gathered data as a CSV run:
2530

Diff for: doc/report.adoc

+17-2
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,15 @@ Il compito del robot è di identificare il percorso ottimale, in presenza di vin
252252

253253
Ciascun individuo della popolazione contiene un albero ottenuto tramite generazione casuale.
254254
I nodi impiegati per la generazione degli alberi, la mutazione e la riparazione sono scelti a partire dal registro di nodi foglia impiegato per eseguire l'applicazione.
255-
I nodi disponibili per la sperimentazione sono i seguenti:
255+
I nodi disponibili per la sperimentazione fanno parte di due gruppi.
256+
257+
I nodi del primo gruppo sono:
258+
259+
260+
- `isLightNearer`
261+
- `moveForward`
262+
263+
I nodi del secondo gruppo sono:
256264

257265
- `checkFor{Goal,Obstacle,Boundary,Visited}{Forward,Left,Right}`: restituisce un successo solo se è presente l'entità della griglia specificata nella direzione fornita ed entro un raggio predefinito. In genere si controllano sono i vicini adiacenti nella direzione fornita;
258266
- `turnTo{Left,Right}`: restituisce sempre un successo e fa muovere il robot nella direzione indicata di una cella. Se il movimento comporta lo scontro con un ostacolo o il superamento dei confini della griglia, è intercettato dalla macchina a stati finiti. Il movimento del robot è annullato e si memorizza l'avvenuta collisione. Analogamente si memorizzano le informazioni relative al movimento in celle già visitate e all'assenza di movimento;
@@ -603,12 +611,19 @@ skewness: Double
603611
kurtosis: Double
604612
----
605613

606-
== Conclusioni
614+
== Conclusioni e sviluppi futuri
607615

608616
Lo svolgimento di questo progetto ha portato alla realizzazione di un sistema per l'implementazione automatica di un controller robotico che consenta di portare a termine semplici compiti di navigazione in un ambiente simulato.
609617

610618
Il progetto è disponibile con licenza open source link:https://github.com/rbattistini/btree-evolution/tree/main[qui].
611619

620+
Tra i potenziali sviluppi futuri:
621+
622+
- modificare la valutazione del grado di fitness in funzione del numero di generazioni, ad esempio per introdurre ambienti di test gradualmente più complessi;
623+
- sperimentare con pool di geni formati da nodi foglia di diverso genere;
624+
- esplorare lo spazio delle configurazioni in modo automatico, come Iterated Race;
625+
- definire nuovi domini di test.
626+
612627
== Bibliografia
613628

614629
bibliography::[]

Diff for: laboratory/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
experiment

Diff for: laboratory/build.gradle.kts

+9
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ tasks.register<JavaExec>("runGA") {
3838
mainClass = "${project.group}.lab.ExperimentRunnerKt"
3939
}
4040

41+
tasks.register<JavaExec>("runGAWithGridSearch") {
42+
description = "Run the main GA class with grid search."
43+
group = "custom"
44+
45+
standardOutput = System.out
46+
classpath = sourceSets.main.get().runtimeClasspath
47+
mainClass = "${project.group}.lab.GridSearchRunnerKt"
48+
}
49+
4150
tasks.register<JavaExec>("runRandomSelectorGA") {
4251
description = "Run the main GA class with a Montecarlo selector."
4352
group = "custom"

Diff for: laboratory/config/base.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"defaultSeed": 42,
3+
"populationSize": 30,
4+
"maxPhenotypeAge": 800,
5+
"steadyFitness": 300,
6+
"maxGenerations": 1000,
7+
"maxReparationAttempts": 5,
8+
"leafNodes": "exp1",
9+
"keepChildren": false,
10+
"maxGridValidationAttempts": 7,
11+
"maxNeighbourRadiusForGridValidation": 1,
12+
"deltaTime": 1,
13+
"startVirtualTime": 0,
14+
"phototaxisReward": 100.0,
15+
"collisionPenalty": 80.0,
16+
"idlePenalty": 60.0,
17+
"backtrackingPenalty": 30.0,
18+
"treeComplexityPenalty": 50.0,
19+
"maxTreeSize": 15,
20+
"simRunsPerFitnessEval": 3
21+
}

Diff for: laboratory/config/exp1.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
"maxGenerations": 1000,
1111
"maxReparationAttempts": 5,
1212
"leafNodes": "exp1",
13+
"keepChildren": false,
1314
"gridDimensions": 7,
1415
"gridObstacles": 12,
15-
"maxGridValidationAttempts": 5,
16+
"maxGridValidationAttempts": 7,
1617
"maxNeighbourRadiusForGridValidation": 1,
1718
"maxTreeDepth": 2,
1819
"minTreeChildren": 2,
@@ -21,9 +22,10 @@
2122
"deltaTime": 1,
2223
"startVirtualTime": 0,
2324
"phototaxisReward": 100.0,
24-
"collisionPenalty": 100.0,
25+
"collisionPenalty": 80.0,
26+
"idlePenalty": 60.0,
2527
"backtrackingPenalty": 30.0,
26-
"treeComplexityPenalty": 60.0,
28+
"treeComplexityPenalty": 50.0,
2729
"maxTreeSize": 15,
2830
"simRunsPerFitnessEval": 3
2931
}

Diff for: laboratory/config/exp2.json

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
{
22
"defaultSeed": 42,
3-
"populationSize": 50,
4-
"maxPhenotypeAge": 1200,
3+
"populationSize": 30,
4+
"maxPhenotypeAge": 800,
55
"mutationProbability": 0.7,
66
"crossoverProbability": 0.8,
7-
"eliteCount": 3,
8-
"tournamentSampleSize": 5,
9-
"steadyFitness": 500,
10-
"maxGenerations": 2000,
11-
"maxReparationAttempts": 5,
7+
"eliteCount": 2,
8+
"tournamentSampleSize": 4,
9+
"steadyFitness": 300,
10+
"maxGenerations": 1000,
11+
"maxReparationAttempts": 7,
1212
"leafNodes": "exp1",
13-
"gridDimensions": 9,
14-
"gridObstacles": 21,
13+
"keepChildren": false,
14+
"gridDimensions": 7,
15+
"gridObstacles": 12,
1516
"maxGridValidationAttempts": 7,
1617
"maxNeighbourRadiusForGridValidation": 1,
1718
"maxTreeDepth": 2,
1819
"minTreeChildren": 2,
1920
"maxTreeChildren": 3,
20-
"maxSimSteps": 100,
21+
"maxSimSteps": 60,
2122
"deltaTime": 1,
2223
"startVirtualTime": 0,
2324
"phototaxisReward": 100.0,
24-
"collisionPenalty": 100.0,
25+
"collisionPenalty": 80.0,
26+
"idlePenalty": 60.0,
2527
"backtrackingPenalty": 30.0,
26-
"treeComplexityPenalty": 60.0,
28+
"treeComplexityPenalty": 70.0,
2729
"maxTreeSize": 15,
2830
"simRunsPerFitnessEval": 3
2931
}

Diff for: laboratory/config/exp3.json

+19-17
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
{
22
"defaultSeed": 42,
3-
"populationSize": 50,
4-
"maxPhenotypeAge": 1200,
5-
"mutationProbability": 0.7,
6-
"crossoverProbability": 0.8,
3+
"populationSize": 30,
4+
"maxPhenotypeAge": 800,
5+
"mutationProbability": 0.8,
6+
"crossoverProbability": 0.9,
77
"eliteCount": 3,
88
"tournamentSampleSize": 5,
9-
"steadyFitness": 500,
10-
"maxGenerations": 2000,
11-
"maxReparationAttempts": 5,
12-
"leafNodes": "exp2",
13-
"gridDimensions": 9,
14-
"gridObstacles": 21,
9+
"steadyFitness": 300,
10+
"maxGenerations": 1000,
11+
"maxReparationAttempts": 9,
12+
"leafNodes": "exp1",
13+
"keepChildren": false,
14+
"gridDimensions": 7,
15+
"gridObstacles": 12,
1516
"maxGridValidationAttempts": 7,
1617
"maxNeighbourRadiusForGridValidation": 1,
17-
"maxTreeDepth": 2,
18-
"minTreeChildren": 2,
19-
"maxTreeChildren": 3,
20-
"maxSimSteps": 100,
18+
"maxTreeDepth": 3,
19+
"minTreeChildren": 3,
20+
"maxTreeChildren": 4,
21+
"maxSimSteps": 70,
2122
"deltaTime": 1,
2223
"startVirtualTime": 0,
2324
"phototaxisReward": 100.0,
24-
"collisionPenalty": 100.0,
25+
"collisionPenalty": 80.0,
26+
"idlePenalty": 60.0,
2527
"backtrackingPenalty": 30.0,
26-
"treeComplexityPenalty": 60.0,
27-
"maxTreeSize": 20,
28+
"treeComplexityPenalty": 90.0,
29+
"maxTreeSize": 15,
2830
"simRunsPerFitnessEval": 3
2931
}

0 commit comments

Comments
 (0)