Commit 440add61 authored by Julien Lin's avatar Julien Lin
Browse files

add random

parent 4e12907f
......@@ -5,6 +5,13 @@
"version": "0.2.0",
"configurations": [
{
"name": "Python: num_random",
"type": "python",
"request": "launch",
"module": "snp",
"args": ["--solver","num_random", "--iters", "2000", "--steady-delta", "500"]
},
{
"name": "Python: num_sim_anneal",
"type": "python",
......
......@@ -63,7 +63,7 @@ if __name__ == "__main__":
help="Random pseudo-generator seed (none for current epoch)",
)
solvers = ["num_greedy", "bit_greedy", "num_sim_anneal"]
solvers = ["num_greedy", "bit_greedy", "num_sim_anneal", "num_random"]
can.add_argument(
"-m",
"--solver",
......@@ -239,6 +239,23 @@ if __name__ == "__main__":
iters,
)
sensors = num.to_sensors(sol)
elif the.solver == "num_random":
val, sol = algo.random(
make.func(
num.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,
),
iters
)
sensors = num.to_sensors(sol)
# Fancy output.
print("\n{} : {}".format(val, sensors))
......
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