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