Commit 8e14bcd5 authored by Julien Lin's avatar Julien Lin
Browse files

fix bit anneal

parent df749e75
......@@ -50,6 +50,10 @@ def rand(domain_width, nb_sensors):
return domain
def init_with_t(t, **kwargs):
"""Same as rand but add a time."""
return rand(**kwargs), t
########################################################################
# Neighborhood
########################################################################
......
......@@ -68,6 +68,7 @@ def get_args_parser():
"num_sim_anneal",
"num_random",
"num_evolutionary",
"bit_sim_anneal"
]
can.add_argument(
"-m",
......@@ -223,18 +224,19 @@ def run_algorithm(the, iters_func):
elif the.solver == "bit_sim_anneal":
val, sol = algo.simulated_annealing(
make.func(
num.cover_sum,
bit.cover_sum,
domain_width=the.domain_width,
sensor_range=the.sensor_range,
dim=d * the.nb_sensors,
),
make.init(
num.rand,
dim=d * the.nb_sensors,
scale=the.domain_width,
bit.init_with_t,
t=2000,
domain_width=the.domain_width,
nb_sensors=the.nb_sensors,
),
make.neig(
num.neighb_square,
bit.neighb_square,
scale=the.variation_scale,
domain_width=the.domain_width,
),
......@@ -243,7 +245,7 @@ def run_algorithm(the, iters_func):
make.rand(),
iters_func,
)
sensors = num.to_sensors(sol)
sensors = bit.to_sensors(sol)
elif the.solver == "num_random":
val, sol = algo.random(
make.func(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment