0
我有從.dat文件加載數據的抽象模型,如何顯示套,而params pyomo
set T := 1 2 3 4 5 6 7 8 9 10;
set F := f1 f2 f3;
set K := A B C;
set S := I II III IV;
set C := f2 f3;
param D_k :=
A 1
B 1
C 1;
param A_k :=
A 1
B 1
C 1;
,我希望能夠以可視化的集合,而params,我從主叫在.py文件.dat文件,它看起來像這樣:
from __future__ import division
from pyomo.environ import *
from coopr.pyomo import *
from objbrowser import *
import os
model = AbstractModel()
model.T = Set()
model.F = Set()
model.K = Set()
model.S = Set()
model.C = Set()
model.D_k = Param(model.K)
model.A_k = Param(model.K)
我與Spyder的,但在變量探險傢什麼也不顯示的工作,而我還試圖用model.pprint,但我得到這樣的:
4 Set Declarations
C : Dim=0, Dimen=1, Size=0, Domain=None, Ordered=False, Bounds=None
Not constructed
F : Dim=0, Dimen=1, Size=0, Domain=None, Ordered=False, Bounds=None
Not constructed
K : Dim=0, Dimen=1, Size=0, Domain=None, Ordered=False, Bounds=None
Not constructed
S : Dim=0, Dimen=1, Size=0, Domain=None, Ordered=False, Bounds=None
Not constructed
2 Param Declarations
A_k : Size=0, Index=K, Domain=Any, Default=None, Mutable=False
Not constructed
D_k : Size=0, Index=K, Domain=Any, Default=None, Mutable=False
Not constructed
6 Declarations: F K S C D_k A_k
有誰知道如何才能夠看到套,而params,才能知道自己是否被很好進口,並呼籲在.py文件時,會出現我有問題嗎?
非常感謝你提前,瓦爾
您應該創建一個使用'model.create模型的具體實例()'函數。我對AbstractModel沒有太多的工作,所以我會讓團隊成員回答。 –