Question: def tsp _ with _ extra _ constraints ( n , cost _ matrix, constraints ) : assert len ( cost _ matrix ) =

def tsp_with_extra_constraints(n, cost_matrix, constraints):
assert len(cost_matrix)== n, f'Cost matrix is not {n}x{n}'
assert all(len(cj)== n for cj in cost_matrix), f'Cost matrix is not {n}x{n}'
assert all(1<= i < n and 1<= j < n and i != j for (i,j) in constraints)
# TODO: encode the problem in pulp (a) decision variables; (b) constraints; (c) objective; (d) solve and extract
# solution. This is going to be very close to the MTZ encoding that we have presented in our notes. You can use
# our code as a starting point.
# your code here
raise NotImplementedError

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!