Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
O
Oersted
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Pries, Jason
Oersted
Commits
a251cc92
Commit
a251cc92
authored
Jan 22, 2018
by
Pries, Jason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Begin implementation of Switched Winding Synchrel PSO application
parent
0e90749e
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
189 additions
and
58 deletions
+189
-58
CMakeLists.txt
CMakeLists.txt
+4
-2
apps/CMakeLists.txt
apps/CMakeLists.txt
+17
-0
apps/Switched Winding Synchrel/CMakeLists.txt
apps/Switched Winding Synchrel/CMakeLists.txt
+9
-0
apps/Switched Winding Synchrel/designspace.cpp
apps/Switched Winding Synchrel/designspace.cpp
+26
-0
apps/Switched Winding Synchrel/designspace.h
apps/Switched Winding Synchrel/designspace.h
+8
-0
apps/Switched Winding Synchrel/globalobjective.cpp
apps/Switched Winding Synchrel/globalobjective.cpp
+10
-0
apps/Switched Winding Synchrel/globalobjective.h
apps/Switched Winding Synchrel/globalobjective.h
+10
-0
apps/Switched Winding Synchrel/main.cpp
apps/Switched Winding Synchrel/main.cpp
+22
-0
src/Optimization/src/CoordinateSpace.cpp
src/Optimization/src/CoordinateSpace.cpp
+17
-9
src/Optimization/src/CoordinateSpace.h
src/Optimization/src/CoordinateSpace.h
+9
-3
src/Optimization/src/Particle.cpp
src/Optimization/src/Particle.cpp
+8
-5
src/Optimization/src/Swarm.cpp
src/Optimization/src/Swarm.cpp
+8
-0
src/Optimization/src/Swarm.h
src/Optimization/src/Swarm.h
+11
-7
test/Model Templates/test_ModelTemplates.hpp
test/Model Templates/test_ModelTemplates.hpp
+1
-0
test/Model Templates/test_SynchronousReluctanceMachine.cpp
test/Model Templates/test_SynchronousReluctanceMachine.cpp
+0
-3
test/Optimization/MPI_Particle_Swarm_Optimization.cpp
test/Optimization/MPI_Particle_Swarm_Optimization.cpp
+4
-4
test/Optimization/test_ParticleSwarmOptimization.cpp
test/Optimization/test_ParticleSwarmOptimization.cpp
+25
-25
No files found.
CMakeLists.txt
View file @
a251cc92
...
...
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.2)
project
(
Oersted
)
find_package
(
MPI REQUIRED
)
find_package
(
OpenMP
)
find_package
(
OpenMP
REQUIRED
)
include_directories
(
${
MPI_INCLUDE_PATH
}
)
include_directories
(
./lib/
)
...
...
@@ -31,4 +31,6 @@ include_directories(./src/Model\ Templates/include/)
add_subdirectory
(
./src/
)
add_subdirectory
(
./test/
)
\ No newline at end of file
add_subdirectory
(
./test/
)
add_subdirectory
(
./apps/
)
\ No newline at end of file
apps/CMakeLists.txt
0 → 100644
View file @
a251cc92
project
(
Oersted_Apps
)
set
(
OERSTED_LIBRARIES
geometry
sketch
elements
mesh
materials
optimization
quadrature
physics
model_templates
stdc++fs
${
MPI_C_LIBRARIES
}
)
add_subdirectory
(
./Switched\ Winding\ Synchrel
)
\ No newline at end of file
apps/Switched Winding Synchrel/CMakeLists.txt
0 → 100644
View file @
a251cc92
PROJECT
(
Switched\ Winding\ Synchrel
)
set
(
SOURCE_FILES
main.cpp
designspace.h designspace.cpp
globalobjective.h globalobjective.cpp
)
add_executable
(
sws
${
SOURCE_FILES
}
)
target_link_libraries
(
sws
${
OERSTED_LIBRARIES
}
)
\ No newline at end of file
apps/Switched Winding Synchrel/designspace.cpp
0 → 100644
View file @
a251cc92
#include "designspace.h"
CoordinateSpace
design_space
()
{
CoordinateSpace
d
;
double_t
inch
{
25.4e-3
};
d
[
"ls"
]
=
Coordinate
{
1
*
inch
,
3.5
*
inch
,
6
*
inch
};
d
[
"rro"
]
=
Coordinate
{
2
*
inch
,
3.25
*
inch
,
4.5
*
inch
};
for
(
size_t
i
=
0
;
i
!=
6
;
++
i
)
{
std
::
string
key
=
"at"
+
std
::
to_string
(
i
);
d
[
key
]
=
Coordinate
{
0.07
,
0.14
,
0.21
};
}
for
(
size_t
i
=
0
;
i
!=
7
;
++
i
)
{
std
::
string
key
=
"rt"
+
std
::
to_string
(
i
);
d
[
key
]
=
Coordinate
{
0.07
,
0.14
,
0.21
};
}
d
[
"sw"
]
=
Coordinate
{
0.2
,
0.4
,
0.6
};
d
[
"bi"
]
=
Coordinate
{
0.5
,
1.0
,
1.5
};
d
[
"sd"
]
=
Coordinate
{
2
,
6
,
14
};
return
d
;
}
\ No newline at end of file
apps/Switched Winding Synchrel/designspace.h
0 → 100644
View file @
a251cc92
#ifndef OE_APP_SWITCHED_WINDING_SYNCHREL_DESIGNSPACE_H
#define OE_APP_SWITCHED_WINDING_SYNCHREL_DESIGNSPACE_H
#include "Optimization.hpp"
CoordinateSpace
design_space
();
#endif //OE_APP_SWITCHED_WINDING_SYNCHREL_DESIGNSPACE_H
\ No newline at end of file
apps/Switched Winding Synchrel/globalobjective.cpp
0 → 100644
View file @
a251cc92
#include "globalobjective.h"
ObjectiveMap
evaluate
(
Particle
p
)
{
// TODO
return
ObjectiveMap
{};
}
std
::
function
<
ObjectiveMap
(
Particle
)
>
global_objective
()
{
return
evaluate
;
}
\ No newline at end of file
apps/Switched Winding Synchrel/globalobjective.h
0 → 100644
View file @
a251cc92
#ifndef OE_APP_SWITCHED_WINDING_SYNCHREL_GLOBALOBJECTIVE_H
#define OE_APP_SWITCHED_WINDING_SYNCHREL_GLOBALOBJECTIVE_H
#include "Optimization.hpp"
std
::
function
<
ObjectiveMap
(
Particle
)
>
global_objective
();
ObjectiveMap
evaluate
(
Particle
p
);
#endif // OE_APP_SWITCHED_WINDING_SYNCHREL_GLOBALOBJECTIVE_H
\ No newline at end of file
apps/Switched Winding Synchrel/main.cpp
0 → 100644
View file @
a251cc92
#include "designspace.h"
#include "globalobjective.h"
int
main
(
int
argc
,
char
**
argv
)
{
// Arguments
size_t
swarm_size
{
41
};
double_t
objective_tolerance
{
1e-2
};
size_t
maximum_iterations
{
20
};
CoordinateSpace
ds
=
design_space
();
std
::
cout
<<
ds
;
std
::
function
<
ObjectiveMap
(
Particle
)
>
go
=
global_objective
();
Swarm
swarm
{
ds
,
go
,
swarm_size
,
objective_tolerance
,
maximum_iterations
};
std
::
cout
<<
swarm
;
std
::
cerr
<<
"Reminder: Don't forget to group limit at0-at5 and rt0-rt6"
<<
std
::
endl
;
return
0
;
}
\ No newline at end of file
src/Optimization/src/CoordinateSpace.cpp
View file @
a251cc92
#include "CoordinateSpace.h"
void
CoordinateSpace
::
limit_velocity
(
Particle
&
p
)
{
for
(
auto
&
k
ey_coord
:
Coordinates
)
{
std
::
string
const
&
key
=
k
ey_coord
.
first
;
Coordinate
const
&
coord
=
key_coord
.
second
;
for
(
auto
&
k
i
:
Coordinates
.
map
()
)
{
std
::
string
const
&
key
=
k
i
.
first
;
Coordinate
const
&
coord
=
Coordinates
[
ki
.
second
]
;
double_t
&
pv
=
p
.
velocity
(
key
);
double_t
v
=
SpeedLimit
*
coord
.
range
();
...
...
@@ -16,9 +16,9 @@ void CoordinateSpace::limit_velocity(Particle &p) {
}
void
CoordinateSpace
::
limit_position
(
Particle
&
p
)
{
for
(
auto
&
k
ey_coord
:
Coordinates
)
{
std
::
string
const
&
key
=
k
ey_coord
.
first
;
Coordinate
const
&
coord
=
key_coord
.
second
;
for
(
auto
&
k
i
:
Coordinates
.
map
()
)
{
std
::
string
const
&
key
=
k
i
.
first
;
Coordinate
const
&
coord
=
Coordinates
[
ki
.
second
]
;
double_t
&
px
=
p
.
position
(
key
);
double_t
&
pv
=
p
.
velocity
(
key
);
...
...
@@ -37,11 +37,19 @@ void CoordinateSpace::limit_position(Particle &p) {
void
CoordinateSpace
::
perturb
(
Particle
&
p
,
std
::
mt19937
&
rng
){
std
::
uniform_real_distribution
<>
dist
(
-
Perturbation
,
+
Perturbation
);
for
(
auto
&
k
ey_coord
:
Coordinates
)
{
std
::
string
const
&
key
=
k
ey_coord
.
first
;
Coordinate
const
&
coord
=
key_coord
.
second
;
for
(
auto
&
k
i
:
Coordinates
.
map
()
)
{
std
::
string
const
&
key
=
k
i
.
first
;
Coordinate
const
&
coord
=
Coordinates
[
ki
.
second
]
;
p
.
position
(
key
)
+=
dist
(
rng
)
*
coord
.
range
();
p
.
velocity
(
key
)
+=
dist
(
rng
)
*
coord
.
range
();
}
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
CoordinateSpace
&
p
)
{
for
(
auto
ki
:
p
.
Coordinates
.
map
())
{
std
::
string
k
=
ki
.
first
;
Coordinate
c
=
p
[
k
];
os
<<
k
<<
" \u220A ["
<<
c
.
lower_bound
()
<<
","
<<
c
.
upper_bound
()
<<
"]"
<<
std
::
endl
;
}
}
\ No newline at end of file
src/Optimization/src/CoordinateSpace.h
View file @
a251cc92
...
...
@@ -3,10 +3,13 @@
#include "Particle.h"
#include "Coordinate.h"
#include "ContiguousDataMap.h"
using
CoordinateMap
=
ContiguousDataMap
<
std
::
string
,
Coordinate
>
;
class
CoordinateSpace
{
public:
Coordinate
&
coordinate
(
std
::
string
key
)
{
return
Coordinates
[
key
];
};
Coordinate
&
operator
[]
(
std
::
string
key
)
{
return
Coordinates
[
key
];
};
Particle
new_particle
(
std
::
mt19937
&
rng
);
...
...
@@ -18,11 +21,14 @@ public:
void
perturb
(
Particle
&
p
,
std
::
mt19937
&
rng
);
std
::
map
<
std
::
string
,
Coordinate
>
Coordinates
;
double_t
SpeedLimit
{
0.2
};
double_t
Perturbation
{
0.2e-3
};
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
CoordinateSpace
&
p
);
protected:
CoordinateMap
Coordinates
;
};
...
...
src/Optimization/src/Particle.cpp
View file @
a251cc92
...
...
@@ -60,7 +60,7 @@ bool Particle::is_converged(CoordinateSpace &space, double_t state_tol, double_t
std
::
string
k
=
ki
.
first
;
CoordinateState
&
s
=
state
(
k
);
if
(
!
s
.
is_converged
(
state_tol
*
space
.
coordinate
(
k
)
.
range
()))
{
if
(
!
s
.
is_converged
(
state_tol
*
space
[
k
]
.
range
()))
{
return
false
;
}
}
...
...
@@ -69,20 +69,23 @@ bool Particle::is_converged(CoordinateSpace &space, double_t state_tol, double_t
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
Particle
&
p
)
{
os
<<
"P-Best: "
<<
p
.
PersonalBest
<<
", G-Best: "
<<
p
.
GlobalBest
<<
std
::
endl
;
for
(
auto
&
m
:
p
.
state
().
map
())
{
os
<<
m
.
first
<<
": "
<<
p
.
state
(
m
.
second
).
PersonalBest
<<
", "
;
}
os
<<
std
::
endl
;
os
<<
std
::
endl
<<
"P-Best: "
<<
p
.
PersonalBest
<<
", G-Best: "
<<
p
.
GlobalBest
;
return
os
;
}
Particle
CoordinateSpace
::
new_particle
(
std
::
mt19937
&
rng
)
{
std
::
uniform_real_distribution
<>
dist
(
-
1.0
,
1.0
);
Particle
particle
;
for
(
auto
&
key_
coord
:
Coordinates
)
{
std
::
string
const
&
key
=
key_
coor
d
.
first
;
Coordinate
const
&
coord
=
key_coord
.
second
;
for
(
auto
&
key_
ind
:
Coordinates
.
map
()
)
{
std
::
string
const
&
key
=
key_
in
d
.
first
;
Coordinate
const
&
coord
=
Coordinates
[
key_ind
.
second
]
;
double_t
v
=
dist
(
rng
)
*
coord
.
range
()
*
SpeedLimit
;
double_t
p
=
dist
(
rng
)
*
coord
.
range
()
*
SpeedLimit
+
coord
.
nominal
();
...
...
src/Optimization/src/Swarm.cpp
View file @
a251cc92
...
...
@@ -41,6 +41,14 @@ void Swarm::run() {
}
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
Swarm
&
s
)
{
for
(
auto
&
p
:
s
.
Particles
)
{
os
<<
p
;
}
return
os
;
}
void
Swarm
::
mpi_master
()
{
std
::
uniform_real_distribution
<>
dist
(
0.0
,
1.0
);
...
...
src/Optimization/src/Swarm.h
View file @
a251cc92
...
...
@@ -14,16 +14,18 @@ public:
Particles
.
push_back
(
Space
.
new_particle
(
RNG
));
}
// Setup MPI
MPI_Type_contiguous
(
sizeof
(
CoordinateState
)
/
sizeof
(
double_t
),
MPI_DOUBLE
,
&
MPI_CoordinateState
);
MPI_Type_commit
(
&
MPI_CoordinateState
);
MPI_Initialized
(
&
MPI_FLAG
);
if
(
MPI_FLAG
)
{
MPI_Type_contiguous
(
sizeof
(
CoordinateState
)
/
sizeof
(
double_t
),
MPI_DOUBLE
,
&
MPI_CoordinateState
);
MPI_Type_commit
(
&
MPI_CoordinateState
);
MPI_Type_vector
((
int
)
Particles
[
0
].
state
().
size
(),
1
,
1
,
MPI_CoordinateState
,
&
MPI_ParticleState
);
MPI_Type_commit
(
&
MPI_ParticleState
);
MPI_Type_vector
((
int
)
Particles
[
0
].
state
().
size
(),
1
,
1
,
MPI_CoordinateState
,
&
MPI_ParticleState
);
MPI_Type_commit
(
&
MPI_ParticleState
);
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
MPI_SIZE
);
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
MPI_RANK
);
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
MPI_SIZE
);
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
MPI_RANK
);
}
}
size_t
size
()
const
{
return
Particles
.
size
();
};
...
...
@@ -32,6 +34,8 @@ public:
void
mpi_run
();
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
Swarm
&
s
);
std
::
vector
<
Particle
>
Particles
;
double_t
Omega
{
0.5
};
...
...
test/Model Templates/test_ModelTemplates.hpp
View file @
a251cc92
...
...
@@ -5,6 +5,7 @@
#include "Mesh.hpp"
#include "ModelTemplates.hpp"
#include "Physics.hpp"
#include "Optimization.hpp"
#include "gtest.h"
...
...
test/Model Templates/test_SynchronousReluctanceMachine.cpp
View file @
a251cc92
...
...
@@ -583,9 +583,6 @@ double_t get_maximum(Eigen::VectorXd value) {
}
TEST_F
(
Synchronous_Reluctance_Machine
,
test
)
{
// TODO: Create Particle class
std
::
cout
<<
"TODO: Create class Particle"
<<
std
::
endl
;
DesignSpace
d
=
setup_design_space
();
auto
px
=
initialize_position
(
d
);
...
...
test/Optimization/MPI_Particle_Swarm_Optimization.cpp
View file @
a251cc92
...
...
@@ -6,8 +6,8 @@ TEST(Particle_Swarm_Optimization, mpi_swarm) {
CoordinateSpace
cs
;
cs
.
coordinate
(
"x"
)
=
Coordinate
{
-
2.0
,
0.0
,
2.0
};
cs
.
coordinate
(
"y"
)
=
Coordinate
{
-
2.0
,
0.0
,
2.0
};
cs
[
"x"
]
=
Coordinate
{
-
2.0
,
0.0
,
2.0
};
cs
[
"y"
]
=
Coordinate
{
-
2.0
,
0.0
,
2.0
};
std
::
function
<
ObjectiveMap
(
Particle
p
)
>
go
=
[](
Particle
p
)
{
ObjectiveMap
output
;
...
...
@@ -46,8 +46,8 @@ TEST(Particle_Swarm_Optimization, mpi_multiobjective_swarm) {
CoordinateSpace
cs
;
cs
.
coordinate
(
"x"
)
=
Coordinate
{
-
2.0
,
0.0
,
2.0
};
cs
.
coordinate
(
"y"
)
=
Coordinate
{
-
2.0
,
0.0
,
2.0
};
cs
[
"x"
]
=
Coordinate
{
-
2.0
,
0.0
,
2.0
};
cs
[
"y"
]
=
Coordinate
{
-
2.0
,
0.0
,
2.0
};
std
::
function
<
ObjectiveMap
(
Particle
p
)
>
go
=
[](
Particle
p
)
{
ObjectiveMap
output
;
...
...
test/Optimization/test_ParticleSwarmOptimization.cpp
View file @
a251cc92
...
...
@@ -3,26 +3,26 @@
TEST
(
Particle_Swarm_Optimization
,
coordinate_space_initialization
)
{
CoordinateSpace
cs
;
cs
.
coordinate
(
"x"
)
=
Coordinate
{
-
1.0
,
0.0
,
1.0
};
cs
.
coordinate
(
"y"
)
=
Coordinate
{
2.0
,
3.0
,
5.0
};
cs
[
"x"
]
=
Coordinate
{
-
1.0
,
0.0
,
1.0
};
cs
[
"y"
]
=
Coordinate
{
2.0
,
3.0
,
5.0
};
EXPECT_EQ
(
cs
.
coordinate
(
"x"
)
.
lower_bound
(),
-
1.0
);
EXPECT_EQ
(
cs
.
coordinate
(
"x"
)
.
nominal
(),
0.0
);
EXPECT_EQ
(
cs
.
coordinate
(
"x"
)
.
upper_bound
(),
+
1.0
);
EXPECT_NEAR
(
cs
.
coordinate
(
"x"
)
.
range
(),
2.0
,
FLT_EPSILON
);
EXPECT_EQ
(
cs
[
"x"
]
.
lower_bound
(),
-
1.0
);
EXPECT_EQ
(
cs
[
"x"
]
.
nominal
(),
0.0
);
EXPECT_EQ
(
cs
[
"x"
]
.
upper_bound
(),
+
1.0
);
EXPECT_NEAR
(
cs
[
"x"
]
.
range
(),
2.0
,
FLT_EPSILON
);
EXPECT_EQ
(
cs
.
coordinate
(
"y"
)
.
lower_bound
(),
2.0
);
EXPECT_EQ
(
cs
.
coordinate
(
"y"
)
.
nominal
(),
3.0
);
EXPECT_EQ
(
cs
.
coordinate
(
"y"
)
.
upper_bound
(),
5.0
);
EXPECT_NEAR
(
cs
.
coordinate
(
"y"
)
.
range
(),
3.0
,
FLT_EPSILON
);
EXPECT_EQ
(
cs
[
"y"
]
.
lower_bound
(),
2.0
);
EXPECT_EQ
(
cs
[
"y"
]
.
nominal
(),
3.0
);
EXPECT_EQ
(
cs
[
"y"
]
.
upper_bound
(),
5.0
);
EXPECT_NEAR
(
cs
[
"y"
]
.
range
(),
3.0
,
FLT_EPSILON
);
}
TEST
(
Particle_Swarm_Optimization
,
particle_initialization
)
{
CoordinateSpace
cs
;
cs
.
coordinate
(
"x"
)
=
Coordinate
{
-
1.0
,
0.0
,
1.0
};
cs
.
coordinate
(
"y"
)
=
Coordinate
{
2.0
,
3.0
,
5.0
};
cs
[
"x"
]
=
Coordinate
{
-
1.0
,
0.0
,
1.0
};
cs
[
"y"
]
=
Coordinate
{
2.0
,
3.0
,
5.0
};
std
::
random_device
rd
;
std
::
mt19937
rng
(
rd
());
...
...
@@ -30,17 +30,17 @@ TEST(Particle_Swarm_Optimization, particle_initialization) {
Particle
p
=
cs
.
new_particle
(
rng
);
for
(
std
::
string
key
:
{
"x"
,
"y"
})
{
EXPECT_GE
(
p
.
position
(
key
),
cs
.
coordinate
(
key
)
.
lower_bound
());
EXPECT_LE
(
p
.
position
(
key
),
cs
.
coordinate
(
key
)
.
upper_bound
());
EXPECT_GE
(
p
.
position
(
key
),
cs
[
key
]
.
lower_bound
());
EXPECT_LE
(
p
.
position
(
key
),
cs
[
key
]
.
upper_bound
());
EXPECT_GE
(
p
.
velocity
(
key
),
-
cs
.
coordinate
(
key
)
.
range
());
EXPECT_LE
(
p
.
velocity
(
key
),
+
cs
.
coordinate
(
key
)
.
range
());
EXPECT_GE
(
p
.
velocity
(
key
),
-
cs
[
key
]
.
range
());
EXPECT_LE
(
p
.
velocity
(
key
),
+
cs
[
key
]
.
range
());
EXPECT_GE
(
p
.
personal_best
(
key
),
cs
.
coordinate
(
key
)
.
lower_bound
());
EXPECT_LE
(
p
.
personal_best
(
key
),
cs
.
coordinate
(
key
)
.
upper_bound
());
EXPECT_GE
(
p
.
personal_best
(
key
),
cs
[
key
]
.
lower_bound
());
EXPECT_LE
(
p
.
personal_best
(
key
),
cs
[
key
]
.
upper_bound
());
EXPECT_GE
(
p
.
global_best
(
key
),
cs
.
coordinate
(
key
)
.
lower_bound
());
EXPECT_LE
(
p
.
global_best
(
key
),
cs
.
coordinate
(
key
)
.
upper_bound
());
EXPECT_GE
(
p
.
global_best
(
key
),
cs
[
key
]
.
lower_bound
());
EXPECT_LE
(
p
.
global_best
(
key
),
cs
[
key
]
.
upper_bound
());
EXPECT_GE
(
p
.
personal_best
(),
FLT_MAX
);
EXPECT_GE
(
p
.
global_best
(),
FLT_MAX
);
...
...
@@ -62,10 +62,10 @@ TEST(Particle_Swarm_Optimization, particle_initialization) {
TEST
(
Particle_Swarm_Optimization
,
single_objective_swarm
)
{
CoordinateSpace
cs
;
cs
.
coordinate
(
"x"
)
=
Coordinate
{
-
2.0
,
0.0
,
2.0
};
cs
.
coordinate
(
"y"
)
=
Coordinate
{
-
2.0
,
0.0
,
2.0
};
cs
[
"x"
]
=
Coordinate
{
-
2.0
,
0.0
,
2.0
};
cs
[
"y"
]
=
Coordinate
{
-
2.0
,
0.0
,
2.0
};
std
::
function
<
ObjectiveMap
(
Particle
p
)
>
go
=
[](
Particle
p
)
{
std
::
function
<
ObjectiveMap
(
Particle
)
>
go
=
[](
Particle
p
)
{
ObjectiveMap
output
;
double_t
x
=
p
.
position
(
"x"
);
...
...
@@ -97,8 +97,8 @@ TEST(Particle_Swarm_Optimization, single_objective_swarm) {
TEST
(
Particle_Swarm_Optimization
,
multiobjective_swarm
)
{
CoordinateSpace
cs
;
cs
.
coordinate
(
"x"
)
=
Coordinate
{
-
2.0
,
0.0
,
2.0
};
cs
.
coordinate
(
"y"
)
=
Coordinate
{
-
2.0
,
0.0
,
2.0
};
cs
[
"x"
]
=
Coordinate
{
-
2.0
,
0.0
,
2.0
};
cs
[
"y"
]
=
Coordinate
{
-
2.0
,
0.0
,
2.0
};
std
::
function
<
ObjectiveMap
(
Particle
p
)
>
go
=
[](
Particle
p
)
{
ObjectiveMap
output
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment