How can I model a set exclusion?
回答済みHello,
I´m trying to model the following constraint using Gurobi (java interface), but I do not know how to write a set exclusion. Q is a subset of N without j.

I will be very thankful if you can help me.
PS: the example above it's not a valid constraint, it's just to explain what I would like to do.
Best regards,
Oscar.
-
正式なコメント
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. -
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
投稿コメントは受け付けていません。
コメント
2件のコメント