Skip to content

Commit

Permalink
Merge pull request #20 from sstroemer/rework-addons
Browse files Browse the repository at this point in the history
Main feature is the rework of addons, which includes proper refactors of "Expressions", a new component type ("Virtuals") as well as various clean-ups, changes, and improvements that may be breaking. Since we are moving to 1.11 with this, which forces a few breaking changes anyway, this felt like the right time including all this.
  • Loading branch information
sstroemer authored Nov 19, 2024
2 parents 32f6d3e + 7105938 commit fa707a1
Show file tree
Hide file tree
Showing 198 changed files with 184,412 additions and 2,210 deletions.
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

0 comments on commit fa707a1

Please sign in to comment.