メインコンテンツへスキップ

Element of decisionvariable is missing

回答済み

コメント

8件のコメント

  • 正式なコメント
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support.
  • Riley Clement
    • Gurobi Staff

    Hi Madeira,

    Your question reads as if the audience is familiar with your problem, and your model formulation (but they are not).

    I think we will need to bridge this gap in order for anybody to be able to help.  Feel free to post your formulation and a brief description of the problem, variables, and constraints, and illustrate where the issue is with a small example.

    - Riley

    0
  • Madeira
    • Gurobi-versary
    • First Comment
    • First Question

    Hi Riley,

    thank you for your reply.

    https://www.dropbox.com/scl/fo/fozqrgx1rxzeqb80cf5lg/ACGrxbKkacz1VfnZu3RrAIk?rlkey=m7fb9xm7137xhw8nv14xw26w7&st=pkwiweqw&dl=0

    I put there my model formulation, my code and the description of the two samples which have the earlier mentioned deviation.

    The sample covers 100 points. If that is too large I will try to find a smaller data set where the deviation is displayed. 

    Thank you.

    Madeira

    0
  • Riley Clement
    • Gurobi Staff

    Hi Madeira,

    The first thing I would change in your code is the where you compare

    element.X != 0

    If these variables are integer (or binary) then it is best to use a comparison such as

    element.X >= 0.5

    as sometimes integer variables don't take precise integer values.  You could for example have a binary variable with value 0.000001 and this would be considered feasible under default settings.  But using Python's != operator to compare to 0 would result in "True", when you actually want it to be considered as 0.

    Why does Gurobi sometimes return non-integral values for integer variables? 

    I'd try making this change first and seeing if it solves the issue.

    - Riley

    0
  • Madeira
    • Gurobi-versary
    • First Comment
    • First Question

    Hi Riley,

    thank you for the hint. I applied it.

    First with 0.5, then 0.25 and then with 0.
    The first two tries gave me the same deviation (97 was not included). With the last try I got all results from the solver. 97 is declared with 0 but the assign decision variable still assigns 97.

    I added a new document with screenshots and comments in the folder.

    Thank you.

    Madeira

    0
  • Riley Clement
    • Gurobi Staff

    Do the "assigned" variables in your code/analysis correspond to the "z" variables in your formulation?

    0
  • Madeira
    • Gurobi-versary
    • First Comment
    • First Question

    Yes

    0
  • Riley Clement
    • Gurobi Staff

    Ok, so now the question is, if you think you have an incorrect solution:

    1) which constraints does the solution violate
    or
    2) can you construct a solution with a better objective

    0

投稿コメントは受け付けていません。