我必须采用他们使用 PuLP 包的现有脚本。我需要知道以下行的结果如何:
unit = ["one", "two", "three"]
time = range(10)
status=LpVariable.dicts("status",[(f,g) for f in unit for g in time],0,1,LpBinary)
键/值的外观如何?
status["one"] = [0,1,1,1...]?
非常感谢您的帮助!
from pulp import *
unit = ["one", "two"]
time = range(2)
status=LpVariable.dicts("status",[(f,g) for f in unit for g in time],0,1,LpBinary)
导致
>>> status
{('two', 1): status_('two',_1),
('two', 2): status_('two',_2),
('one', 2): status_('one',_2),
('one', 0): status_('one',_0),
('one', 1): status_('one',_1),
('two', 0): status_('two',_0)}
因此,没有键为“one”的条目。