Pyhton中的单纯型LP值
使用python求解线性编程孔洞,目标是一个值:x
互联网你好,
我在试图在python中自动化的过程遇到
麻烦从Excel中找到 Simplex LP方法当时解决一个问题非常有用,但是我需要解决1000或更多问题,所以我真的想节省我的时间
纸浆,这是很好的纸浆但是,只有当您想最大化或最小化目标函数时,我需要将其均衡到一个值:的值,
所以问题是:
我需要将付款分为3个债务,但是我无法进行部分付款,
我认为我可以以目标(总产品)等于付款的方式将布尔(1或0)的债务乘以债务
,以便付款的钱只能偿还我可以完全覆盖
求解器的 债务像这样的作品
,它提供了正确的方法来分割付款
所以我需要为python做同样的事情,也许有一个秘密功能可以帮助我解决这个问题或Sympy或其他图书馆,IDK我非常感谢您的帮助
import pandas as pd
data = [['Debt1', 100, 400, True], ['Debt2', 200, 400, True], ['Debt3', 300, 400, True]]
# Create the pandas DataFrame
df = pd.DataFrame(data, columns=['Debt', 'Amount', 'Payment', 'Boolean'])
df
Debt Amount Payment Boolean
0 Debt1 100 400 True
1 Debt2 200 400 True
2 Debt3 300 400 True
Use Python for solving a Linear Programming porblem with the objective being a Value of: x
Hello people of internet
I'm having trouble with a process I'm trying to automatize in Python it´s a LP problem
I found Simplex LP method in Solver from Excel very useful to solve one problem at the time but I need to do it for 1000 or more problems so I really want to save me some time
PuLP is very good doing Solver stuff but only if you want to maximize or minimize the objective function and I need to equalize it to a VALUE OF:
So the problem is this one:
I need to divide the payment into 3 debts, but I cannot make partial payments
I figured I can multiply the debts times a boolean (1 or 0) in a way that the objective (a sum product) equalizes the payment
So the money from the payment would go only to the debts I can completely cover
Solver works like this
And it gives the correct way to divide the payments
So I need to do the same thing for Python Maybe there's a secret function PuLP has that can help me solve this or maybe Sympy or another library, idk I'd really appreciate your help
import pandas as pd
data = [['Debt1', 100, 400, True], ['Debt2', 200, 400, True], ['Debt3', 300, 400, True]]
# Create the pandas DataFrame
df = pd.DataFrame(data, columns=['Debt', 'Amount', 'Payment', 'Boolean'])
df
Debt Amount Payment Boolean
0 Debt1 100 400 True
1 Debt2 200 400 True
2 Debt3 300 400 True
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想如何做,这是代码
I figured how to do it, here's the code