Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging not working if optimization type set to maximization #367

Closed
rhododendrom opened this issue Jan 4, 2022 · 3 comments
Closed

Logging not working if optimization type set to maximization #367

rhododendrom opened this issue Jan 4, 2022 · 3 comments

Comments

@rhododendrom
Copy link
Contributor

No logging is provided in case of following:

task = Task(problem=ff_value(dimension=10, lower=0, upper=1),
max_evals=100, enable_logging=True, optimization_type=OptimizationType.MAXIMIZATION)

@firefly-cpp
Copy link
Contributor

@zStupan, please check it out.

@zStupan
Copy link
Contributor

zStupan commented Jan 4, 2022

@rhododendrom It works for me on python3.10 and a fresh install of the latest niapy release, which version of python are you using? Could you also please share the implementation of ff_value?

from niapy.task import Task, OptimizationType
from niapy.problems import Sphere
from niapy.algorithms.basic import DifferentialEvolution


algorithm = DifferentialEvolution(differential_weight=0.8, crossover_probability=0.9, seed=12345)
problem = Sphere(10, 0, 1)
task = Task(problem, max_evals=100, optimization_type=OptimizationType.MAXIMIZATION, enable_logging=True)

algorithm.run(task)

Should produce the output:

INFO:niapy.task.Task:evals:1 => 3.241297708781705
INFO:niapy.task.Task:evals:2 => 3.577608409031643
INFO:niapy.task.Task:evals:4 => 5.588174037929252
INFO:niapy.task.Task:evals:17 => 5.747700926113583
INFO:niapy.task.Task:evals:85 => 5.766053703015857
INFO:niapy.task.Task:evals:95 => 6.401214995854259

@rhododendrom
Copy link
Contributor Author

Got it. I've had some installation troubles lately with the latest release and I was using the 2.0.0rc17 version.
Now, after upgrade, everything is fine.

Thanks and sorry about that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants