Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround required for cs2 to work with sparse node IDs #26

Open
ms705 opened this issue Jun 26, 2015 · 0 comments
Open

Workaround required for cs2 to work with sparse node IDs #26

ms705 opened this issue Jun 26, 2015 · 0 comments

Comments

@ms705
Copy link
Collaborator

ms705 commented Jun 26, 2015

When using the cs2 solver, the maximum node ID in the flow graph output sent to the solver can be no greater than the number of nodes in the flow graph, or the solver fails. In other words, the p N E DIMACS line at the start of the output must contain the maximum node ID used as N.

The workaround fix deployed in ee31f80 is to return the maximum ID in use instead of the true number of nodes, which leads to cs2 implicitly assuming disconnected nodes for the unused IDs. However, this isn't ideal: as part of the workaround, FlowGraph::NumNodes() returns a number greater than the actual number of nodes in the graph. Moreover, the implied disconnected nodes may slow the solver down (although I doubt there is much impact in practice).

Note that this isn't a problem when node IDs are reused: the number of nodes in the flow graph and the maximum ID are in agreement in this case.

Possible comprehensive solutions:

  1. Re-map sparse node IDs into a continuous space before sending them to cs2, and back again (yuck!).
  2. Continue with the disconnected implicit node approach, but re-engineer things so that FlowGraph::NumNodes() returns the correct number again.

See patch in CL 237749.

ms705 added a commit that referenced this issue Jun 29, 2015
This commit brings in a somewhat hacky workaround for the problem
described in #25: when using the cs2 solver, the maximum node ID in the
output can be no greater than the number of nodes in the flow graph. The
workaround fix is to return the maximum ID in use instead of the true
number of nodes, which leads to cs2 implicitly assuming disconnected
nodes for the unused IDs.

This commit does not currently affect correctness of any code, but care
is required, since FlowGraph::NumNodes() does not necessarily return the
true number of nodes any more.

Affected modules: scheduling/flow
Bug: #26

Change-Id: I5de0b35cc84f1d4e53e050ac96e25924d031c7ae
ms705 added a commit that referenced this issue Jul 5, 2015
This commit brings in a somewhat hacky workaround for the problem
described in #25: when using the cs2 solver, the maximum node ID in the
output can be no greater than the number of nodes in the flow graph. The
workaround fix is to return the maximum ID in use instead of the true
number of nodes, which leads to cs2 implicitly assuming disconnected
nodes for the unused IDs.

This commit does not currently affect correctness of any code, but care
is required, since FlowGraph::NumNodes() does not necessarily return the
true number of nodes any more.

Affected modules: scheduling/flow
Bug: #26

Change-Id: I5de0b35cc84f1d4e53e050ac96e25924d031c7ae
(cherry picked from commit 28bb418)
shivramsrivastava added a commit to shivramsrivastava/firmament that referenced this issue Feb 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant