求解最小值的不等式

发布于 2024-07-07 08:12:12 字数 423 浏览 7 评论 0原文

我正在研究一个编程问题,该问题可归结为一组方程和不等式:

x[0]*a[0] + x[1]*a[1] + ... x[n]*a[n] >= D
x[0]*b[0] + x[1]*b[1] + ... x[n]*b[n] =  C

我想求解 X 的值,该值将给出 C 的绝对最小值>,给定输入 D 和列表以及由 a[0 - n] 和 < 组成的 AB代码>b[0 - n]。

我目前正在用 Python 解决这个问题,但这个问题通常与语言无关。

澄清更新:系数x[0 - n]仅限于非负整数集合。

I'm working on a programming problem which boils down to a set of an equation and inequality:

x[0]*a[0] + x[1]*a[1] + ... x[n]*a[n] >= D
x[0]*b[0] + x[1]*b[1] + ... x[n]*b[n] =  C

I want to solve for the values of X that will give the absolute minimum of C, given the input D and lists and A and B consisting of a[0 - n] and b[0 - n ].

I'm doing the problem at the moment in Python, but the problem in general is language-agnostic.

CLARIFICATION UPDATE: the coefficients x[0 - n] are restricted to the set of non-negative integers.

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

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

发布评论

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

评论(5

挖鼻大婶 2024-07-14 08:12:12

这看起来像是一个线性规划问题。 Simplex 算法 通常会给出良好的结果。 它基本上沿着由不等式界定的子空间的边界行走,寻找最优值。

直观地思考一下:每个不等式都表示一个半空间,即 n 维空间中的一个平面,您必须位于其右侧。 你的效用函数就是你想要优化的。 如果空间是封闭的,则最佳位置将位于封闭空间的顶点之一; 如果它是开放的,则最优值可能是无限的。

This looks like a linear programming problem. The Simplex algorithm normally gives good results. It basically walks the boundaries of the subspace delimited by the inequalities, looking for the optimum.

Think of it visually: each inequality denotes a half-space, a plane in n-dimensional space that you have to be on the right side of. Your utility function is what you're trying to optimize. If the space is closed, the optimum is going to be at one of the apexes of the closed space; if it's open, it's possible that the optimum is infinite.

自由范儿 2024-07-14 08:12:12

查看维基百科有关线性规划的条目。 整数编程部分就是您正在寻找的内容(x[i] 是整数的约束并不容易)。

在Python库中搜索branch&bound、branch&cut等(我认为它们还没有在scipy中实现)。

其他有趣的链接:

Have a look at the wikipedia entry on linear programming. The integer programming section is what you're searching for (the constraint of the x[i] being integers is not an easy one).

Search python libraries for branch&bound, branch&cut and the like (I don't think they have been implemented in scipy yet).

Other interesting links:

蓝咒 2024-07-14 08:12:12

看起来这是一个线性规划问题。

It looks like this is a linear programming problem.

别低头,皇冠会掉 2024-07-14 08:12:12

您可能想使用 Matlab 或 Mathematica 或查看 C 语言数值食谱 中的代码关于如何实现最小化函数的想法。 提供的链接指向该书 1992 年版本。 较新的版本可在亚马逊购买。

You might want to use Matlab or Mathematica or look at code from Numerical Recipes in C for ideas on how to implement minimization functions. The link provided is to the 1992 version of the book. Newer versions are available at Amazon.

昇り龍 2024-07-14 08:12:12

这家公司有一个工具可以做这类事情。

This company has a tool to do that sort of thing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文