Comments (5)
Use the logger
argument in optimize method.
function logger(status)
@info "Iteration $(status.iteration)"
# get non-dominated solutions
P = Metaheuristics.get_non_dominated_solutions(status.population)
X = positions(P) # decisions variables
FX = fvals(P) # objective function values
display(FX)
end
f, bounds, _ = Metaheuristics.TestProblems.ZDT1();
res = optimize(f, bounds, NSGA2(), logger=logger)
See optimize
, Metaheuristics.get_non_dominated_solutions
, and the API References for more details.
from metaheuristics.jl.
Use the
logger
argument in optimize method.function logger(status) @info "Iteration $(status.iteration)" # get non-dominated solutions P = Metaheuristics.get_non_dominated_solutions(status.population) X = positions(P) # decisions variables FX = fvals(P) # objective function values display(FX) end f, bounds, _ = Metaheuristics.TestProblems.ZDT1(); res = optimize(f, bounds, NSGA2(), logger=logger)See
optimize
,Metaheuristics.get_non_dominated_solutions
, and the API References for more details.
Thank you.
Metaheuristics.get_non_dominated_solutions(status.population) returns the current non dominated points from the current population. How if I want all of the non dominated points so far?
fval requires a repeat evaluation. If the function is expensive, fval takes very long. Is there an alternative which directly access the function values of the non-dominated points saved?
from metaheuristics.jl.
How if I want all of the non dominated points so far?
Depending on the algorithm, get_non_dominated_solutions
will return all the non-dominated solutions found so far (until density estimator is used to removing solutions). Try using (assuming you're using NSGA2) NSGA2(options=Options(store_convergence=true))
, which will save (in res.convergence
) the status at each iteration.
Another option is to use an external archive to save the results using the logger function.
archive = []
logger(status) = push!(archive, status.population)
res = optimize(f, bounds, NSGA2(), logger=logger)
iteration = 1
display(fvals(archive[iteration]))
fval requires a repeat evaluation
Actually fval
and fvals
do not require re-evaluating solutions due to function values are stored in status.population
.
from metaheuristics.jl.
Actually
fval
andfvals
do not require re-evaluating solutions due to function values are stored instatus.population
.
I indeed tested the function 'fval' and found that it took much long so I supposed it did re-evaluate the function. Can you please confirm that? Thank you.
from metaheuristics.jl.
I'm pretty sure that Metaheuristics.fval(sol)
is not re-evaluating sol
to provide an output. You can see the function definition by typing:
@edit fval(res.population[1])
I'm assuming you did not overwrite the fval
method.
from metaheuristics.jl.
Related Issues (20)
- Issues from encapsulating `State` in `Algorithm` HOT 2
- Is there a reason the samplers generate row instead of column matrices? Julia is column major HOT 1
- Metaheuristics.jl doesn't compile in Julia v1.11.0-alpha1 HOT 1
- Multiple constraints handling in constrained optimization
- Proposals for Combinatorial Optimization HOT 1
- Feature request: allow passing a random generator or create a fresh generator for `optimize`
- Callable objects are not supported by `optimize`
- Printing progress to terminal when running optimization? HOT 3
- New features coming in next release HOT 3
- Reuse intervals from IntervalSets.jl HOT 2
- 3.3 version: many types stopped working HOT 2
- Real-valued GA example in documentation HOT 1
- Combinatorial Space HOT 1
- xfgh_solution vs xFgh_solution vs xf_solution HOT 4
- Handle unstable objective function output HOT 2
- Docs not accessible? HOT 1
- Error on convergence termination criterion when multi-objective problem
- Typo in `update_state!` for DE.jl HOT 2
- Slight grammatical error in Contributions section of ReadME
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metaheuristics.jl.