Skip to main content

My model does not work right, can someone help me?

Answered

Comments

3 comments

  • Riley Clement
    Gurobi Staff Gurobi Staff

    Hi Jordi,

    Obviously we can't run your model without the data, but I note your code includes the following comment

    # do IIS if the model is infeasible

    Have you tried doing this?  This will likely be the fastest way of discovering what is wrong.

    - Riley

    0
  • Jordi Kortekaas
    Curious
    First Comment

    Hi Riley, 

    I have, and it is not necessarily that it does not try to optimize the objective function. It does not find a solution, as the solution count is 0. I cannot find what is wrong. The variables of input are: 

    distance_matrix_dict = {'tractor': [[0, 0, 0, 460, 460, 157, 184, 0, 194, 722, 120, 290, 369, 165], [0, 0, 0, 460, 460, 157, 184, 0, 194, 722, 120, 290, 369, 165], [0, 0, 0, 460, 460, 157, 184, 0, 194, 722, 120, 290, 369, 165], [453, 453, 453, 0, 0, 546, 566, 453, 628, 1136, 480, 556, 164, 477], [453, 453, 453, 0, 0, 546, 566, 453, 628, 1136, 480, 556, 164, 477], [156, 156, 156, 542, 542, 0, 53, 156, 135, 808, 276, 217, 416, 322], [178, 178, 178, 567, 567, 48, 0, 178, 157, 760, 298, 189, 441, 344], [0, 0, 0, 460, 460, 157, 184, 0, 194, 722, 120, 290, 369, 165], [194, 194, 194, 626, 626, 135, 163, 194, 0, 757, 314, 317, 499, 360], [728, 728, 728, 1147, 1147, 808, 759, 728, 761, 0, 676, 936, 1069, 718], [120, 120, 120, 485, 485, 277, 305, 120, 314, 674, 0, 410, 408, 64], [292, 292, 292, 557, 557, 217, 184, 292, 316, 932, 412, 0, 431, 458], [374, 374, 374, 164, 164, 426, 446, 374, 507, 1057, 401, 435, 0, 398], [165, 165, 165, 482, 482, 322, 349, 165, 359, 714, 63, 455, 404, 0]],
     
    'car': [[0, 0, 0, 359, 359, 109, 123, 0, 160, 434, 80, 236, 263, 119], [0, 0, 0, 359, 359, 109, 123, 0, 160, 434, 80, 236, 263, 119], [0, 0, 0, 359, 359, 109, 123, 0, 160, 434, 80, 236, 263, 119], [354, 354, 354, 0, 0, 420, 378, 354, 499, 761, 372, 418, 164, 378], [354, 354, 354, 0, 0, 420, 378, 354, 499, 761, 372, 418, 164, 378], [108, 108, 108, 417, 417, 0, 40, 108, 135, 419, 188, 187, 305, 227], [119, 119, 119, 378, 378, 36, 0, 119, 146, 383, 199, 144, 266, 238], [0, 0, 0, 359, 359, 109, 123, 0, 160, 434, 80, 236, 263, 119], [177, 177, 177, 498, 498, 135, 138, 177, 0, 439, 146, 286, 387, 187], [436, 436, 436, 767, 767, 419, 383, 436, 433, 0, 402, 519, 690, 428], [80, 80, 80, 375, 375, 189, 203, 80, 146, 402, 0, 316, 298, 50], [231, 231, 231, 418, 418, 187, 141, 231, 286, 516, 311, 0, 306, 350], [275, 275, 275, 164, 164, 311, 269, 275, 390, 683, 293, 309, 0, 300], [118, 118, 118, 381, 381, 227, 242, 118, 187, 427, 50, 355, 304, 0]]}
    num_vehicles = 4
    capacity_dict = {'car': 1100, 'tractor': 5000}
    demand_list = [0, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750]
    vehicle_types = ['tractor', 'car']
    0
  • Riley Clement
    Gurobi Staff Gurobi Staff

    Hi Jordi,

    I don't think there is a feasible solution with this data.  If I understand correctly, every client is visited by either the tractor or the car, and the vehicle's load increases by the demand at that client, but must remain below the capacity of the vehicle.

    The total demand is 9750, while the total capacity of the vehicles is 6100 - so it seems that the problem cannot be satisfied but it is taking Gurobi a long time to prove infeasibility.

    If you were to change the car capacity to 5000, so that the total capacity exceeds the demand, then you will find that solutions are found rather readily.

    - Riley

    0

Please sign in to leave a comment.