Skip to content

Commit aa493af

Browse files
Merge pull request #87 from holgerteichgraeber/dev
v0.4.0. Updated ClustResult struct and related functions. See NEWS.md for details.
2 parents 486f369 + 40c3466 commit aa493af

File tree

17 files changed

+648956
-17610
lines changed

17 files changed

+648956
-17610
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
script:
2020
- julia --project=test/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
2121
- julia --project=test/ test/clustering.jl
22-
- julia --project=test/ test/capacityexpansion.jl
22+
- julia --project=test/ test/test_workflow_introduction.jl
2323
after_success:
2424
- stage: "Documentation"
2525
julia: 1.0

NEWS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
ClustForOpt release notes
2+
=========================
3+
4+
Version 0.4.0
5+
-------------
6+
7+
Breaking changes
8+
9+
- The `ClustResult` struct has been renamed to `AbstractClustResult`.
10+
- The `ClustResultBest` struct has been renamed to `ClustResult`.
11+
- The structs `ClustResult` and `ClustResultAll` have had several field names renamed: `best_results` to `clust_data`, `best_cost` to `cost`, `clust_config` to `config`. The fields `data_type` and `best_ids` have been removed, because they are already contained explicitly (`k_ids`) or implicitly(call `data_type(data::ClustData)`) in `ClustData`.
12+
- The field names `centers, weights, clustids, cost, iter` in `ClustResultAll` have been renamed, all have now the ending `_all` to indicate that these are the results for all random initializations of the clustering algorithm.

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ keywords = ["clustering", "JuMP", "optimization"]
44
license = "MIT"
55
desc = "julia implementation of using different clustering methods for finding representative periods for the optimization of energy systems"
66
author = ["Holger Teichgraeber"]
7-
version = "0.3.4"
7+
version = "0.4.0"
88

99
[deps]
1010
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE)
66
[![Build Status](https://travis-ci.com/holgerteichgraeber/ClustForOpt.jl.svg?token=HRFemjSxM1NBCsbHGNDG&branch=master)](https://travis-ci.com/holgerteichgraeber/ClustForOpt.jl)
77

8-
ClustForOpt is a [julia](www.juliaopt.com) implementation of clustering methods for finding representative periods for the optimization of energy systems. The package furthermore provides a multi-node capacity expansion model.
8+
ClustForOpt is a [julia](www.juliaopt.com) implementation of clustering methods for finding representative periods for the optimization of energy systems. The package can be used in conjunction with the multi-node capacity expansion model [CapacityExpansion](https://github.com/YoungFaithful/CapacityExpansion.jl).
99

1010
The package has two main purposes: 1) Provide a simple process of clustering time-series input data, with clustered data output in a generalized type system 2) provide an interface between clustered data and optimization problem.
1111

@@ -38,6 +38,8 @@ add ClustForOpt
3838
```
3939
where `]` opens the julia package manager.
4040

41+
**See [NEWS](NEWS.md) for significant breaking changes when updating from one version of ClustForOpt to another.**
42+
4143
## Documentation
4244
[Stable](https://holgerteichgraeber.github.io/ClustForOpt.jl/stable)
4345

@@ -50,6 +52,8 @@ Generally, the workflow requires three steps:
5052
- clustering
5153
- optimization
5254

55+
An example workflow with examples on how to use the different functions can be found in [`examples/workflow_introduction.jl`](examples/workflow_introduction.jl)
56+
5357
```julia
5458
using ClustForOpt
5559

@@ -102,4 +106,4 @@ For use of DTW barycenter averaging (DBA) and k-shape clustering on single-attri
102106
### Optimization
103107
The function `run_opt()` runs the optimization problem and gives as an output a struct that contains optimal objective function value, decision variables, and additional info. The `run_opt()` function infers the optimization problem type from the input data. See the examples folder for further details.
104108

105-
A Capacity Expansion Optimization Problem that utilizes `ClustForOpt` can be found in the package [CEP](https://github.com/YoungFaithful/CEP.jl).
109+
A Capacity Expansion Optimization Problem that utilizes `ClustForOpt` can be found in the package [CapacityExpansion](https://github.com/YoungFaithful/CapacityExpansion.jl).

data/TS_GER_18/solar.csv

Lines changed: 324361 additions & 8761 deletions
Large diffs are not rendered by default.

data/TS_GER_18/wind.csv

Lines changed: 324361 additions & 8761 deletions
Large diffs are not rendered by default.

docs/src/clust.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,15 @@ FullInputData
2929
ClustData
3030
ClustDataMerged
3131
ClustResultAll
32-
ClustResultBest
33-
ClustResultSimple
32+
ClustResult
3433
```
3534

3635
## Example running clustering
3736
```@example
3837
using ClustForOpt
3938
# load ts-input-data
4039
ts_input_data = load_timeseries_data(normpath(joinpath(@__DIR__,"..","..","data","TS_GER_1")); T=24, years=[2016])
41-
ts_clust_data = run_clust(ts_input_data).best_results
40+
ts_clust_data = run_clust(ts_input_data).clust_data
4241
using Plots
4342
plot(ts_clust_data.data["solar-germany"], legend=false, linestyle=:solid, width=3, xlabel="Time [h]", ylabel="Solar availability factor [%]")
4443
savefig("clust.svg")

examples/workflow_example_bat.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ end
1717

1818
# optimization
1919

20-
opt_res = run_opt("battery",clust_res_ar[2].best_results)
21-
#opt_res = run_opt("gas_turbine",clust_res.best_results[5])
20+
opt_res = run_opt("battery",clust_res_ar[2].clust_data)
21+
#opt_res = run_opt("gas_turbine",clust_res.clust_data[5])
2222

2323
###
2424
# run optimization for all k=1:9
2525
opt_res_all = []
2626
obj=[]
2727
for i=1:2
28-
push!(opt_res_all,run_opt("battery", clust_res_ar[i].best_results))
28+
push!(opt_res_all,run_opt("battery", clust_res_ar[i].clust_data))
2929
push!(obj,opt_res_all[i].obj)
3030
end
3131
# run reference case

examples/workflow_example_extr.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ ts_input_data = load_timeseries_data(data_path; T=24, years=[2015])
1818
ts_clust_res = run_clust(ts_input_data_mod;method="kmeans",representation="centroid",n_init=10,n_clust=5) # default k-means
1919

2020
# representation modification
21-
ts_clust_extr = representation_modification(extr_vals,ts_clust_res.best_results)
21+
ts_clust_extr = representation_modification(extr_vals,ts_clust_res.clust_data)

examples/workflow_introduction.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ end
6666
#############
6767
# Quick example and investigation of the best result:
6868
ts_clust_result = run_clust(ts_input_data; method="kmeans", representation="centroid", n_init=5, n_clust=5) # note that you should use n_init=1000 at least for kmeans.
69-
ts_clust_data = ts_clust_result.best_results
69+
ts_clust_data = ts_clust_result.clust_data
7070
# And some plotting:
7171
plot_comb_solar=plot!(plot_input_solar, ts_clust_data.data["solar-germany"], linestyle=:solid, width=3)
7272
plot_clust_soar=plot(ts_clust_data.data["el_demand-germany"], legend=false, linestyle=:solid, width=3, xlabel="Time [h]", ylabel="Solar availability factor [%]")

0 commit comments

Comments
 (0)