@@ -49,24 +49,24 @@ mutable struct ParticleSwarmOptions{
49
49
retraction_method:: TRetraction
50
50
inverse_retraction_method:: TInvRetraction
51
51
vector_transport_method:: TVTM
52
- function ParticleSwarmOptions {P} (
52
+ function ParticleSwarmOptions (
53
53
x0:: AbstractVector ,
54
54
velocity:: AbstractVector ,
55
- inertia:: TParams = 0.65 ,
56
- social_weight:: TParams = 1.4 ,
57
- cognitive_weight:: TParams = 1.4 ,
55
+ inertia= 0.65 ,
56
+ social_weight= 1.4 ,
57
+ cognitive_weight= 1.4 ,
58
58
stopping_criterion:: StoppingCriterion = StopWhenAny (
59
59
StopAfterIteration (500 ), StopWhenChangeLess (10.0 ^ (- 4 ))
60
60
),
61
61
retraction_method:: AbstractRetractionMethod = ExponentialRetraction (),
62
62
inverse_retraction_method:: AbstractInverseRetractionMethod = LogarithmicInverseRetraction (),
63
63
vector_transport_method:: AbstractVectorTransportMethod = ParallelTransport (),
64
- ) where {P,TParams}
64
+ )
65
65
o = new{
66
66
typeof (x0),
67
- P ,
67
+ eltype (x0) ,
68
68
typeof (velocity),
69
- TParams ,
69
+ typeof (inertia + social_weight + cognitive_weight) ,
70
70
typeof (stopping_criterion),
71
71
typeof (retraction_method),
72
72
typeof (inverse_retraction_method),
@@ -85,28 +85,3 @@ mutable struct ParticleSwarmOptions{
85
85
return o
86
86
end
87
87
end
88
- function ParticleSwarmOptions (
89
- x0:: AbstractVector{P} ,
90
- velocity:: AbstractVector ,
91
- inertia:: Real = 0.65 ,
92
- social_weight:: Real = 1.4 ,
93
- cognitive_weight:: Real = 1.4 ,
94
- stopping_criterion:: StoppingCriterion = StopWhenAny (
95
- StopAfterIteration (500 ), StopWhenChangeLess (10.0 ^ (- 4 ))
96
- ),
97
- retraction_method:: AbstractRetractionMethod = ExponentialRetraction (),
98
- inverse_retraction_method:: AbstractInverseRetractionMethod = LogarithmicInverseRetraction (),
99
- vector_transport_method:: AbstractVectorTransportMethod = ParallelTransport (),
100
- ) where {P,T}
101
- return ParticleSwarmOptions {P} (
102
- x0,
103
- velocity,
104
- inertia,
105
- social_weight,
106
- cognitive_weight,
107
- stopping_criterion,
108
- retraction_method,
109
- inverse_retraction_method,
110
- vector_transport_method,
111
- )
112
- end
0 commit comments