简体   繁体   English

等同于Excel Solver的Python:获取已知约束的最大值

[英]Python equivalent to Excel Solver: get max value knowing constraints

I'm quite new to Python and trying to find a Python equivalent to the Excel Solver function. 我是Python的新手,正试图找到与Excel Solver函数等效的Python。 Let's say I have the following inputs: 假设我有以下输入:

import math

totalvolflow=150585.6894
gaspercentvol=0.1
prodmod=1224
blpower=562.57
powercons=6

gasvolflow=totalvolflow*gaspercentvol
quantity=math.ceil(gasvolflow/prodmod)
maxpercentvol=powercons*totalvolflow*prodmod/blpower

I want to find the maximum value of maxpercentvol by changing gaspercentvol with the following constraint: 我想通过使用以下约束来更改gaspercentvol来找到maxpercentvol的最大值:

quantity*powercon<blpower

Any help would be appreciated. 任何帮助,将不胜感激。

According to: 根据:

maxpercentvol=powercons*totalvolflow*prodmod/blpower

maxpercentvol is 1,965,802.12765274 regardless of the value of gaspercentvol . maxpercentvol是1,965,802.12765274不管值的gaspercentvol

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM