Skip to content

Commit 4f6a765

Browse files
committed
* Adjusted defaults
* Added API description
1 parent 33787b3 commit 4f6a765

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ swarm fireflies -h
8282

8383
### API
8484

85+
In addition to the client you can also use the API:
86+
87+
```python
88+
from swarmlib.fireflyalgorithm.firefly_problem import FireflyProblem
89+
from swarmlib.fireflyalgorithm.functions import FUNCTIONS
90+
91+
problem = FireflyProblem(FUNCTIONS['michalewicz'], 14)
92+
problem.solve()
93+
```
94+
8595
## Contribution
8696

8797
If you found a bug or are missing a feature do not hesitate to [file an issue](https://github.com/HaaLeo/swarmlib/issues/new/choose).

swarmlib/fireflyalgorithm/firefly_problem.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919

2020
class FireflyProblem():
21-
def __init__(self, function, firefly_number, upper_boundary=4., lower_boundary=0., alpha=0.25, beta=1, gamma=0.97, iteration_number=100, interval=500):
21+
def __init__(self, function, firefly_number, upper_boundary=4., lower_boundary=0., alpha=0.25, beta=1, gamma=0.97, iteration_number=10, interval=500):
2222
"""Initializes a new instance of the `FireflyProblem` class.
2323
2424
Arguments: \r

swarmlib/fireflyalgorithm/main.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def configure_parser(sub_parsers):
4040
'--lower-boundary',
4141
type=float,
4242
default=0.,
43-
help='Lower boundary of the function (default o)')
43+
help='Lower boundary of the function (default 0)')
4444
parser.add_argument(
4545
'-a',
4646
'--alpha',
@@ -63,8 +63,8 @@ def configure_parser(sub_parsers):
6363
'-n',
6464
'--iteration-number',
6565
type=int,
66-
default=100,
67-
help='Number of iterations to execute (default 100)')
66+
default=10,
67+
help='Number of iterations to execute (default 10)')
6868
parser.add_argument(
6969
'-i',
7070
'--interval',

0 commit comments

Comments
 (0)