M_ind=10*grid_size# Big M relative to grid indices
M_cts=10*max(max(robot_locations[:,0])-min(robot_locations[:,0]),max(robot_locations[:,1])-min(robot_locations[:,1]))# Big M relative to robot locations
foriinrange(N):
foriinrange(N):
forjinrange(i+1,N):
forjinrange(i+1,N):
# At least one of the two constraints below must be true
# At least one of the two constraints below must be true
y1=cp.Variable(boolean=True)
xsep=cp.Variable(boolean=True)
y2=cp.Variable(boolean=True)
ysep=cp.Variable(boolean=True)
constraints.append(y1+y2>=1)
constraints.append(xsep+ysep>=1)
# Enforces separation by at least 1 in the x direction
# Enforces separation by at least 1 in the x direction
ifrobot_locations[i,0]>=robot_locations[j,0]:
b0=cp.Variable(boolean=True)# b0 = 0 if robot i's x >= robot j's x, 1 otherwise
M_ind=10*grid_size# Big M relative to grid indices
M_cts=10*max(max(robot_locations[:,0])-min(robot_locations[:,0]),max(robot_locations[:,1])-min(robot_locations[:,1]))# Big M relative to robot locations
foriinrange(N):
foriinrange(N):
forjinrange(i+1,N):
forjinrange(i+1,N):
x_separated=cp.Variable(boolean=True)
# At least one of the two constraints below must be true
y_separated=cp.Variable(boolean=True)
xsep=cp.Variable(boolean=True)
ysep=cp.Variable(boolean=True)
# Robot i's coordinate in the x_prime direction
constraints.append(xsep+ysep>=1)
robot_i_x_prime=robot_locations[i]@x_prime_hat
# Robot j's coordinate in the x_prime direction
robot_j_x_prime=robot_locations[j]@x_prime_hat
b0=cp.Variable(boolean=True)
# When b1 = 1, robot i's x_prime coordinate is greater than robot j's