Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OptiOrch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zizhe Wang
OptiOrch
Commits
6d587371
Commit
6d587371
authored
1 year ago
by
Zizhe Wang
Browse files
Options
Downloads
Patches
Plain Diff
refactor configuration
parent
d0ba7175
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/config.py
+35
-45
35 additions, 45 deletions
src/config.py
with
35 additions
and
45 deletions
src/config.py
+
35
−
45
View file @
6d587371
#
(c)
Zizhe Wang
#
Copyright (c) 2024 -
Zizhe Wang
# https://zizhe.wang
######################################
...
...
@@ -7,47 +7,37 @@
# #
######################################
# Be sure to only edit your setups in global settings!!!
# Don't modify the code outside of it !!!
import
os
# Basic settings
MODEL_NAME
=
"
SimpleHeatingSystem
"
MODEL_FILE
=
f
"
{
MODEL_NAME
}
.mo
"
import
json
# Load configuration from JSON file
CONFIG_FILE
=
'
config.json
'
with
open
(
CONFIG_FILE
,
'
r
'
)
as
f
:
config
=
json
.
load
(
f
)
# Assign configuration variables
MODEL_NAME
=
config
[
'
MODEL_NAME
'
]
MODEL_FILE
=
config
[
'
MODEL_FILE
'
]
SIMULATION_STOP_TIME
=
config
[
'
SIMULATION_STOP_TIME
'
]
PARAMETERS
=
config
[
'
PARAMETERS
'
]
OBJECTIVES
=
config
[
'
OBJECTIVES
'
]
MAXIMIZE
=
config
[
'
MAXIMIZE
'
]
PARAM_BOUNDS
=
config
[
'
PARAM_BOUNDS
'
]
PRECISION
=
config
[
'
PRECISION
'
]
OPTIMIZATION_CONFIG
=
config
[
'
OPTIMIZATION_CONFIG
'
]
PLOT_CONFIG
=
config
[
'
PLOT_CONFIG
'
]
N_JOBS
=
config
[
'
N_JOBS
'
]
# Derived configuration
MODEL_PATH
=
os
.
path
.
join
(
os
.
getcwd
(),
MODEL_FILE
)
SIMULATION_STOP_TIME
=
3000
# in seconds
# Parameters to be varied and objectives to be optimized
PARAMETERS
=
[
"
Q_max
"
,
"
T_set
"
]
OBJECTIVES
=
[
"
energy
"
,
"
comfort
"
]
MAXIMIZE
=
[
"
comfort
"
]
# List of objectives to maximize
# Parameter range
PARAM_BOUNDS
=
{
"
Q_max
"
:
(
1000
,
5000
),
"
T_set
"
:
(
280
,
310
),
}
# Results precision
PRECISION
=
2
# decimal places
# Optimization settings
OPTIMIZATION_CONFIG
=
{
"
ALGORITHM_NAME
"
:
'
NSGA2
'
,
# Algorithm selection
"
POP_SIZE
"
:
100
,
# Population size for algorithm
"
N_GEN
"
:
50
# Number of generations
}
# Plot configurations
PLOT_CONFIG
=
{
"
PLOT_X
"
:
"
Energy Consumption
"
,
"
PLOT_Y
"
:
"
Comfort
"
,
"
PLOT_TITLE
"
:
"
Pareto Front of Energy Consumption vs Comfort
"
}
# Parallel processing
N_JOBS
=
-
1
# Options: '-1', '1', 'n', 'None'
# "PARAMETERS": Parameters to be varied
# "OBJECTIVES": Objectives to be optimized
# "MAXIMIZE": Objectives to be maximized
# "PARAM_BOUNDS": Parameter range
# "PRECISION": Results precision (decimal places)
# "N_JOBS": Parallel processing
# Options: '-1', '1', 'n', 'None'
# ====================================================================
# -1 = use all available CPU cores
# 1 = disables parallel processing and runs the tasks sequentially
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment