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

How can I model a set exclusion?

回答済み

コメント

2件のコメント

  • 正式なコメント
    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.
  • Jaromił Najman
    • Gurobi Staff

    Hi Oscar,

    This is more of a general programming question and not really Gurobi specific.

    Do you mean to go over all subsets \(Q\) of \(N \setminus \{j\}\)? If yes, then the post How to generate all subsets of a set in Java iteratively? should be what you are looking for. In general, you will have to somehow generate all subsets of \(N \setminus \{j\}\). This can be done effectively via binary representation as described in the linked post. Once you have a fixed set \(Q\) you can use simple \(\texttt{if}\)-statements to check whether element \(k\) is in \(N\setminus Q\).

    Best regards, 
    Jaromił

    0

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