如何在PYOMO中排序参数?
我正在使用PYOMO软件包(用于Python中的数学建模)。我的参数定义为:model.d = param(model.t,model.i)。这是一个多维参数。 t是针对时间段的范围,我适用于实例范围,d是需求的价值。我如何通过其值对此参数进行排序,并获取相应的t和i?
I am working with the Pyomo package(for mathematical modeling in python).I have a parameter defined as: model.D=Param(model.t,model.i) .this is a multi-dimensional parameter. t is for the range of time periods, i is for the range of instances and D is the value of the demand. how can I sort this parameter by its value and get the corresponding t and i ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在建立模型之前,请使用基本的Python 进行所有数据清洁/排序。答案的一部分取决于数据的原始格式和您想要的答案格式,但我认为总体要素很明确。...
代码
产量:
Do all that data cleaning/sorting stuff with basic python before you build the model. Part of this answer depends on the original format of the data and the format you'd like your answer in, but I think the overall gist is clear....
Code
Yields: