Commit 4ee87a0f authored by Grégoire Grzeczkowicz's avatar Grégoire Grzeczkowicz
Browse files

Penalize wrong solution

parent 9cb5952a
......@@ -32,6 +32,13 @@ def cover_sum(sol, domain_width, sensor_range, dim):
cov = pb.coverage(domain, sensors, sensor_range*domain_width)
s = np.sum(cov)
assert(s >= len(sensors))
if len(sol) > dim:
s *= 0.5
for v in sol:
if v < 0:
s += v/domain_width
if v >= domain_width:
s -= (v-domain_width)/domain_width
return s
......
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