Skip to content

Conversation

mkg33
Copy link
Contributor

@mkg33 mkg33 commented Jan 7, 2021

I tried to add a custom output struct that would fit the output of the respective optimizers. Some choices are probably less than perfect and several are quite arbitrary - comments more than welcome!

mkg33 added 4 commits January 7, 2021 17:38
I tried to add a custom output struct that would fit the output of the respective optimizers. Some choices are probably less than perfect and several are quite arbitrary - comments more than welcome.
I didn't notice that the default value of maxiters had changed.
src/solve.jl Outdated
@@ -1,3 +1,32 @@
abstract type OptimizationResults end #experimental; comments welcome
mutable struct GalacticOptimizationResults{O, Tx, Tf, Tls, Tsb} <: OptimizationResults
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it singular?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To match the naming of our other things, I think we'd do OptimizationSolution. Then down the line (not right now, need to do a few things), make it a AbstractNoTimeSolution where the minimizer is .u.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. I've corrected it now but there seems to be a problem with the tests. I've checked everything before submitting and it works fine. The failure trace complains about maxiters in the CMAES test. I tested all the CMAE algorithms manually and they give a normal output. Could it be that the test itself is faulty?

@Vaibhavdixit02
Copy link
Member

@mkg33 what's the status here?

@mkg33
Copy link
Contributor Author

mkg33 commented Jan 18, 2021

Sorry @Vaibhavdixit02 , I was convinced I'd already updated it. Will do so immediately! Thanks for the review.

@ChrisRackauckas
Copy link
Member

Let's try to get tests passing and this merged. We can keep improving, but I think it's already an improvement.

@Vaibhavdixit02
Copy link
Member

@mkg33
Copy link
Contributor Author

mkg33 commented Jan 25, 2021

@Vaibhavdixit02 I just added Evolutionary's results to the struct. Now I need to figure out why it's still failing...

@ChrisRackauckas
Copy link
Member

Another failure

@mkg33
Copy link
Contributor Author

mkg33 commented Jan 26, 2021

OK, I've analyzed the results and here is what I think:

First error:

SAMIN results

NO CONVERGENCE: MAXEVALS exceeded



     Obj. value:           0.25297



       parameter      search width

         0.76667           1.80000 

         0.63234           1.80000 

================================================================================

Rosenbrock: Test Failed at /home/runner/work/GalacticOptim.jl/GalacticOptim.jl/test/rosenbrock.jl:15

  Expression: 10 * sol.minimum < l1

   Evaluated: 2.529727553950069 < 1.0

This is SAMIN but the output struct has nothing to do with it. It uses the native Optim output anyway. I'm not sure if my changes could influence the solution (?) Perhaps I just can't see it properly.

So I just ran the (rosenbrock.jl) test locally and got:

================================================================================
SAMIN results
NO CONVERGENCE: MAXEVALS exceeded

     Obj. value:           0.05501

       parameter      search width
         0.78057           1.80000 
         0.60101           1.80000 
================================================================================
(3_w,6)-aCMA-ES (mu_w=2.0,w_1=64%) in dimension 2 (seed=754202324884189315, 2021-01-26T00:52:56.255)
  iter   fevals   function value      sigma  axis ratio   time[s]
     1        6   1.51083168e+00   8.38e-02   1.346e+00     0.819
     2       12   1.67395336e+00   6.22e-02   1.679e+00     0.899
     3       18   1.03983924e+00   6.73e-02   2.037e+00     0.901
    96      576   4.00000000e-02   1.27e-04   8.296e+00     0.917
(3_w,6)-aCMA-ES (mu_w=2.0,w_1=64%) in dimension 2 (seed=754202324884189315, 2021-01-26T00:52:56.355)
  termination reason: ftol = 1.0e-11 (2021-01-26T00:52:56.356)
  lowest observed function value: 0.04000000000002317 at [0.7999999999996565, 0.6400000383058826]
  population mean: [0.799999999999618, 0.6399999972997753]


================================================================================
SAMIN results
NO CONVERGENCE: MAXEVALS exceeded

     Obj. value:           0.06873

       parameter      search width
         0.74635           1.80000 
         0.55041           1.80000 
================================================================================
WARNING: using BlackBoxOptim.OptimizationProblem in module Main conflicts with an existing identifier.
Starting optimization with optimizer DiffEvoOpt{FitPopulation{Float64},RadiusLimitedSelector,BlackBoxOptim.AdaptiveDiffEvoRandBin{3},RandomBound{ContinuousRectSearchSpace}}
0.00 secs, 0 evals, 0 steps

Optimization stopped after 10001 steps and 0.09 seconds
Termination reason: Max number of steps (10000) reached
Steps per second = 115699.91
Function evals per second = 112807.70
Improvements/step = 0.43360
Total function evaluations = 9751


Best candidate found: [0.8, 0.64]

Fitness: 0.040000000

Test Passed

@ChrisRackauckas
Copy link
Member

is there any randomness there?

@mkg33
Copy link
Contributor Author

mkg33 commented Jan 26, 2021

That seems to be the case... I keep getting pretty varying results whenever I run the tests. So far I've had probably 10-15 different values. As in, really different, not just a matter of fractions.

@mkg33
Copy link
Contributor Author

mkg33 commented Jan 26, 2021

As regards the second error, it was the package resolver. I'm not sure if I had anything to do with this (?) I really don't know if outdated local versions (if they exist) might negatively influence GalacticOptim.jl.

@ChrisRackauckas
Copy link
Member

That's not you. That's @DhairyaLGandhi needing to tag Flux for Reexport 1.0

@mkg33
Copy link
Contributor Author

mkg33 commented Jan 26, 2021

Phew :-)

@codecov
Copy link

codecov bot commented Jan 26, 2021

Codecov Report

Merging #101 (17bed8c) into master (153cb5e) will decrease coverage by 3.01%.
The diff coverage is 54.54%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #101      +/-   ##
==========================================
- Coverage   87.25%   84.23%   -3.02%     
==========================================
  Files           3        3              
  Lines         361      387      +26     
==========================================
+ Hits          315      326      +11     
- Misses         46       61      +15     
Impacted Files Coverage Δ
src/solve.jl 78.06% <54.54%> (-3.83%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 153cb5e...17bed8c. Read the comment docs.

@ChrisRackauckas ChrisRackauckas merged commit 82f19ee into SciML:master Jan 26, 2021
mutable struct OptimizationSolution{O, Tx, Tf, Tls, Tsb} <: AbstractOptimizationSolution
method::O
initial_x::Tx
minimizer::Tx
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should have a getproperty for this to be .u to match the others.

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

Successfully merging this pull request may close these issues.

3 participants