Commit d5086d58 authored by Johann Dreo's avatar Johann Dreo
Browse files

fix scale management in num/neighb_square

- fix snp_landscape
parent 23736e4a
......@@ -49,9 +49,10 @@ def rand(dim, scale):
########################################################################
def neighb_square(sol, scale, domain_width):
"""Draw a random vector in a square of witdh `scale`
around the given one."""
"""Draw a random vector in a square of witdh `scale` in [0,1]
as a fraction of the domain width around the given solution."""
assert(0 < scale <= 1)
new = sol + (np.random.random(len(sol)) * scale - scale/2)
side = domain_width * scale;
new = sol + (np.random.random(len(sol)) * side - side/2)
return new
......@@ -40,9 +40,9 @@ if __name__ == "__main__":
fixed_x = (x0,x1) ),
make.init(num.rand,
dim = 2, # Two sensors moving along y axis.
scale = w),
scale = 1.0),
make.neig(num.neighb_square,
scale = 0.1 * w,
scale = 0.1,
domain_width = w
),
iters
......
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