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

Is Gurobi able to handle a decision variable in the index/as a boundary in a sum?

回答済み

コメント

2件のコメント

  • 正式なコメント
    Simranjit Kaur
    • Gurobi Staff 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 why not try our AI Gurobot?.
  • Tobias Achterberg
    • Gurobi Staff Gurobi Staff

    No, this is not directly possible. In constraint programming, such a constraint is refered to as "element constraint", i.e., you have a decision variable as the index into some array.

    If your m_j variables have a reasonably small domain, then you might be able to model this using auxiliary binary variables. For example, to model

    y = x_m

    with l <= m <= u, you could add (u-l+1) binary variables z_i and use the following constraints:

    m = sum_{k=l,...,u} k*z_k
    sum_{k=l,...,u} z_k = 1
    y = sum_{k=l,...,u} z_k*x_k

    The latter constraint is quadratic, but because the z_k variables are binary, Gurobi will translate this into linear and/or SOS constraints.

    That being said, I am pretty sure that Gurobi will have a very hard time to solve models that include such a structure. But if your model is small and easy, then maybe you have a chance.

     

    Regards,

    Tobias

    0

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