@@ -10,14 +10,14 @@ Class {
1010 #name : #PMGeneralFunctionFit ,
1111 #superclass : #Object ,
1212 #instVars : [
13- ' go' ,
1413 ' manager' ,
1514 ' errorFunction' ,
1615 ' result' ,
1716 ' firstResult' ,
1817 ' verbose' ,
1918 ' data' ,
20- ' dataTruncated'
19+ ' dataTruncated' ,
20+ ' geneticOptimizer'
2121 ],
2222 #category : #' Math-FunctionFit'
2323}
@@ -100,8 +100,9 @@ PMGeneralFunctionFit >> evaluate [
100100 ff parameters ] onErrorDo: [
101101 verbose ifTrue: [ self inform: ' ErrorMinimizer was not successful' ].
102102 nil ].
103- firstResult ifNotNil: [ go addPointAt: firstResult ].
104- firstResult := go evaluate.
103+
104+ firstResult ifNotNil: [ geneticOptimizer addPointAt: firstResult ].
105+ firstResult := geneticOptimizer evaluate.
105106 self errorType = #squared ifTrue: [ ff := PMFunctionFit function: errorFunction function data: errorFunction data ].
106107 ff parameters: firstResult.
107108 ff desiredPrecision: Float machineEpsilon.
@@ -169,16 +170,19 @@ errorFunction function: aBlock
169170
170171{ #category : #initialization }
171172PMGeneralFunctionFit >> initialize [
172- super initialize .
173- errorFunction := PMErrorOfParameterFunction new .
174- manager := PMAnotherChromosomeManager new .
175- manager populationSize: 50 .
176- go := PMAnotherGeneticOptimizer minimizingFunction: errorFunction .
177- go chromosomeManager: manager.
178- go maximumIterations: 170 .
179- self errorType: #squared .
180- verbose: = false .
181- dataTruncated := false
173+
174+ super initialize.
175+ errorFunction := PMErrorOfParameterFunction new .
176+ manager := PMAnotherChromosomeManager new
177+ populationSize: 50 ;
178+ yourself .
179+ geneticOptimizer := (PMAnotherGeneticOptimizer minimizingFunction: errorFunction)
180+ chromosomeManager: manager;
181+ maximumIterations: 170 ;
182+ yourself .
183+ self errorType: #squared .
184+ verbose := false .
185+ dataTruncated := false
182186]
183187
184188{ #category : #accessing }
@@ -190,7 +194,7 @@ PMGeneralFunctionFit >> manager [
190194{ #category : #accessing }
191195PMGeneralFunctionFit >> maximumIterations: anInteger [
192196" default is 170."
193- go maximumIterations: anInteger.
197+ geneticOptimizer maximumIterations: anInteger.
194198^ anInteger
195199]
196200
@@ -211,7 +215,7 @@ manager range: (array2 - array1)
211215{ #category : #accessing }
212216PMGeneralFunctionFit >> optimizer [
213217" if you want to change parameters of AnotherGeneticOptimizer not directly available in GeneralFunctionFit"
214- ^ go
218+ ^ geneticOptimizer
215219]
216220
217221{ #category : #accessing }
@@ -225,7 +229,7 @@ manager populationSize: anInteger .
225229{ #category : #accessing }
226230PMGeneralFunctionFit >> precision [
227231" not really useful to look at, you might better look at #error"
228- ^ go precision
232+ ^ geneticOptimizer precision
229233]
230234
231235{ #category : #printing }
@@ -234,7 +238,7 @@ PMGeneralFunctionFit >> printOn: aStream [
234238 nextPutAll: ' a ' ;
235239 nextPutAll: self class name;
236240 nextPut: $(;
237- print: go ;
241+ print: geneticOptimizer ;
238242 nextPutAll: ' with data of size: ' ;
239243 print: data size .
240244 dataTruncated ifTrue:
@@ -276,7 +280,7 @@ self data: data
276280PMGeneralFunctionFit >> resetResult [
277281result := nil .
278282firstResult := nil .
279- go resetBestPoints
283+ geneticOptimizer resetBestPoints
280284]
281285
282286{ #category : #accessing }
0 commit comments