Efficient way for vertex cover variant #4483
Unanswered
UnlimitedCookies
asked this question in
CP-SAT questions
Replies: 2 comments 3 replies
-
|
just try it. |
Beta Was this translation helpful? Give feedback.
2 replies
-
|
for each edge a <-> b, vertex_a and vertex_b are Boolean variables that are true when the corresponding vertex is selected. edge_a_b = model.new_bool_var('a-b')
model.add_implication(edge_a_b, vertex_a)
model.add_implication(edge_a_b, vertex_b)
model.add_bool_and(edge_a_b).only_enforce_if(vertex_a, vertex_b) # This one is optionalthen the model: model.add(sum(edge_x_y) >= t)
model.minimize(sum(vertex_x))I guess this is what you have written. Even it if uses the CP-SAT API, it is clearly linear. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
So I have been given an undirected graph
Gand a valuetthat specifies how many edges need to be covered at least by a set of vertices of which the total amount need to be minimized.If I could simply use math like notation I would formulate the equation like this
>= t, where for each edgemin(u + v, 1)oru OR vis the summand.But I am afraid that both of these approaches are not suitable.
So my current solution is
>= t.But I am afraid that both of these approaches don't work in linear programming.
Since this increases the amount of variables used, I wanted to ask whether there would be a cleaner/more efficient solution.
Beta Was this translation helpful? Give feedback.
All reactions