Skip to content

Conversation

mattkingros
Copy link
Collaborator

@mattkingros mattkingros commented Oct 15, 2024

Initial pull request during meeting

- Renamed files to better represent uses cases
- changed solve_metric to save output in timedated folder, and name according to choice of lambda
- changed benchemarking to compute over various choices of lamba
- began adding plots
Migrating MATLAB from Nicks' .mlx livescript format to .m filetype
Added PDCO_numerics.m and associated output, saved to .csv files

*potential issue, meet to discuss diagonal scaling in UEG (d1 in pdco.m)
fixed matlab lambda scaling, and deleted extraneous .csv files
Added comments to matlab files to indicate major changes (piggybacking for tracer)

Mistake made with plotting (version control); indicated as TO-DO item
Experimenting with julia OPTIM package to get cost per iteration.

TO-DO: clone and piggback optim repo
Replaced julia Optim module with local version, to piggyback tracer and add function and gradient calls per iteration. Previously obfuscated in the line search subroutine
@mattkingros
Copy link
Collaborator Author

mattkingros commented Oct 16, 2024

Added a local version of the Optim package to numerics folder.
Added piggybacking of tracer.jl for LBFGS for tracking of evaluations of f and grad(f).

To-do: add cg itns tracker to PDCO and plot results on shared axis

Added plotting function, tracking cg iterations.

PDCO not plotted but results saved (prohibitively high number of iterations)
@mattkingros mattkingros changed the title Numerics Folder added for algorithm comparisons Numerics for algorithm comparisons Oct 16, 2024
@mattkingros
Copy link
Collaborator Author

Added plot_results.jl and saved plots in /output folder, comparing by computational cost (matrix multiplications)

  • PDCO not plotted, number of CG iterations is too large (as suspected)
  • Comparison by matrix multiplications looks favorable for KLLS, particularily for small lambda

To-do:

  • test for more values of lambda (log spaced, wider endpoints), plot results on new axis'.
  • split small / large lambda into seperate plots so you can see results clearly.

@mpf
Copy link
Member

mpf commented Oct 16, 2024

Added a local version of the Optim package to numerics folder.

Added piggybacking of tracer.jl for LBFGS for tracking of evaluations of f and grad(f).

To-do: add cg itns tracker to PDCO and plot results on shared axis

Why copy the Optim.jl source code instead of just adding it as a package dependency?

@mattkingros
Copy link
Collaborator Author

mattkingros commented Oct 16, 2024

The Optim.jl package didnt have the tracing options we needed!

Optim's LBFGS only reports functions/gradient values in its trace, even using extended tracer options.
Notably, it doesn't allow the user to trace function/gradient evaluation counts per iteration - and only reports these at termination.

So, ive changed Optim's tracer.jl file to report these per iteration.
(Frustratingly, it was already computing this and much more, like PDCO, but not allowing the user access)

If there is a cleaner way of replacing the default Optim tracer, please let me know!

@mpf
Copy link
Member

mpf commented Oct 16, 2024

@mattkingros Instead of copying in the entire Optim.jl package, I believe it's possible to modify the particular method after doing "using Optim".

For example, here I'm replacing a function inside of a module:

julia> module CoolMod
         hello()="Hello"
         call(x)=hello()
         end
Main.CoolMod

julia> CoolMod.call(1)
"Hello"

julia> CoolMod.hello() = "GoodBye"

julia> CoolMod.call(1)
"GoodBye"

You should be able to do something analogous for the tracer function you wish to modify.

@mattkingros
Copy link
Collaborator Author

@mpf Thanks for the help and MWE!

I'll take a look at this approach first thing tomorrow. If it is a simple override like your example, that would be a great fix.

@mattkingros
Copy link
Collaborator Author

mattkingros commented Oct 17, 2024

@mpf A direct overwrite as you suggested is proving to be more difficult than expected.

Optim uses private types under-the-hood, and so the associated methods are resistant to being overwritten (and are throwing me a mix of "invalid redefinition of constant" and "type not defined" errors which have been unhelpful in finding a solution).

Do you have any time later today/this week for a quick chat to point me in the right direction?
In the meantime; I can clean up the plots with the previous version of the code!

@mattkingros
Copy link
Collaborator Author

  • Repo cleaned up (Optim.jl Source code removed, replaced with forked repo as suggested)
  • Scratch work and plots from Informs meeting saved, but moved to scratch folder.

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.

2 participants