Skip to content

Commit

Permalink
Tutorial fixes #698
Browse files Browse the repository at this point in the history
Fix formatting and rendering of images in tutorials 3, 5, 6, and 8 to address issue #697.
  • Loading branch information
mmutic authored Jun 17, 2024
1 parent 9fa7257 commit 7847a5a
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 17 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Fixed
- Fix formatting and images in tutorials 3, 5, 6, and 8 to address issue #697 (#698)

### Added
- Add objective scaler for addressing problem ill-conditioning (#667)

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GenX"
uuid = "5d317b1e-30ec-4ed6-a8ce-8d2d88d7cfac"
authors = ["Bonaldo, Luca", "Chakrabarti, Sambuddha", "Cheng, Fangwei", "Ding, Yifu", "Jenkins, Jesse D.", "Luo, Qian", "Macdonald, Ruaridh", "Mallapragada, Dharik", "Manocha, Aneesha", "Mantegna, Gabe ", "Morris, Jack", "Patankar, Neha", "Pecci, Filippo", "Schwartz, Aaron", "Schwartz, Jacob", "Schivley, Greg", "Sepulveda, Nestor", "Xu, Qingyu", "Zhou, Justin"]
version = "0.4.0"
version = "0.4.0-dev.1"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ using Plots
using Clustering
using ScikitLearn
@sk_import datasets: (make_blobs)
```

```julia
case = joinpath("example_systems/1_three_zones");
Expand Down Expand Up @@ -448,7 +449,7 @@ G2 = Plots.plot(recon[!,:hour], recon[!,:MW], linewidth=1.7,
Plots.plot(G1,G2,layout=(2,1))
```

![svg](./files/t3_recon.svg)
![png](./files/t3_recon.png)

Each color represents one of the representative weeks.

Expand Down Expand Up @@ -624,7 +625,7 @@ scatter!(twinx(),obj_val_plot[:,1],times,color=:red,markeralpha=.5,label=:"Time"
ygrid!(:on, :dashdot, 0.1)
```

![svg](./files/t3_obj_val.svg)
![svg](./files/t3_obj_vals.svg)

Here, we can see that while having very few representative periods produces an objective value that differs greatly from the orignal, once we reach around 12 representative periods the difference begins to taper out. Therefore, the original choice of 11 maximum periods in `1_three_zones` decreases the run time of GenX significantly while while maintaining an objective value close to the original.

Expand Down Expand Up @@ -658,4 +659,5 @@ for folder in folders
if length(folder) >= 7 && folder[1:7] == "results"
rm("example_systems/1_three_zones/" * folder,recursive=true)
end
end```
end
```
4 changes: 1 addition & 3 deletions docs/src/Tutorials/Tutorial_5_solve_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

In Tutorial 4, we went over how the model is generated when GenX is run using `Run.jl`. In the function `run_genx_case_simple` (or multistage), after `generate_model` is called, `solve_model` is called to solve the EP.

```@raw html
<img src="./files/runcase.png" style="width: 805px; height: auto">
```
![png](./files/runcase.png)

In this tutorial, we go over how to use JuMP to solve a model, what it looks like to solve GenX, and how to edit the solver settings.

Expand Down
8 changes: 4 additions & 4 deletions docs/src/Tutorials/Tutorial_6_solver_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ inputs = GenX.load_inputs(setup, case)

### The HiGHS Solver

In the example files, the solver [HiGHS](https://highs.dev). HiGHS is freely available for all to use. Other solvers, such as [Gurobi](https://www.gurobi.com), are available for free for academics. For the purpose of this tutorial, we will be focusing on HiGHS.
In the example files, the solver is [HiGHS](https://highs.dev). HiGHS is freely available for all to use. Other solvers, such as [Gurobi](https://www.gurobi.com), are available for free for academics. For the purpose of this tutorial, we will be focusing on HiGHS.

To set the solver preferences, go into the settings folder of your case and select the YAML file of the solver you're using.

Expand Down Expand Up @@ -93,9 +93,7 @@ highs_settings = YAML.load(open(joinpath(case,"Settings/highs_settings.yml")))

The function `configure_highs` in `src/configure_solver` contains a list of default settings for the HiGHS solver

```@raw html
<img src="./files/highs_defaults.png" style="width: auto; height: 500px" align="left">
```
![png](./files/highs_defaults.png)

There are about 80, so we'll only focus on a few for now. In most cases, you can leave the other settings on default.

Expand Down Expand Up @@ -158,6 +156,8 @@ Plots.scatter(tols[2:end], abs.(OV[2:end] .- OV[1]),legend=:topleft,
ygrid!(:on, :dashdot, 0.1)
```

![svg](./files/t6_tols.svg)

### PreSolve

In optimization, presolve is a stage at the beginning of the solver in which the problem is simplified to remove redunant constraints and otherwise simplify the problem before the optimization itself begins. The default for presolve in GenX is "choose", allowing the solver to use presolve only if it will reduce computation time.
Expand Down
5 changes: 0 additions & 5 deletions docs/src/Tutorials/Tutorial_8_outputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -868,8 +868,3 @@ Finally, set the CO2 Cap back to 2:
genx_settings_TZ["CO2Cap"] = 2
YAML.write_file((joinpath(case,"settings/genx_settings.yml")), genx_settings_TZ)
```


```julia

```
Binary file added docs/src/Tutorials/files/t3_recon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion docs/src/Tutorials/files/t3_recon.svg

This file was deleted.

1 change: 1 addition & 0 deletions docs/src/Tutorials/files/t6_tols.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7847a5a

Please sign in to comment.