PYOMO:忽略了一个约束的投资组合优化

发布于 2025-02-06 13:24:04 字数 426 浏览 1 评论 0原文

感谢您的时间。 这是一个能量组合优化问题。我的代码可以运行并输出结果,但是一个密钥约束根本不起作用。因此结果是错误的。

背景:

  1. 给出了风或太阳能的形状,但是风或太阳能的容量尚不清楚。
  2. 风能具有给定的上限,太阳能也是如此。
  3. 通道传输发电的能力是固定的,水力发电的产生必须全部转移,因此可能会占风和太阳能的一部分。
  4. 总比例的风和太阳能不应超过10%,这是(不起作用的)。
  5. 目的是找出一定数量的风和太阳能的容量,这应该满足所有约束并产生最大传输的功率生产。尤其是,丰富的生成百分比应不超过10%。

结果表明,风的容量=最大值,太阳能的能力=最大值,并且生成的百分比约为86%。 几天来,我一直在努力解决这个错误,但仍然非常困惑。请帮助我。

问题解决了问题】事实证明,我做了错误的打印。谢谢。

thanks for your time.
It's an energy portfolio optimization problem.My code could run and output a result.But one key constraint doesn't work at all. So the result is wrong.

Backgrounds:

  1. the shape of wind or solar generation is given, but capacity of wind or solar is unknown.
  2. capacity of wind has a given upper limit, so does solar.
  3. capacity of channel to transfer power generation is fixed, hydro's generation must be all transferred, so parts of the generation of wind and solar may be abounded.
  4. total abounded generation of wind and solar should not account for more than 10%(this is the one doesn't work).
  5. the object is to find out the certain numbers of wind's and solar's capacity, which should satisfy all constraints and generate maximum transferred power production. Especially, the abounded generation percentage should be no more than 10%.

The result shows that capacity of wind = MaxW, capacity of solar = MaxS, and the percentage of abounded generation is about 86%.
I have been struggling to solve this bug for days but still very confused. Please help me out.

【Problem solved】 It turns out that I made a wrong print. Thanks.

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

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

发布评论

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

评论(1

半葬歌 2025-02-13 13:24:04

这里有很多丢失的作品,我不确定您从中得到了什么,因为它具有语法错误。

不能使用10%表示十进制0.10。只需使用小数值即可。而且它当然不能是您功能的参数,因为它是一个非法变量名称。 ?

通常,“容量”是一个参数(固定值),而不是变量。 ???

修复它,清理它,如果您仍然卡住,则可以在上面编辑代码(包括一些数据,以便帮助您剪切/粘贴/运行整个辣酱玉米饼)。

编辑(在您的编辑之后):

好的,这要清楚一些。目前尚不清楚您在哪里试图将风 +太阳能的总数限制在总数的10%。

在约束m.abo_c1中,您似乎将风 +太阳能的总数限制为您要构建的总容量的90%,对吗?如果这不是您的意图,则应

在另一个约束中重新访问该约束,因此您需要对风和太阳能施加上限,如果您有(在伪代码中):

wind + solar + hydro = tot_power

您想要:

wind + solar <= 0.1 x tot_power 

然后只需要一个小代数即可重新排列:

wind + solar <= 0.9 x hydro

我在您的模型中看不到这种限制

There are a lot of missing pieces here, and I'm not sure what you are getting out of that because it has syntax errors.

You cannot use 10% to represent the decimal 0.10. Just use the decimal value. And it certainly cannot be a parameter of your function, as it is an illegal variable name. ??

Typically "capacity" is a parameter (fixed value), not a variable. ???

Fix it up, clean it up, and if you are still stuck, you can edit your code above (include some data so that a person helping you can cut/paste/run the whole enchilada).

EDIT (after your edit):

Ok, that is a bit more clear. It still isn't clear where you attempt to make the total of wind + solar limited to 10% of total.

In constraint m.abo_c1 you appear to be constraining the total of wind + solar to be at least 90% of the aggregate capacity you want to build, right? If that is not your intent, you should revisit that constraint

So in another constraint, you need to impose the upper limit on wind and solar and if you have (in pseudocode):

wind + solar + hydro = tot_power

and you want:

wind + solar <= 0.1 x tot_power 

Then you just need a little algebra to rearrange that to:

wind + solar <= 0.9 x hydro

I don't see that type of constraint in your model

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