if not model.has_discrete_variables() and model.Enforce_Carbon_Cap[period] in model.dual:
I'm getting a key error, so I'm guessing it's in the dictionary reference in Enforce_Carbon_Cap.
Thanks!
Traceback (most recent call last):
File "/Users/bradvenner/opt/anaconda3/envs/switch2/bin/switch", line 10, in <module>
sys.exit(main())
File "/Users/bradvenner/opt/anaconda3/envs/switch2/lib/python3.6/site-packages/switch_model/main.py", line 39, in main
main()
File "/Users/bradvenner/opt/anaconda3/envs/switch2/lib/python3.6/site-packages/switch_model/solve.py", line 183, in main
instance.post_solve()
File "/Users/bradvenner/opt/anaconda3/envs/switch2/lib/python3.6/site-packages/switch_model/utilities.py", line 252, in post_solve
module.post_solve(instance, outputs_dir)
File "/Users/bradvenner/opt/anaconda3/envs/switch2/lib/python3.6/site-packages/switch_model/policies/carbon_policies.py", line 98, in post_solve
values=get_row)
File "/Users/bradvenner/opt/anaconda3/envs/switch2/lib/python3.6/site-packages/switch_model/reporting/__init__.py", line 85, in write_table
for x in itertools.product(*indexes)
File "/Users/bradvenner/opt/anaconda3/envs/switch2/lib/python3.6/site-packages/switch_model/reporting/__init__.py", line 85, in <genexpr>
for x in itertools.product(*indexes)
File "/Users/bradvenner/opt/anaconda3/envs/switch2/lib/python3.6/site-packages/switch_model/policies/carbon_policies.py", line 82, in get_row
if not model.has_discrete_variables() and model.Enforce_Carbon_Cap[period] in model.dual:
File "/Users/bradvenner/opt/anaconda3/envs/switch2/lib/python3.6/site-packages/pyomo/core/base/indexed_component.py", line 555, in __getitem__
return self._getitem_when_not_present(index)
File "/Users/bradvenner/opt/anaconda3/envs/switch2/lib/python3.6/site-packages/pyomo/core/base/indexed_component.py", line 839, in _getitem_when_not_present
raise KeyError(index)
KeyError: 2021