projects
/
cgo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e70e6d0
)
doc(params): parameter annotation
author
ametama
<ametama@wafflesoft.org>
Wed, 17 Dec 2025 23:15:28 +0000
(
00:15
+0100)
committer
ametama
<ametama@wafflesoft.org>
Wed, 17 Dec 2025 23:15:28 +0000
(
00:15
+0100)
include/swarm.h
patch
|
blob
|
history
src/main.c
patch
|
blob
|
history
diff --git
a/include/swarm.h
b/include/swarm.h
index 25cbe0b12377af5cdf438c8c8d38e3b23a1c132f..169bc0e79ad283c72262e3c51d89fedb4b4733dd 100644
(file)
--- a/
include/swarm.h
+++ b/
include/swarm.h
@@
-12,12
+12,12
@@
typedef struct {
typedef struct {
int dim;
- double (*f)(double*);
int particlec;
- double eps;
- double w;
- double c;
- double s;
+ double (*f)(double*); // fitness function
+ double eps; // convergence tolerance
+ double w; // inertia
+ double c; // cognitive factor
+ double s; // social factor
} swarm_parameters;
typedef struct {
diff --git
a/src/main.c
b/src/main.c
index 3ba66296394bb3653f4c2776c8038a2763da204d..62965ae465b6e4c43388d2cb54e75fd2a797c2a6 100644
(file)
--- a/
src/main.c
+++ b/
src/main.c
@@
-25,8
+25,8
@@
double f(double *x) {
int main(int argc, char *argv[]) {
swarm sw = {
2,
- f,
100,
+ f,
pow(2, 40),
0.8,
2.05,