Skip to content
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

Major addon rework #20

Merged
merged 130 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
ded0d97
chore: up Julia version requirement to support new source section in …
sstroemer Oct 11, 2024
35e8721
feat: rework loading of addons
sstroemer Oct 11, 2024
a9379b0
refactor: more generalized handling of external arguments to model cr…
sstroemer Oct 11, 2024
a626876
fix: using Julia 1.11.0 introduced a bug with how we build the docstr…
sstroemer Oct 11, 2024
ba02d3d
chore: change note regarding REPL inclusion; seems like we might need…
sstroemer Oct 11, 2024
3f7ac96
feat: add basic implementation of Base.show for CoreComponents
sstroemer Oct 11, 2024
da281c9
feat: properly re-introduce tagging feature and allow accessing
sstroemer Oct 11, 2024
0206319
fix: remove explicit name from Base.show
sstroemer Oct 11, 2024
d5a2dcd
chore: remove deprecated filter_component
sstroemer Oct 11, 2024
a660eec
fix: include "get_" prefix for component getter
sstroemer Oct 11, 2024
d13eb9e
feat: introduce "Virtual" as CoreComponent type, to allow accessing "…
sstroemer Oct 11, 2024
b5072ab
fix: logging error
sstroemer Oct 11, 2024
a282812
refactor: build_priority < 0 means a component will be skipped (used …
sstroemer Oct 11, 2024
29c1a13
feat: remove functionality linked to component-bound addons
sstroemer Oct 11, 2024
a05faa6
feat: allow accessing the Virtual component that a template is bound …
sstroemer Oct 11, 2024
199f4cd
chore: formatting
sstroemer Oct 11, 2024
4d1d32c
chore: update test environment
sstroemer Oct 11, 2024
8cd9359
feat: renaming public function from "component" to "get_component"
sstroemer Oct 11, 2024
1cbfc3c
chore: adjust a Base.show
sstroemer Oct 11, 2024
838aafa
fix: leftover "component"
sstroemer Oct 11, 2024
6d70239
fix: rely on JSON to re-stringify parameter values that YAML "messes …
Oct 14, 2024
82f266e
fix: cleanup how users can call "object oriented" functions in templates
Oct 14, 2024
8ef61dc
fix: update docstring of @check
Oct 16, 2024
10c93ce
fix: wrong "self" accessor in finalize and validate of templates
Oct 16, 2024
2de26bb
fix: make iesopt_model field in ModelWrapper "private"
Oct 16, 2024
c9461d0
refactor: access the internal iesopt_model of a ModelWrapper with "raw"
Oct 16, 2024
34a5f9e
fix: unify model wrapping in all template functions, mirroring how it…
Oct 16, 2024
f45da9f
refactor: retire "add_result" since we can now manually register ever…
Oct 16, 2024
b1b9c63
fix: remove ModelWrapper (all utilities will be handled by IESU)
Oct 18, 2024
937acfd
feat: add `timespan` and `yearspan` to IESU
Oct 18, 2024
161e148
feat: Virtuals now allow tracking their own parameters, and allow pro…
Oct 18, 2024
6c7faec
fix: streamline error severity to improve user experience for errors …
Oct 18, 2024
5b41e81
fix: remove left-over include
Oct 18, 2024
5a83e58
feat: allow storing multiple finalizer function for a single Virtual,…
Oct 18, 2024
7702563
docs: update Julia version in docs CI to comply with core
sstroemer Oct 23, 2024
e9378ad
feat: each Virtual now keeps a reference to its template; CoreTemplat…
Oct 25, 2024
3fa2526
Merge branch 'ait-energy:main' into rework-addons
sstroemer Oct 28, 2024
a89e12b
test: update env
sstroemer Oct 30, 2024
cb83f89
chore: add JuliaSyntax for parsing expressions
sstroemer Oct 30, 2024
82fa670
feat: initial rework of the internal Expression type to handle more c…
sstroemer Oct 30, 2024
fad0224
Merge branch 'main' into rework-addons
Nov 1, 2024
32018a6
chore: minor update to precompile workload
Nov 4, 2024
f58c46a
feat: major changes that were messy to split up
Nov 4, 2024
334e312
chore: updated docstrings and refactor public API slightly
Nov 4, 2024
17a5a99
fix: misplaced brace
sstroemer Nov 5, 2024
7543428
fix: fix finalizers to be functions, disallowing callable types
sstroemer Nov 5, 2024
445ade9
chore: formatting
sstroemer Nov 5, 2024
ccf0ab0
docs: fix math section alignment
sstroemer Nov 5, 2024
b06c73e
docs: fix entry of get_component
sstroemer Nov 5, 2024
3c09864
docs: update dynamic doc creation to 1.11
sstroemer Nov 5, 2024
81d79d3
docs: improve "how to" link
sstroemer Nov 5, 2024
e1c4d09
fix: typos in docstrings
sstroemer Nov 5, 2024
e965950
feat: add proper version tracking (also as part of the top-level config)
sstroemer Nov 5, 2024
8ff02bd
fix: rename function to prevent wrongful inclusion in docs
sstroemer Nov 5, 2024
a3c8ef9
feat: remove IESoptLib and integrate its functionality into "Assets" …
sstroemer Nov 5, 2024
1086344
assets: add initial set of assets from "old" IESoptLib (based on comm…
sstroemer Nov 5, 2024
ba2bff2
chore: move dependencies into separate file
sstroemer Nov 5, 2024
e41e0e6
test: integrate test item framework
sstroemer Nov 5, 2024
3535233
test: fix imports
sstroemer Nov 5, 2024
bdccfc8
chore: remove stale dependency (texify currently not active)
sstroemer Nov 5, 2024
023106f
chore: formatting
sstroemer Nov 5, 2024
ad7c65e
fix: fix error in test
sstroemer Nov 5, 2024
a1608ac
fix: problems identified by typing
sstroemer Nov 5, 2024
8aaa92a
test: refactor example tests
sstroemer Nov 5, 2024
437ed18
test: return model in "check" to allow chaining further tests
sstroemer Nov 5, 2024
7134cd4
fix: wrong access to internals after moving from template function in…
sstroemer Nov 5, 2024
d3397ab
test: fix and improve test for non_core example (16)
sstroemer Nov 5, 2024
20f1bc3
fix: type checks when parsing Units
sstroemer Nov 5, 2024
f08c2ec
feat: make "_base_name" a public function as "make_base_name" for imp…
sstroemer Nov 5, 2024
e64c5c1
chore: formatting
sstroemer Nov 5, 2024
49325ad
test: update addon example (18) to new addon syntax and improve test
sstroemer Nov 5, 2024
e215438
chore: better logging for template loading
sstroemer Nov 5, 2024
2056984
test: fix CHP example (20, addon based) and improve tests
sstroemer Nov 5, 2024
1b894ac
test: fix XOR example (31), test working again
sstroemer Nov 6, 2024
5429187
fix: wrong component type for Virtuals and errors when trying to Base…
sstroemer Nov 6, 2024
b7f3575
test: fix imports
sstroemer Nov 6, 2024
3a9890a
chore: remove comments
sstroemer Nov 6, 2024
09b340e
test: ignore output files
sstroemer Nov 6, 2024
51b8b43
fix: typing related issues around non-numeric unit count
sstroemer Nov 6, 2024
a71f11e
doc: fix public API and missing docstrings
sstroemer Nov 6, 2024
e2e7515
test: add "all docstrings exist" as test
sstroemer Nov 6, 2024
6a1190d
chore: bump julia version to 1.11 in documentation CI workflow
sstroemer Nov 6, 2024
b0491bc
fix: wrong "memory_only" setting in examples
Nov 7, 2024
8cd7456
BREAKING: memory_only now defaults to true, and the included result m…
Nov 7, 2024
8219ec4
fix: log naming - normal log is now "*.iesopt.log", solver log is now…
Nov 7, 2024
006f28f
chore: formatting
Nov 7, 2024
e194083
fix: wrong interaction between non-container templates and functions/…
Nov 12, 2024
3890270
fix: improve expression typing
Nov 13, 2024
b283b70
feat: add initial working version of DuckDB based result extraction b…
Nov 13, 2024
21b9fc8
fix: slight modification in typing of constraint refs
Nov 13, 2024
a75f5b7
feat: allow specifying `backend` (jld2 or duckdb) in results section …
sstroemer Nov 16, 2024
b5dcdba
feat: initial rework to use duckdb as default result backend
sstroemer Nov 16, 2024
ec71bd7
fix: missing check
sstroemer Nov 16, 2024
a0b2669
feat: implement trace-based precompilation using precompile statement…
sstroemer Nov 16, 2024
4e4a680
chore: formatting
sstroemer Nov 16, 2024
4e68edb
fix: typos
sstroemer Nov 16, 2024
5b87a60
test: update env
sstroemer Nov 16, 2024
89ef2f9
unfinished: EOD commit containing most of the config/kwargs rework; r…
Nov 17, 2024
8363dd5
assets: rename example
Nov 18, 2024
6bb099d
chore: formatting and some small typo fixes
Nov 18, 2024
5fbbdb3
fix: spelling
Nov 18, 2024
0bb856e
fix: missing docstrings and public api
Nov 18, 2024
e8e42f5
fix: potential name leaking
Nov 18, 2024
90dfbb2
fix: update depreciation warning for [:iesopt] access
Nov 18, 2024
c4fdd90
fix: stack overflow with access to deprecated internals; add basic sh…
Nov 18, 2024
7941a95
fix: bug in analysing templates introduced by move to "internal(...)"
Nov 18, 2024
c70cb57
fix: update show
Nov 18, 2024
49632a8
fix: disable (currently not available) profiling logs
Nov 18, 2024
4e97417
chore: formatting
Nov 18, 2024
49976d7
feat: remove precompilation detection from config
Nov 18, 2024
5df1e12
feat: include more examples in the precompilation section
Nov 18, 2024
d180842
fix: check verbosity before warning about missing version section
Nov 18, 2024
875711d
chore: small fixes
Nov 18, 2024
94ba77b
fix: default to jld2 until duckdb is fully supported in python
Nov 18, 2024
d181cd6
chore: small fixes
Nov 18, 2024
b83f4a7
fix: all tests passing
Nov 19, 2024
f15e969
test: fix and re-enable testing example 48
Nov 19, 2024
f1d9c75
fix: detect and report unexpected config sections
Nov 19, 2024
480eeb3
fix: skip validation in parts of precompilation
Nov 19, 2024
8d63851
assets: update all examples to include version specification
Nov 19, 2024
de5116b
ci: threshold for patches in PRs
Nov 19, 2024
22b5e91
chore: formatting
Nov 19, 2024
fdbf4da
feat: properly detect (deprecated) return values of addon functions (…
Nov 19, 2024
accc667
chore: update dependencies, bump to 2.0.0
Nov 19, 2024
ea2089d
fix: add preocommit file
Nov 19, 2024
f0ee235
fix: spelling mistakes (using codespell)
Nov 19, 2024
eec0073
test: fix tests and add safeguards for file removal
Nov 19, 2024
4d11d9c
test: disable JET (for now; extensive time and currently passing) and…
Nov 19, 2024
c647e9f
test: remove test example 30, since it was failing in CI (proper brok…
Nov 19, 2024
7105938
test: re-enable logging output in tests to detect CI error
Nov 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .codespell-ignore-words.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
inout
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.10'
- '1.11'
os:
- ubuntu-latest
arch:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@latest
with:
version: '1.10'
version: '1.11'
- uses: julia-actions/cache@v2
- name: Configure doc environment
shell: julia --project=docs --color=yes {0}
Expand Down
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
repos:
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
files: ^.*\.(jl|md|yaml)$
args: ["--ignore-words=.codespell-ignore-words.txt"]

ci: # https://pre-commit.ci/
autofix_prs: false
autoupdate_schedule: weekly
18 changes: 12 additions & 6 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
name = "IESopt"
uuid = "ed3f0a38-8ad9-4cf8-877e-929e8d190fe9"
version = "1.0.5"
version = "2.0.0"

[deps]
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DuckDB = "d2f5444f-75bc-4fdf-ac35-56f514c445e1"
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
IESoptLib = "b98f706d-40ec-4ce6-a66c-1c6e71d3cef6"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
JuliaSyntax = "70703baa-626e-46a2-a12c-08ffd08c73b4"
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
MultiObjectiveAlgorithms = "0327d340-17cd-11ea-3e99-2fd5d98cecda"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
RelocatableFolders = "05181044-ff0b-4ac5-8273-598c1e38db00"
RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
Tectonic = "9ac5f52a-99c6-489f-af81-462ef484790f"
TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe"
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea"

Expand All @@ -51,28 +54,31 @@ CSV = "0.10"
Cbc = "1.2.0"
DataFrames = "1.6"
Dates = "<0.0.1,1"
DuckDB = "1.1.0"
GLPK = "1.2.1"
Gurobi = "1.3.0"
HiGHS = "1.9"
IESoptLib = "0.3"
Ipopt = "1.6.2"
JLD2 = "0.4, 0.5"
JSON = "0.21"
JuMP = "1.22"
JuliaSyntax = "0.4.10"
LibGit2 = "<0.0.1,1"
Logging = "<0.0.1,1"
LoggingExtras = "1.0"
MacroTools = "0.5.13"
Markdown = "<0.0.1,1"
MultiObjectiveAlgorithms = "1.3"
OrderedCollections = "1.6"
Pkg = "1.10"
PrecompileTools = "1.2"
Printf = "<0.0.1,1"
ProgressMeter = "1.10"
RelocatableFolders = "1.0.1"
RuntimeGeneratedFunctions = "0.5.13"
SCIP = "0.11.14"
Suppressor = "0.2"
Tectonic = "0.8"
TestItems = "1.0.0"
YAML = "0.4"
ZipFile = "0.10"
julia = "1.10"
julia = "1.11"
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ poetry add iesopt

## Usage

IESopt requires a configured model to run. You can start with the extensive [first model tutorial](https://ait-energy.github.io/IESopt.jl/dev/pages/tutorials/first_model/), or checkout [IESoptLib](https://github.com/ait-energy/IESoptLib.jl) which
includes many more examples.
IESopt requires a configured model to run. You can start with the extensive [first model tutorial](https://ait-energy.github.io/IESopt.jl/dev/pages/tutorials/first_model/).

### Basic usage

Expand All @@ -101,7 +100,7 @@ Steps 1. and 2. can be combined in a single call, which the convenience function
using IESopt

model = IESopt.run("config.iesopt.yaml")
results = model.ext[:iesopt].results
results = model.ext[:_iesopt].results
```

#### Using Python
Expand Down Expand Up @@ -133,7 +132,7 @@ IESopt.generate!(filename::String)
IESopt.optimize!(model::JuMP.Model; save_results::Bool=true, kwargs...)

"""Build, optimize, and return a model, in a single call."""
IESopt.run(filename::String; verbosity=nothing, kwargs...)
IESopt.run(filename::String; kwargs...)

"""Get the component with the name `component_name` from the `model`."""
IESopt.get_component(model::JuMP.Model, component_name::String)
Expand Down
3 changes: 3 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ coverage:
target: auto
threshold: 0%
base: auto
patch:
default:
threshold: 0%

comment:
layout: "diff, flags, files"
Expand Down
8 changes: 3 additions & 5 deletions docs/generate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@ end

# This defines the order of the menu / page structure.
examples_files = [
# file[1:(end - 3)] for
# file in readdir(normpath(@__DIR__, "src", "pages", "user_guide", "examples")) if endswith(file, ".md")
# file[1:(end - 3)] for
# file in readdir(normpath(@__DIR__, "src", "pages", "user_guide", "examples")) if endswith(file, ".md")
]

_PAGES = Pair["Home" => "index.md"]
append!(
_PAGES,
_build_page_paths(
[
"Tutorials" => [
"templates_1",
],
"Tutorials" => ["templates_1"],
"Manual / Reference" => ["core_components", "api"],
"Developer Documentation" => "dev_docs",
"Changelog" => "changelog",
Expand Down
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if is_local_draft
import Revise
Revise.revise()
catch
@warn "Building documentation without Revise support. If you want to automatically refresh docstrings from withing IESopt.jl, you need Revise installed."
@warn "Building documentation without Revise support. If you want to automatically refresh docstrings from within IESopt.jl, you need Revise installed."
end
end

Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/dev_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Documenter.jl (as of May, 22nd, 2024) aggressively states: _"Documenter, like an
Unfortunately, [semantic versioning](https://semver.org/) may not be as well suited as one might think for a package like IESopt.jl. Some reasons are:

- While the (Julia) API has been stable for a long time (in a sense of: backwards-compatible), we consider the YAML configuration syntax as main part of IESopt's "API". This syntax has changed multiple times, and will likely change in the future. Maintaining full backwards compatibility for this is not feasible all the time. This induces a need for a major version bump, even though the Julia API has not changed.
- A mere bug fix, even a small one, in IESopt.jl may very likely induce changed results of any model run. A user could see vastly different results between `v1.3.10` and `v1.3.11`, even though the changes are minimal. This envolves not taking patch updates lightly, which is not the case in many other packages.
- A mere bug fix, even a small one, in IESopt.jl may very likely induce changed results of any model run. A user could see vastly different results between `v1.3.10` and `v1.3.11`, even though the changes are minimal. This involves not taking patch updates lightly, which is not the case in many other packages.

However, as indicated, the use of semantic versioning is still "expected" by large parts of the Julia community, and not doing so may make it harder for some users, and/or some interactions with other packages. So...

Expand Down Expand Up @@ -136,7 +136,7 @@ We provide a custom `.JuliaFormatter.toml` file that should be used to format th
2. Run `using JuliaFormatter` in the Julia REPL (this now works even if you activated the IESopt environment).
3. Run `format(".")` in the Julia REPL to format all files in your current directory. This takes a bit of compile time, but after the first run, it should be fairly fast.

Make sure you checked the formatting, before finalizing your changes or opening a PR. If you forgot to include formatting in your actual commits (we all do...), and cannot reasonably ammend them, add **all** formatting changes at the end in a single commit with the message:
Make sure you checked the formatting, before finalizing your changes or opening a PR. If you forgot to include formatting in your actual commits (we all do...), and cannot reasonably amend them, add **all** formatting changes at the end in a single commit with the message:

```console
git commit -m "chore: formatting"
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/manual___reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ optimize!
```

```@docs; canonical=true
component
get_component
```

```@docs; canonical=true
Expand Down
6 changes: 3 additions & 3 deletions docs/src/pages/tutorials/templates_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ use of the existing `CoreComponent`s, and combines them in multiple ways, which
without having to write any mathematical model yourself.

This tutorial will guide you through the process of creating a new template, and we will do that on the example of
creating the `HeatPump` template (a template shipped via IESoptLib).
creating the `HeatPump` template.

## The basic structure

A template is defined by a YAML file, similar to the `config.iesopt.yaml` file that you already know. First, we need to
think about the parameters that we want to define for our heat pump. Let's create a new file for that. The pre-defined
one in IESoptLib is called `HeatPump`, so we need a different name: Templates must always have a unique name.
one is called `HeatPump`, so we need a different name: Templates must always have a unique name.

Possiblities for that could be:
Possibilities for that could be:

- `CustomHeatPump`, if you do not have any more details
- `GroundSourceHeatPump`, if we want to implement a ground-source heat pump with different parameters/features than the
Expand Down
1 change: 0 additions & 1 deletion ext/OptExtSCIP/OptExtSCIP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ function IESopt._setoptnow(model::JuMP.Model, ::Val{:SCIP}, moa::Bool)
return nothing
end


end
Loading
Loading