Skip to content

Commit 8c0309a

Browse files
committed
...
1 parent d819fb2 commit 8c0309a

7 files changed

+27
-28
lines changed

src/pgep/Engine.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ object Engine {
1010
}
1111
}
1212

13-
class Engine(params: EngineParameters, pop: Array[Genotype]) {
13+
class Engine private (params: EngineParameters, pop: Array[Genotype]) {
1414
protected val random = RNGProvider()
1515

1616
protected var population = pop

src/pgep/EngineParameters.scala

+11-12
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,19 @@ object EngineParameters {
3737
val nrep = ops.reproducers map (_.nchildren) reduceLeft (_ + _)
3838
require(nrep <= popsize)
3939
val operators = if (nrep == popsize) ops
40-
else new OperatorSet(ops.fitnessFunction, ops.mpf,
41-
ops.reproducers ++ List(new CreateRandom(gtparams, popsize - nrep)),
42-
ops.modifiers)
40+
else OperatorSet(ops.fitnessFunction, ops.mpf,
41+
ops.reproducers ++ List(new CreateRandom(gtparams, popsize - nrep)) ++ ops.modifiers)
4342

4443
new EngineParameters(popsize, gtparams, maxNrGenerations, goodEnoughFitness, consts, operators, constgen, constantMutationProbability, nConstants)
4544
}
4645
}
4746

48-
class EngineParameters(val popsize:Int,
49-
val gtparams: GenotypeParameters,
50-
val maxNrGenerations: Int,
51-
val goodEnoughFitness: Double,
52-
val constants: HashMap[Class[_], AlphabetRW[Const]],
53-
val operators: OperatorSet,
54-
val constgen: Map[Class[_], () => Any],
55-
val constantMutationProbability: Double,
56-
val nConstants: Int)
47+
class EngineParameters private (val popsize:Int,
48+
val gtparams: GenotypeParameters,
49+
val maxNrGenerations: Int,
50+
val goodEnoughFitness: Double,
51+
val constants: HashMap[Class[_], AlphabetRW[Const]],
52+
val operators: OperatorSet,
53+
val constgen: Map[Class[_], () => Any],
54+
val constantMutationProbability: Double,
55+
val nConstants: Int)

src/pgep/Gene.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ object Gene {
5555
}
5656
}
5757

58-
class Gene(parameters: GeneParameters, k_expression: Map[Class[_], Array[Term]], constants: Map[Class[_], Array[Const]]) {
58+
class Gene private (parameters: GeneParameters, k_expression: Map[Class[_], Array[Term]], constants: Map[Class[_], Array[Const]]) {
5959
val _k_expression = k_expression
6060
private val _constants = constants
6161

src/pgep/Genotype.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ object Genotype {
3434
private[this] final val isInvalid = (x: Double) => x.isNaN || x.isInfinity
3535
}
3636

37-
class Genotype(val gp: GenotypeParameters,
38-
val genes: Array[Gene]) {
37+
class Genotype private (val gp: GenotypeParameters,
38+
val genes: Array[Gene]) {
3939
import Genotype.isInvalid
4040

4141
private var _matingProbability: Double = _

src/pgep/GenotypeParameters.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ object GenotypeParameters {
1717
}
1818
}
1919

20-
class GenotypeParameters(val nrGenes: Int,
21-
val geneLinkingFunction: Func,
22-
val selector_fvc: Selector[Term],
23-
val selector_vc: Selector[Term],
24-
val geneParameters: Seq[GeneParameters]) {
20+
class GenotypeParameters private (val nrGenes: Int,
21+
val geneLinkingFunction: Func,
22+
val selector_fvc: Selector[Term],
23+
val selector_vc: Selector[Term],
24+
val geneParameters: Seq[GeneParameters]) {
2525

2626
def geneLen = geneParameters(0).geneLen
2727
def headLen = geneParameters(0).headLen

src/pgep/OperatorSet.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ object OperatorSet {
1212
}
1313
}
1414

15-
class OperatorSet(val fitnessFunction: (Genotype) => Double,
16-
val mpf: MatingProbabilityFunction,
17-
val reproducers: List[Reproducer],
18-
val modifiers: List[Mutator])
15+
class OperatorSet private (val fitnessFunction: (Genotype) => Double,
16+
val mpf: MatingProbabilityFunction,
17+
val reproducers: List[Reproducer],
18+
val modifiers: List[Mutator])

src/pgep/TermProbabilities.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ object TermProbabilities {
77
}
88
}
99

10-
class TermProbabilities(val functionProbabilities: Double,
11-
val variableProbabilities: Double,
12-
val constantProbabilities: Double)
10+
class TermProbabilities private (val functionProbabilities: Double,
11+
val variableProbabilities: Double,
12+
val constantProbabilities: Double)

0 commit comments

Comments
 (0)