File tree Expand file tree Collapse file tree 7 files changed +65
-46
lines changed
Expand file tree Collapse file tree 7 files changed +65
-46
lines changed Original file line number Diff line number Diff line change 1515 strategy :
1616 matrix :
1717 os : [ macos-latest, windows-latest, ubuntu-latest]
18- smalltalk : [Pharo64-8.0]
18+ smalltalk : [ Pharo64-8.0, Pharo64-9 .0]
1919 runs-on : ${{ matrix.os }}
2020 name : ${{ matrix.smalltalk }} on ${{ matrix.os }}
2121 steps :
Original file line number Diff line number Diff line change @@ -8,13 +8,20 @@ Class {
88}
99
1010{ #category : #running }
11- PMAnotherGeneticOptimizerTest >> setUp [
12- |origin f |
13- f: = [:x | |v | v: = x asPMVector . v* v].
14- origin: = #(-5 -5 -5) .
15- go: = PMAnotherGeneticOptimizer function: f minimumValues: origin maximumValues: origin negated .
16- go maximumIterations: 50 .
17- go chromosomeManager populationSize: 20 .
11+ PMAnotherGeneticOptimizerTest >> setUp [
12+
13+ | origin f |
14+ f := [ :x |
15+ | v |
16+ v := x asPMVector.
17+ v * v ].
18+ origin := #( -5 -5 -5 ) .
19+ go := PMAnotherGeneticOptimizer
20+ function: f
21+ minimumValues: origin
22+ maximumValues: origin negated.
23+ go maximumIterations: 50 .
24+ go chromosomeManager populationSize: 20
1825]
1926
2027{ #category : #tests }
@@ -62,13 +69,14 @@ self assert: (go bestValueHistory isEmpty ).
6269
6370{ #category : #tests }
6471PMAnotherGeneticOptimizerTest >> testPrint [
65- |aStream s |
66- aStream := ReadWriteStream with: ' ' .
67- go printOn: aStream .
68- s := aStream contents .
69- self assert: (s includesSubstring: ' v * v' ).
70- self assert: (s includesSubstring: ' 50' ).
71- self assert: (s includesSubstring: ' 20' ).
72+
73+ | aStream s |
74+ aStream := ReadWriteStream with: ' ' .
75+ go printOn: aStream.
76+ s := aStream contents.
77+ self assert: (s includesSubstring: ' v * v' ).
78+ self assert: (s includesSubstring: ' 50' ).
79+ self assert: (s includesSubstring: ' 20' )
7280]
7381
7482{ #category : #tests }
Original file line number Diff line number Diff line change @@ -8,12 +8,15 @@ Class {
88}
99
1010{ #category : #running }
11- PMErrorAsParameterFunctionTest >> setUp [
12- |col |
13- f: = PMErrorOfParameterFunction new function: [:x :a :b |a* x / (b+ x)].
14- col: = (1 to: 3 )collect: [:i |i@(f function cull: i cull: 1 cull: 1 ) ].
15- f data: col.
16- f := PMErrorAsParameterFunction new function: f.
11+ PMErrorAsParameterFunctionTest >> setUp [
12+
13+ | col |
14+ f := PMErrorOfParameterFunction new function: [ :x :a :b |
15+ a * x / (b + x) ].
16+ col := (1 to: 3 ) collect: [ :i |
17+ i @ (f function cull: i cull: 1 cull: 1 ) ].
18+ f data: col.
19+ f := PMErrorAsParameterFunction new function: f
1720]
1821
1922{ #category : #tests }
@@ -24,15 +27,15 @@ self assert: (f parameters size < f maxFunction ).
2427
2528{ #category : #tests }
2629PMErrorAsParameterFunctionTest >> testPrint [
27- |aStream s |
28- aStream := ReadWriteStream with: ' ' .
29- f printOn: aStream .
30- s := aStream contents .
31- self assert: (s includesSubstring: ' a * x / (b + x)' ).
32- self assert: (s includesSubstring: ' #squared' ).
33- self assert: (s includesSubstring: ' maxFunction: ' , f maxFunction asString).
34-
3530
31+ | aStream s |
32+ aStream := ReadWriteStream with: ' ' .
33+ f printOn: aStream.
34+ s := aStream contents.
35+ self assert: (s includesSubstring: ' a * x / (b + x)' ).
36+ self assert: (s includesSubstring: ' #squared' ).
37+ self assert:
38+ (s includesSubstring: ' maxFunction: ' , f maxFunction asString)
3639]
3740
3841{ #category : #tests }
Original file line number Diff line number Diff line change @@ -10,9 +10,11 @@ Class {
1010
1111{ #category : #running }
1212PMErrorOfParameterFunctionTest >> setUp [
13- f: = PMErrorOfParameterFunction new function: [:x :a :b |a* x / (b+ x)].
14- col: = (1 to: 3 )collect: [:i |i@(f function cull: i cull: 1 cull: 1 ) ].
1513
14+ f := PMErrorOfParameterFunction new function: [ :x :a :b |
15+ a * x / (b + x) ].
16+ col := (1 to: 3 ) collect: [ :i |
17+ i @ (f function cull: i cull: 1 cull: 1 ) ]
1618]
1719
1820{ #category : #tests }
Original file line number Diff line number Diff line change 99}
1010
1111{ #category : #running }
12- PMFunctionFitTest >> setUp [
13- f: = [:x :a :b |a* x / (b+ x)].
14- d: = (1 to: 20 )collect: [:i |i@(f cull: i cull: 2 cull: 0.4 ) ].
12+ PMFunctionFitTest >> setUp [
13+
14+ f := [ :x :a :b | a * x / (b + x) ].
15+ d := (1 to: 20 ) collect: [ :i | i @ (f cull: i cull: 2 cull: 0.4 ) ]
1516]
1617
1718{ #category : #tests }
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ PMKDTreeTest >> testIndexedKDTree1Dimension [
5252 aResult := stupid nnSearch: aVector i: 3 . " 3 nearest numbers to aVector "
5353 bResult := m atAll: ((tree nnSearch: aVector i: 3 ) collect: [:a | a first]).
5454 self equalityTest: aResult and : bResult].
55- ]
55+ ]
5656
5757{ #category : #tests }
5858PMKDTreeTest >> testIndexedKDTree4Dimensions [
@@ -99,7 +99,7 @@ PMKDTreeTest >> testKDTree1Dimension [
9999 aResult := stupid nnSearch: aVector i: 3 . " 3 nearest numbers to aVector "
100100 bResult := tree nnSearch: aVector i: 3 .
101101 self equalityTest: aResult and : bResult].
102- ]
102+ ]
103103
104104{ #category : #tests }
105105PMKDTreeTest >> testKDTree1DimensionIntegers [
@@ -110,7 +110,7 @@ PMKDTreeTest >> testKDTree1DimensionIntegers [
110110 aResult := (aVector first - (stupid nnSearch: aVector i: 3 )) abs. " distances between 3 nearest numbers and aVector "
111111 bResult := (aVector first - (tree nnSearch: aVector i: 3 )) abs. " distances using KDTree"
112112 self equalityTest: aResult and : bResult ] .
113- ]
113+ ]
114114
115115{ #category : #tests }
116116PMKDTreeTest >> testKDTree2Dimensions [
Original file line number Diff line number Diff line change @@ -175,16 +175,21 @@ PMNNStoreTest >> testNewFrom [
175175
176176{ #category : #tests }
177177PMNNStoreTest >> testWithAll [
178- | n |
179- n := PMNNStore withAll: #(2 5 4) .
180- self assert: n completeData equals: #(#(nil 2) #(nil 5) #(nil 4) ).
181- n sortFor: nil . " calling sortFor: is necessary with withAll:"
182- self assert: n data equals: #(2 4 5) .
178+
179+ | n array |
180+ n := PMNNStore withAll: #( 2 5 4 ) .
181+ self
182+ assert: n completeData
183+ equals: #( #( nil 2 ) #( nil 5 ) #( nil 4 ) ).
184+ n sortFor: nil . " calling sortFor: is necessary with withAll:"
185+ self assert: n data equals: #( 2 4 5 ) .
183186 self assert: n isFull.
184- n add: #(3 6) . " one has to be a bit carefull when one uses
185- NNStore withAll:, as sortfor: changes this data.
187+ n add: #(3 6) copy.
188+
189+ " one has to be a bit carefull when one uses
190+ PMNNStore withAll:, as sortfor: changes this data.
186191 n add: #(3 6) is not possible here!"
187- self assert: n data equals: #(2 6 4) .
192+ self assert: n data equals: #( 2 6 4 ) .
188193 n sortFor: nil .
189- self assert: n data equals: #(2 4 6)
194+ self assert: n data equals: #( 2 4 6 )
190195]
You can’t perform that action at this time.
0 commit comments