hdrake / OptimizeClimate

MOVED TO http://github.com/ClimateMARGO/ClimateMARGO.jl
http://github.com/ClimateMARGO/ClimateMARGO.jl
1 stars 0 forks source link

Refactoring optimization model into objects #4

Closed hdrake closed 4 years ago

hdrake commented 4 years ago

Before making any more progress, we should probably refactor the notebooks we already have. For example, it will be difficult to effectively tackle Issue https://github.com/hdrake/OptimizeClimate/issues/3 without refactoring the existing code. Some of this structure will come automatically when we swap out my crude gradient-descent optimization code for a more formal optimization package, but we will still need some kind of ClimateModel object to wrap the optimization in. Ideally, this object would hold input parameters, outputs (optimized timeseries of control parameters), diagnostic functions (e.g. for computing CO2, temperature, and costs from timeseries of controls), and plotting functions.

hdrake commented 4 years ago

I'm reading up on julia functions, methods, and constructors and trying to implement some kind of model structure in the branch https://github.com/hdrake/OptimizeClimate/tree/refactor-into-objects, where I am trying to refactor the procedural notebook https://github.com/hdrake/OptimizeClimate/blob/refactor-into-objects/gradient_descent_HFD.ipynb into object-oriented code in https://github.com/hdrake/OptimizeClimate/blob/refactor-into-objects/gradient_descent_objectified.ipynb.

I have a little experience doing this kind of thing with python functions and classes but an fairly new to julia objects so would appreciate guidance.

hdrake commented 4 years ago

Done in https://github.com/hdrake/OptimizeClimate/commit/9c5773099678cf553fb9d958ca3fdb01b9112605