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
e2b8bd48
Commit
e2b8bd48
authored
4 years ago
by
David Radu
Browse files
Options
Downloads
Patches
Plain Diff
major update commit before for OR paper.
parent
fe4dba0b
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
src/helpers.py
+1
-1
1 addition, 1 deletion
src/helpers.py
src/main.py
+8
-8
8 additions, 8 deletions
src/main.py
src/tools.py
+6
-6
6 additions, 6 deletions
src/tools.py
with
15 additions
and
15 deletions
src/helpers.py
+
1
−
1
View file @
e2b8bd48
...
...
@@ -1060,7 +1060,7 @@ def get_partition_index(input_dict, deployment_vector, capacity_split='per_tech'
for
region
,
tech
in
key_list
:
index_dict
[
region
][
tech
]
=
[
i
+
1
for
i
in
index_dict
[
region
][
tech
]]
print
(
index_dict
)
#
print(index_dict)
return
index_dict
...
...
This diff is collapsed.
Click to expand it.
src/main.py
+
8
−
8
View file @
e2b8bd48
...
...
@@ -101,23 +101,22 @@ elif parameters['solution_method']['RAND']['set']:
for
i
in
range
(
it
):
random_locations
=
[]
random_locations_index
=
[]
all_locations
=
[]
for
region
in
parameters
[
'
deployment_vector
'
].
keys
():
for
tech
in
parameters
[
'
technologies
'
]:
population
=
input_dict
[
'
coordinates_data
'
][
region
][
tech
]
k
=
parameters
[
'
deployment_vector
'
][
region
][
tech
]
all_locations
.
extend
(
population
)
random_locations
.
extend
(
sample
(
population
,
k
))
all_locations
=
[]
for
region
in
parameters
[
'
deployment_vector
'
].
keys
():
for
tech
in
parameters
[
'
technologies
'
]:
all_locations
.
extend
(
input_dict
[
'
coordinates_data
'
][
region
][
tech
])
random_locations_index
=
[]
for
loc
in
random_locations
:
idx
=
all_locations
.
index
(
loc
)
random_locations_index
.
append
(
idx
)
random_locations_index
.
append
(
idx
+
1
)
random_locations_index
=
sorted
(
random_locations_index
)
random_locations_index
=
[
i
-
1
for
i
in
sorted
(
random_locations_index
)
]
xs
=
zeros
(
shape
=
input_dict
[
'
criticality_data
'
].
shape
[
1
])
xs
[
random_locations_index
]
=
1
...
...
@@ -128,6 +127,7 @@ elif parameters['solution_method']['RAND']['set']:
if
objective
>
best_objective
:
best_objective
=
objective
best_random_locations
=
random_locations
random_locations_dict
=
{
parameters
[
'
technologies
'
][
0
]:
best_random_locations
}
retrieve_site_data
(
c
,
parameters
,
input_dict
,
output_folder
,
random_locations_dict
,
best_objective
)
...
...
This diff is collapsed.
Click to expand it.
src/tools.py
+
6
−
6
View file @
e2b8bd48
...
...
@@ -870,22 +870,22 @@ def retrieve_index_dict(model_parameters, coordinate_dict):
d
=
model_parameters
[
'
deployment_vector
'
]
if
isinstance
(
d
[
list
(
d
.
keys
())[
0
]],
int
):
dict_deployment
=
d
print
(
dict_deployment
)
#
print(dict_deployment)
n
=
sum
(
dict_deployment
[
item
]
for
item
in
dict_deployment
)
print
(
n
)
#
print(n)
partitions
=
[
item
for
item
in
d
]
print
(
partitions
)
#
print(partitions)
if
model_parameters
[
'
deployment_constraint
'
]
==
'
country
'
:
indices
=
get_partition_index
(
coordinate_dict
,
d
,
capacity_split
=
'
per_country
'
)
elif
model_parameters
[
'
deployment_constraint
'
]
==
'
tech
'
:
indices
=
get_partition_index
(
coordinate_dict
,
d
,
capacity_split
=
'
per_tech
'
)
else
:
dict_deployment
=
concatenate_dict_keys
(
d
)
print
(
dict_deployment
)
#
print(dict_deployment)
n
=
sum
(
dict_deployment
[
item
]
for
item
in
dict_deployment
)
print
(
n
)
#
print(n)
partitions
=
[
item
for
item
in
dict_deployment
]
print
(
partitions
)
#
print(partitions)
indices
=
concatenate_dict_keys
(
get_partition_index
(
coordinate_dict
,
d
,
capacity_split
=
'
per_country_and_tech
'
))
return
n
,
dict_deployment
,
partitions
,
indices
...
...
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