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
9cc6f24e
Commit
9cc6f24e
authored
10 months ago
by
Zizhe Wang
Browse files
Options
Downloads
Patches
Plain Diff
feat multiple goal expressions
parent
7d64e200
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/orchestration_config.json
+5
-2
5 additions, 2 deletions
src/orchestration_config.json
src/orchestration_configurator.py
+2
-5
2 additions, 5 deletions
src/orchestration_configurator.py
with
7 additions
and
7 deletions
src/orchestration_config.json
+
5
−
2
View file @
9cc6f24e
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
"SIMULATION_TIME"
:
100
,
"SIMULATION_TIME"
:
100
,
"TIME_CONFIG"
:
{
"TIME_CONFIG"
:
{
"START_TIME"
:
8
,
"START_TIME"
:
8
,
"END_TIME"
:
1
3
,
"END_TIME"
:
1
2
,
"TIME_UNIT"
:
"hour"
"TIME_UNIT"
:
"hour"
},
},
"OBJECTIVES"
:
[
"OBJECTIVES"
:
[
...
@@ -31,7 +31,10 @@
...
@@ -31,7 +31,10 @@
"user_demand"
:
"userDemand"
"user_demand"
:
"userDemand"
},
},
"CRITERIA"
:
{
"CRITERIA"
:
{
"GOAL_EXPRESSION"
:
"evaluation_results['performance'] >= simulation_inputs['user_demand']"
"GOAL_EXPRESSION"
:
[
"evaluation_results['performance'] >= simulation_inputs['user_demand']"
,
"evaluation_results['remainingEnergy'] >= 0"
]
},
},
"OPTIMIZATION_CONFIG"
:
{
"OPTIMIZATION_CONFIG"
:
{
"USE_SINGLE_OBJECTIVE"
:
false
,
"USE_SINGLE_OBJECTIVE"
:
false
,
...
...
This diff is collapsed.
Click to expand it.
src/orchestration_configurator.py
+
2
−
5
View file @
9cc6f24e
...
@@ -76,7 +76,8 @@ def simulate_and_evaluate(parameters, simulation_time, simulation_inputs, orches
...
@@ -76,7 +76,8 @@ def simulate_and_evaluate(parameters, simulation_time, simulation_inputs, orches
print
(
f
"
{
criterion
}
:
{
result_value
}
"
)
print
(
f
"
{
criterion
}
:
{
result_value
}
"
)
# Evaluate the goal expression dynamically
# Evaluate the goal expression dynamically
goal_satisfied
=
eval
(
goal_expression
)
local_vars
=
{
"
evaluation_results
"
:
evaluation_results
,
"
simulation_inputs
"
:
simulation_inputs
}
goal_satisfied
=
all
(
eval
(
expression
,
{},
local_vars
)
for
expression
in
goal_expression
)
print
(
f
"
Goal satisfied:
{
goal_satisfied
}
"
)
print
(
f
"
Goal satisfied:
{
goal_satisfied
}
"
)
return
evaluation_results
,
goal_satisfied
,
parameters
,
depletion_time
return
evaluation_results
,
goal_satisfied
,
parameters
,
depletion_time
...
@@ -107,16 +108,12 @@ def adaptive_control_loop(data, moo_wrapper, orchestration_config):
...
@@ -107,16 +108,12 @@ def adaptive_control_loop(data, moo_wrapper, orchestration_config):
# Create a dictionary of inputs
# Create a dictionary of inputs
simulation_inputs
=
dict
(
zip
(
input_keys
,
input_values
))
simulation_inputs
=
dict
(
zip
(
input_keys
,
input_values
))
# Update the config for the optimization framework
# Update the config for the optimization framework
moo_wrapper
.
update_config
(
simulation_inputs
,
simulation_time
)
moo_wrapper
.
update_config
(
simulation_inputs
,
simulation_time
)
# Run the optimization using the wrapper
# Run the optimization using the wrapper
moo_wrapper
.
run_optimization
()
moo_wrapper
.
run_optimization
()
# Get the list of best parameters from the optimization results
# Get the list of best parameters from the optimization results
parameter_list
=
moo_wrapper
.
get_parameters
()
parameter_list
=
moo_wrapper
.
get_parameters
()
# Try each parameter set in order until goal is satisfied or options are exhausted
# Try each parameter set in order until goal is satisfied or options are exhausted
goal_satisfied
=
False
goal_satisfied
=
False
...
...
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