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
81a79718
Commit
81a79718
authored
4 years ago
by
David Radu
Browse files
Options
Downloads
Patches
Plain Diff
added random search w/ local search algorithm (single partition)
parent
d2639ac3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/jl/SitingHeuristics.jl
+22
-4
22 additions, 4 deletions
src/jl/SitingHeuristics.jl
with
22 additions
and
4 deletions
src/jl/SitingHeuristics.jl
+
22
−
4
View file @
81a79718
using
PyCall
using
Dates
using
Random
include
(
"optimisation_models.jl"
)
include
(
"MCP_heuristics.jl"
)
...
...
@@ -27,15 +28,32 @@ function main_MIRSA(index_dict, deployment_dict, D, c, N, I, E, T_init, R, run)
x_sol
,
LB_sol
,
obj_sol
=
Array
{
Float64
,
2
}(
undef
,
R
,
L
),
Array
{
Float64
,
1
}(
undef
,
R
),
Array
{
Float64
,
2
}(
undef
,
R
,
I
)
x_init
=
solve_MILP_partitioning
(
D
,
c
,
n_partitions
,
index_dict
,
"Gurobi"
)
for
r
=
1
:
R
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
==
"RSSA"
x_sol
,
LB_sol
,
obj_sol
=
Array
{
Float64
,
2
}(
undef
,
R
,
L
),
Array
{
Float64
,
1
}(
undef
,
R
),
Array
{
Float64
,
2
}(
undef
,
R
,
I
)
x_init
=
zeros
(
Int64
,
L
)
ind_set
=
[
l
for
l
in
1
:
L
]
n_while
=
n_partitions
[
1
]
while
n_while
>
0
loc
=
sample
(
ind_set
)
deleteat!
(
ind_set
,
findall
(
x
->
x
==
loc
,
ind_set
))
x_init
[
loc
]
=
1
n_while
-=
1
end
x_init
=
convert
.
(
Float64
,
x_init
)
t1
=
now
()
for
r
=
1
:
R
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
t2
=
now
()
dt
=
(
t2
-
t1
)
/
R
println
(
dt
)
else
println
(
"No such run available."
)
...
...
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