Skip to content

Commit

Permalink
updates to reopt_jl install script
Browse files Browse the repository at this point in the history
  • Loading branch information
lilycatolson committed Nov 20, 2023
1 parent f1991dd commit bb785ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
10 changes: 4 additions & 6 deletions omf/solvers/reopt_jl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,21 @@ julia> ]
# Usage:
```
__init__.py:
-> run_reopt_jl(path, inputFile="", default=False, convert=True, outages=False, microgrid_only=False, solver="HiGHS", max_runtime_s=None)
-> run_reopt_jl(path, inputFile="", default=False, convert=True, outages=False, microgrid_only=False, max_runtime_s=None)
```

General paramters:
- path: directory containing inputFile ; output files written here as well
- inputFile: json file containing REopt API input information
- if this file is already converted for REopt.jl -> set convert=False
- default: if True, sets inputFile to default values, uses given inputFile otherwise
- convert: if True, converts variables names to those used in REopt.jl, no conversion otherwise
- if this file is not converted for REopt.jl -> set convert=True
- outages: if True, runs outage simulation, otherwise doesn't
- microgrid_only: if True runs without grid, otherwise runs as normal
*only used within REopt.jl currently (not API)
- max_runtime_s: default is None, otherwise times out after given number of seconds and returns local optimal value (may not be the global optimum)

Testing parameters:
- solver: set to HiGHS (best runtime performance) ; other working options (tested but not currently installed): SCIP, Cbc
(add SCIP package to project [instructions above] & update REoptSolver.jl in order to utilize)
- default: if True, sets inputFile to default values found in julia_default.json, uses given inputFile otherwise
- convert: if True, converts variables names to those used in REopt.jl, no conversion otherwise

Examples:
```
Expand Down
10 changes: 5 additions & 5 deletions omf/solvers/reopt_jl/REoptSolver/Manifest.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is machine-generated - editing it directly is not advised

julia_version = "1.9.3"
julia_version = "1.9.4"
manifest_format = "2.0"
project_hash = "0f3466f2c6876628d09be51d5a7ef29f3e074ef0"

Expand Down Expand Up @@ -489,12 +489,12 @@ uuid = "4af54fe1-eca0-43a8-85a7-787d91b784e3"
[[deps.LibCURL]]
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
version = "0.6.3"
version = "0.6.4"

[[deps.LibCURL_jll]]
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
version = "7.84.0+0"
version = "8.4.0+0"

[[deps.LibGit2]]
deps = ["Base64", "NetworkOptions", "Printf", "SHA"]
Expand All @@ -509,7 +509,7 @@ version = "16.0.0+0"
[[deps.LibSSH2_jll]]
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8"
version = "1.10.2+0"
version = "1.11.0+1"

[[deps.Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
Expand Down Expand Up @@ -1064,7 +1064,7 @@ version = "1.6.38+0"
[[deps.nghttp2_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
version = "1.48.0+0"
version = "1.52.0+1"

[[deps.p7zip_jll]]
deps = ["Artifacts", "Libdl"]
Expand Down
9 changes: 6 additions & 3 deletions omf/solvers/reopt_jl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ def build_julia_image():
''' Creates REoptSolver sysimage -> reopt_jl.so '''

os.system(f'''julia --project={thisDir}/REoptSolver -e '
import Pkg; import REoptSolver; using PackageCompiler;
import Pkg; Pkg.instantiate();
import REoptSolver; using PackageCompiler;
PackageCompiler.create_sysimage(["REoptSolver"]; sysimage_path="{thisDir}/reopt_jl.so",
precompile_execution_file="{thisDir}/precompile_reopt.jl")
' ''')
Expand All @@ -24,8 +25,10 @@ def install_reopt_jl(system : list = platform.system()):

try:
if system == "Darwin":
commands = [
'HOMEBREW_NO_AUTO_UPDATE=1 brew list julia 1>/dev/null 2>/dev/null || brew install [email protected]'
commands = [ '''
HOMEBREW_NO_AUTO_UPDATE=1 brew list julia 1>/dev/null 2>/dev/null ||
{ brew tap homebrew/core; brew install julia; }
'''
]
elif system == "Linux":
print("running installation for Linux: work in progress")
Expand Down

0 comments on commit bb785ff

Please sign in to comment.