最小化多个路线时使用的边缘数量

发布于 2025-02-07 20:10:04 字数 542 浏览 2 评论 0原文

标题可能不清楚,但我会在这里尝试更好地解释:

  • 假设我们有一个定向加权图G,带有N节点和K边缘。
  • 有两个主要节点:节点1和NodeN。我们的主要目标是从1到N。通常有多个可能的路径从1到N。
  • 也有M的人想从1到N。
  • 我们 边缘具有重量w。体重意味着有多少人同时可以通过该边缘。
  • 每个边缘都可以被认为是一条路,需要1天才能通过。

我们要做的是使M人从节点1进入Node N,从而最大程度地减少天数。

例如:

图形示例

在此图中,如果我们有3个人可以通过,最小值天数为2。我们将2个人传递到节点2和1个人到节点3。2个人将需要2天才能进入节点3,而1个人将需要1天才能进入Node 3。

我的问题是:如何解决这个问题?是用Max-Flow吗?如果是,如何对问题进行建模,以便可以使用Max-Flow解决问题?

The title maybe isn't clear, but I'll try to explain better here:

  • Suppose we have a directed weighted graph G, with N nodes and K edges.
  • There is two main nodes: Node 1 and Node N. Our main goal is to go from 1 to N. And usually there is multiple possible paths from 1 to N.
  • We also have M people that want to travel from 1 to N.
  • Every edge has a weight w. The weight means how many people simultaneously can pass through that edge.
  • Every edge can be imagined as a road, that takes 1 day to pass.

What we want to do is to make the M people go to node N, from node 1, minimizing the number of days.

For example:

example of graph

In this graph, if we have 3 people to pass, the minimum number of days is 2. We pass 2 people to the node 2 and 1 person to node 3. The 2 people will take 2 days to go to node 3, and 1 person will take 1 day to go to node 3.

My question is: How to solve this? Is it with max-flow? If yes, how to model the problem so that it can be solved with max-flow?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

可爱暴击 2025-02-14 20:10:04
  • 则以正常方式应用最大流量算法
  • 如果最大值结果小于m,
    • 没有解决方案
  • 如果最大流量结果等于m,
    • 已解决
  • 如果最大流量结果大于m,
    • 以最长的行程顺序从最大流量结果中删除人。
  • Apply max-flow algorithm in normal way
  • If max-flow result is less than M
    • no solution
  • If max-flow result is equal to M
    • solved
  • If max-flow result is greater than M
    • remove people from max max flow result in order of longest trip until M left.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文