Skip to main content

Unable to get results for existing MIP model

Answered

Comments

3 comments

  • Maliheh Aramon
    Gurobi Staff Gurobi Staff

    Hi Natalie, 

    Based on the paper (page 4), it seems to me that each fruit \(i\) has known \((x_i, y_i)\) coordinate values . You just need to ensure that the second constraint is implemented for the pair of \((i, j)\) fruits where the \(x\)-coordinate of fruit \(j\) is not smaller than the \(x\)-coordinate of fruit \(i\).

    It should be enough to modify the second  constraint as below:

    m.addConstrs(
    (
    t[k, i] + Td - t[k, j] <= M * (2 - x[k, j] - x[k, i])
    for i in N
    for j in N
    for k in K
    if x_coordinate[j] >= x_coordinate[i]
    ),
    name="atLeast",
    )

     

    Best regards,

    Maliheh

    0
  • Natalie Pueyo
    Conversationalist
    First Question

    Hi Maliheh!

    Thank you for your reply, unfortunately the results are still zero. Adding the if-conditional did decrease the model's rows by half, so something seems to have changed.

    How did you identify that the \(x\) values in the condition \(x_j >= x_i\) are for the coordinates and not the \(x^k_i\) or \(x^k_j\) boolean variables? I ask because I had assumed that the \(j\) fruit was behind the \(i\) fruit and so \(x_j >= x_i\) didn't make sense to me. I had assumed \(x_j == x^k_j\), and the condition only triggered if the j-th fruit had also been picked along the i-th fruit. Would this be possible?

    Assuming this constraint is not the problem, are there recommended tests I could do to find out why the results are staying at zero? Can I somehow get more output to see how the model is running/making decisions? Are there common issues that a beginner might do that leads to these types of problems? 

    Thank you again for your help!

    Natalie

    0
  • Maliheh Aramon
    Gurobi Staff Gurobi Staff

    Hi Natalie, 

    How did you identify that the xx values in the condition xj>=xixj>=xi are for the coordinates and not the xkixik or xkjxjk boolean variables? I ask because I had assumed that the jj fruit was behind the ii fruit and so xj>=xixj>=xi didn't make sense to me. I had assumed xj==xkjxj==xjk, and the condition only triggered if the j-th fruit had also been picked along the i-th fruit. Would this be possible?

    It is definitely odd to define two different notations referring to the same thing. I have not read the paper in detail, however, in Fig 2, \((x_i, y_i)\) are clearly defined as coordinates. Furthermore, there is an inherent assumption in the second constraint that if fruits \(i\) and \(j\) are picked up by the same arm, the pickup time of fruit \(j\) is at least \(Td\) time units apart from the pickup time of fruit \(i\). This intuitively makes sense if fruit \(j\) is placed farther away along the \(x\)-coordinate. 

    Assuming this constraint is not the problem, are there recommended tests I could do to find out why the results are staying at zero? Can I somehow get more output to see how the model is running/making decisions? Are there common issues that a beginner might do that leads to these types of problems? 

    You can call the write() method on the model object to write the solution into a file. You can then read the solution back into your program and investigate why the objective value worsens if the solution moves away from zero. To access the value of the decision variables, you can also use the getAttr() method. For example, you can have:

    model.getAttr("X", model.getVars())

    Best regards,

    Maliheh

    0

Please sign in to leave a comment.