-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Docs for MOO #823
base: master
Are you sure you want to change the base?
Docs for MOO #823
Conversation
Added documentation for MOO in BBO
MOO docs update.
MOO docs update.
3307b06
to
799f7de
Compare
https://github.com/SciML/Optimization.jl/actions/runs/10977080544/job/30478629355?pr=823 documentation failure seems real, can you take a look? |
updated project.toml for the docs.
Added compat for BBO.
end | ||
mof = MultiObjectiveOptimizationFunction(multi_obj_func_2) | ||
prob = Optimization.OptimizationProblem(mof, u0; lb = [0.0, 0.0], ub = [2.0, 2.0]) | ||
sol = solve(prob_2, opt, NumDimensions=2, FitnessScheme=ParetoFitnessScheme{2}(is_minimizing=true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sol = solve(prob_2, opt, NumDimensions=2, FitnessScheme=ParetoFitnessScheme{2}(is_minimizing=true)) | |
sol = solve(prob, opt, NumDimensions=2, FitnessScheme=ParetoFitnessScheme{2}(is_minimizing=true)) |
return [f1, f2] | ||
end | ||
initial_guess = [1.0, 1.0] | ||
function gradient_multi_objective(x, p=nothing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this isn't used please remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is used in the MultiObjectiveOptimizationFunction call below and is passed as the jac arg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But Evolutionary doesn't need derivatives right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ParasPuneetSingh bump
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah just checked the testing once again and it is not needed, so will remove it.
npartitions = 100 | ||
|
||
# reference points (Das and Dennis's method) | ||
weights = gen_ref_dirs(nobjectives, npartitions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is missing here
@ParasPuneetSingh please take a look at the review above |
Added required packages for MOO docs.
added required packages for MOO
Corrected function names for MOO docs.
Removed unnecessary FowardDiff function.
Can you rebase on master there was an incorrect compat there that made the docs environment fail here I have updated it |
Added the package for the algorithms.
@@ -67,3 +67,21 @@ prob = Optimization.OptimizationProblem(f, x0, p, lb = [-1.0, -1.0], ub = [1.0, | |||
sol = solve(prob, BBO_adaptive_de_rand_1_bin_radiuslimited(), maxiters = 100000, | |||
maxtime = 1000.0) | |||
``` | |||
|
|||
## Multi-objective optimization | |||
The optimizer for Multi-Objective Optimization is `BBO_borg_moea()`. Your objective function should return a tuple of the objective values and you should indicate the fitness scheme to be (typically) Pareto fitness and specify the number of objectives. Otherwise, the use is similar, here is an example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a tuple? That is not going to scale well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah corrected that mistake to vector, the struct uses a vector of objective functions.
end | ||
mof = MultiObjectiveOptimizationFunction(multi_obj_func) | ||
prob = Optimization.OptimizationProblem(mof, u0; lb = [0.0, 0.0], ub = [2.0, 2.0]) | ||
sol = solve(prob, opt, NumDimensions=2, FitnessScheme=ParetoFitnessScheme{2}(is_minimizing=true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NumDimensions
, FitnessScheme
, those don't match Julia style.
function func(x, p=nothing)::Vector{Float64} | ||
f1 = (1.0 - x[1])^2 + 100.0 * (x[2] - x[1]^2)^2 # Rosenbrock function | ||
f2 = -20.0 * exp(-0.2 * sqrt(0.5 * (x[1]^2 + x[2]^2))) - exp(0.5 * (cos(2π * x[1]) + cos(2π * x[2]))) + exp(1) + 20.0 # Ackley function | ||
return [f1, f2] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's an array now? Is there an in-place form?
# In this example, we have no constraints | ||
gx = [0.0] # Inequality constraints (not used) | ||
hx = [0.0] # Equality constraints (not used) | ||
return [f1, f2], gx, hx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now a third API?
Added evolutionary to the package.
updated algorithm call.
Correction of changeing tuple to vector.
function multi_obj_func(x, p) | ||
f1 = (1.0 - x[1])^2 + 100.0 * (x[2] - x[1]^2)^2 # Rosenbrock function | ||
f2 = -20.0 * exp(-0.2 * sqrt(0.5 * (x[1]^2 + x[2]^2))) - exp(0.5 * (cos(2π * x[1]) + cos(2π * x[2]))) + exp(1) + 20.0 # Ackley function | ||
return (f1, f2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you didn't actually change it though?
corrected algorithm calls.
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
Add any other context about the problem here.