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

How to lock variables

ユーザーの入力を待っています。

コメント

4件のコメント

  • 正式なコメント
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three 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.
  • Jonasz Staszek
    • Community Moderator
    • Gurobi-versary
    • Thought Leader
    • First Question

    Hi Timur,

    what do you exactly mean by "fixate"? Do you need to assign a constant value to this variable? Or perhaps you want to keep only \(x_{3,4}\) out of all \(x_{i, j} \) for some \(i \in I, j \in J \) and remove the others?

    Please let us know - we will then gladly help you further.

    Best regards
    Jonasz

    0
  • Timur Kayhan
    • Gurobi-versary
    • First Comment
    • First Question

    Hi Jonasz,

    lets assume x_ij is a binary variable.

    I want to keep only x_34 = 1 out of all x_ij for all i and j.

    Best regards,

    Timur

    0
  • Jonasz Staszek
    • Community Moderator
    • Gurobi-versary
    • Thought Leader
    • First Question

    I would then either add a constraint or modify the bounds of the respective variable:

    model.addLConstr(x[3,4] == 1)
    # or alternatively
    x[3,4].LB = 1
    x[3,4].UB = 1

    Do you even need the variables pertaining to \( x_{i,j} \) s.t. \( i \neq 3, j \neq 4\) in such a situation? If not, I would abstain from generating them in the first place.

    Best regards
    Jonasz

    0

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