Question: def tsp _ with _ extra _ constraints ( n , cost _ matrix, constraints ) : assert len ( cost _ matrix ) =
def tspwithextraconstraintsn costmatrix, constraints:
assert lencostmatrix n f'Cost matrix is not nxn
assert alllencj n for cj in costmatrix f'Cost matrix is not nxn
assert all i n and j n and i j for ij 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
