fix: less conservative assert

This commit is contained in:
johann dreo 2019-12-16 14:35:00 +01:00
commit 9bce1e64b0
2 changed files with 1 additions and 2 deletions

View file

@ -23,7 +23,7 @@ def to_sensors(sol):
def cover_sum(sol, domain_width, sensor_range): def cover_sum(sol, domain_width, sensor_range):
"""Compute the coverage quality of the given vector.""" """Compute the coverage quality of the given vector."""
assert(0 < sensor_range <= math.sqrt(2)) assert(0 < sensor_range <= domain_width * math.sqrt(2))
assert(0 < domain_width) assert(0 < domain_width)
assert(len(sol)>0) assert(len(sol)>0)
domain = np.zeros((domain_width,domain_width)) domain = np.zeros((domain_width,domain_width))

View file

@ -21,7 +21,6 @@ def coverage(domain, sensors, sensor_range):
for x in sensors: for x in sensors:
if distance(x,p) < sensor_range: if distance(x,p) < sensor_range:
domain[py][px] = 1 domain[py][px] = 1
break
return domain return domain