Commit 3e5228e5 authored by stevet's avatar stevet Committed by Steve T
Browse files

[BUG FIX] MIP was never taking into account last contact surfaces

parent 74063e6f
......@@ -142,11 +142,13 @@ def solveMIP(pb, surfaces, MIP = True, draw_scene = None, plot = True):
if i!= 0 and el - previousL > 2.:
assert len(currentSum) > 0
constraints = constraints + [sum(currentSum) == len(currentSum) -1 ]
currentSum = []
currentSum = [boolvars[i]]
elif el !=0:
currentSum = currentSum + [boolvars[i]]
previousL = el
obj = cp.Minimize(ones(numSlackVariables) * boolvars)
if len(currentSum) > 1:
constraints = constraints + [sum(currentSum) == len(currentSum) -1 ]
obj = cp.Minimize(ones(numSlackVariables) * boolvars)
prob = cp.Problem(obj, constraints)
t1 = clock()
res = prob.solve(solver=cp.GUROBI, verbose=False )
......
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