Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
resite_ip
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
smart_grids
public
resite_ip
Commits
c575a023
Commit
c575a023
authored
4 years ago
by
David Radu
Browse files
Options
Downloads
Patches
Plain Diff
jl gurobi time limits updated.
parent
68b641a3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
config_model.yml
+8
-5
8 additions, 5 deletions
config_model.yml
src/jl/main_heuristics.jl
+7
-0
7 additions, 0 deletions
src/jl/main_heuristics.jl
src/main.py
+51
-4
51 additions, 4 deletions
src/main.py
with
66 additions
and
9 deletions
config_model.yml
+
8
−
5
View file @
c575a023
...
...
@@ -68,13 +68,16 @@ solution_method:
algorithm
:
'
SALS'
#'GLS'
which_sol
:
'
rand'
#'rand'
seed
:
1
RGH
:
set
:
False
c
:
[
1
,
106
,
212
,
318
,
424
,
530
]
RAND
:
set
:
False
c
:
[
50
]
no_iterations
:
5
no_epochs
:
2
no_runs
:
9
seed
:
2
c
:
[
5
3
0
]
no_iterations
:
5
0
no_epochs
:
100
no_runs
:
1
seed
:
1
#deployment_constraint: 'country'
deployment_vector
:
{
'
EU'
:
{
'
wind_onshore'
:
530
}}
...
...
This diff is collapsed.
Click to expand it.
src/jl/main_heuristics.jl
+
7
−
0
View file @
c575a023
...
...
@@ -36,6 +36,13 @@ function main_call(index_dict, deployment_dict, D, c, N, I, E, T_init, R, run)
println
(
"Run "
,
r
,
"/"
,
R
)
x_sol
[
r
,
:
],
LB_sol
[
r
],
obj_sol
[
r
,
:
]
=
simulated_annealing_local_search_partition
(
D
,
c
,
n_partitions
,
N
,
I
,
E
,
x_init
,
T_init
,
index_dict
)
end
elseif
run
==
"GRH"
x_sol
,
LB_sol
=
Array
{
Float64
,
2
}(
undef
,
R
,
L
),
Array
{
Float64
,
1
}(
undef
,
R
)
for
r
=
1
:
R
println
(
"Run "
,
r
,
"/"
,
R
)
x_sol
[
r
,
:
],
LB_sol
[
r
]
=
randomised_greedy_heuristic
(
D
,
c
,
n
)
obj_sol
=
''
end
else
println
(
"No such run available."
)
throw
(
ArgumentError
)
...
...
This diff is collapsed.
Click to expand it.
src/main.py
+
51
−
4
View file @
c575a023
...
...
@@ -172,11 +172,12 @@ elif parameters['solution_method']['HEU']['set']:
with
open
(
join
(
output_folder
,
'
config_model.yaml
'
),
'
w
'
)
as
outfile
:
yaml
.
dump
(
parameters
,
outfile
,
default_flow_style
=
False
,
sort_keys
=
False
)
pickle
.
dump
(
jl_selected
,
open
(
join
(
output_folder
,
'
solution_matrix.p
'
),
'
wb
'
)
,
protocol
=
4
)
pickle
.
dump
(
jl_objective
,
open
(
join
(
output_folder
,
'
objective_vector.p
'
),
'
wb
'
)
,
protocol
=
4
)
pickle
.
dump
(
jl_traj
,
open
(
join
(
output_folder
,
'
trajectory_matrix.p
'
),
'
wb
'
)
,
protocol
=
4
)
pickle
.
dump
(
jl_selected
,
open
(
join
(
output_folder
,
'
solution_matrix.p
'
),
'
wb
'
))
pickle
.
dump
(
jl_objective
,
open
(
join
(
output_folder
,
'
objective_vector.p
'
),
'
wb
'
))
pickle
.
dump
(
jl_traj
,
open
(
join
(
output_folder
,
'
trajectory_matrix.p
'
),
'
wb
'
))
if
c
==
parameters
[
'
solution_method
'
][
'
HEU
'
][
'
c
'
][
0
]:
pickle
.
dump
(
input_dict
[
'
criticality_data
'
],
open
(
join
(
output_folder
,
'
criticality_matrix.p
'
),
'
wb
'
),
protocol
=
4
)
pickle
.
dump
(
input_dict
[
'
criticality_data
'
],
open
(
join
(
output_folder
,
'
criticality_matrix.p
'
),
'
wb
'
),
protocol
=
4
)
#if parameters['solution_method']['HEU']['which_sol'] == 'max':
# jl_objective_seed = max(jl_objective)
...
...
@@ -205,6 +206,52 @@ elif parameters['solution_method']['HEU']['set']:
# jl_locations = retrieve_location_dict_jl(jl_selected_seed, parameters, input_dict, indices)
# retrieve_site_data(c, parameters, input_dict, output_folder, jl_locations, jl_objective_seed)
elif
parameters
[
'
solution_method
'
][
'
RGH
'
][
'
set
'
]:
custom_log
(
'
RGH chosen to solve the IP. Opening a Julia instance.
'
)
import
julia
if
not
isinstance
(
parameters
[
'
solution_method
'
][
'
HEU
'
][
'
c
'
],
list
):
raise
ValueError
(
'
Values of c have to elements of a list for the heuristic set-up.
'
)
jl_dict
=
generate_jl_output
(
parameters
[
'
deployment_vector
'
],
input_dict
[
'
criticality_data
'
],
input_dict
[
'
coordinates_data
'
])
jl
=
julia
.
Julia
(
compiled_modules
=
False
)
from
julia.api
import
Julia
fn
=
jl
.
include
(
"
jl/main_heuristics.jl
"
)
for
c
in
parameters
[
'
solution_method
'
][
'
HEU
'
][
'
c
'
]:
print
(
'
Running heuristic for c value of
'
,
c
)
start
=
time
.
time
()
jl_selected
,
jl_objective
,
jl_traj
=
fn
(
jl_dict
[
'
index_dict
'
],
jl_dict
[
'
deployment_dict
'
],
jl_dict
[
'
criticality_matrix
'
],
c
,
parameters
[
'
solution_method
'
][
'
HEU
'
][
'
neighborhood
'
],
parameters
[
'
solution_method
'
][
'
HEU
'
][
'
no_iterations
'
],
parameters
[
'
solution_method
'
][
'
HEU
'
][
'
no_epochs
'
],
parameters
[
'
solution_method
'
][
'
HEU
'
][
'
initial_temp
'
],
parameters
[
'
solution_method
'
][
'
HEU
'
][
'
no_runs
'
],
parameters
[
'
solution_method
'
][
'
HEU
'
][
'
algorithm
'
])
end
=
time
.
time
()
noruns
=
parameters
[
'
solution_method
'
][
'
HEU
'
][
'
no_runs
'
]
dt
=
(
end
-
start
)
/
noruns
print
(
f
'
Average time per run:
{
dt
}
'
)
output_folder
=
init_folder
(
parameters
,
input_dict
,
suffix
=
'
_c
'
+
str
(
c
)
+
'
_GRH
'
)
with
open
(
join
(
output_folder
,
'
config_model.yaml
'
),
'
w
'
)
as
outfile
:
yaml
.
dump
(
parameters
,
outfile
,
default_flow_style
=
False
,
sort_keys
=
False
)
pickle
.
dump
(
jl_selected
,
open
(
join
(
output_folder
,
'
solution_matrix.p
'
),
'
wb
'
))
pickle
.
dump
(
jl_objective
,
open
(
join
(
output_folder
,
'
objective_vector.p
'
),
'
wb
'
))
pickle
.
dump
(
jl_traj
,
open
(
join
(
output_folder
,
'
trajectory_matrix.p
'
),
'
wb
'
))
if
c
==
parameters
[
'
solution_method
'
][
'
HEU
'
][
'
c
'
][
0
]:
pickle
.
dump
(
input_dict
[
'
criticality_data
'
],
open
(
join
(
output_folder
,
'
criticality_matrix.p
'
),
'
wb
'
),
protocol
=
4
)
else
:
raise
ValueError
(
'
This solution method is not available. Retry.
'
)
...
...
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