Skip to content

Example can not be used. #1

@TheHuangs

Description

@TheHuangs

@mitenmistry , When I use the command "python iterative.py model2 Test" to run the example model model2, python gives such error:
ERROR: evaluating object as numeric value: Last_stage
(object: <class 'pyomo.core.base.param.SimpleParam'>)
Invalid parameter value: Last_stage[None] = 'Number_stages + 1', value
type=<class 'pyomo.core.expr.numeric_expr.NPV_SumExpression'>.
Value not in parameter domain PositiveIntegers
ERROR: Constructing component 'K' from data=None failed:
ValueError: Invalid parameter value: Last_stage[None] = 'Number_stages
+ 1', value type=<class
'pyomo.core.expr.numeric_expr.NPV_SumExpression'>.
Value not in parameter domain PositiveIntegers
Traceback (most recent call last):
File "iterative.py", line 102, in
model = initialise_hx_model(datafile)
File "E:\Softwares\MyPyomoExamp\hens-master\adaptive_model_mixer\lib\iterations_helper.py", line 215, in initialise_hx_model
instance = model.create_instance(datafile)
File "C:\Python36\lib\site-packages\pyomo\core\base\PyomoModel.py", line 735, in create_instance
profile_memory=profile_memory )
File "C:\Python36\lib\site-packages\pyomo\core\base\PyomoModel.py", line 818, in load
profile_memory=profile_memory)
File "C:\Python36\lib\site-packages\pyomo\core\base\PyomoModel.py", line 882, in _load_model_data
self._initialize_component(modeldata, namespaces, component_name, profile_memory)
File "C:\Python36\lib\site-packages\pyomo\core\base\PyomoModel.py", line 936, in _initialize_component
declaration.construct(data)
File "C:\Python36\lib\site-packages\pyomo\core\base\rangeset.py", line 83, in construct
self._end_val = value(self._end)
File "C:\Python36\lib\site-packages\pyomo\core\expr\numvalue.py", line 226, in value
tmp = obj(exception=True)
File "C:\Python36\lib\site-packages\pyomo\core\base\param.py", line 975, in call
return self[None]
File "C:\Python36\lib\site-packages\pyomo\core\base\indexed_component.py", line 348, in getitem
return self._getitem_when_not_present(index)
File "C:\Python36\lib\site-packages\pyomo\core\base\param.py", line 525, in _getitem_when_not_present
self._validate_value(index, val, _check_value_domain)
File "C:\Python36\lib\site-packages\pyomo\core\base\param.py", line 621, in _validate_value
(self.name, index, value, type(value), self.domain.name))
ValueError: Invalid parameter value: Last_stage[None] = 'Number_stages + 1', value type=<class 'pyomo.core.expr.numeric_expr.NPV_SumExpression'>.
Value not in parameter domain PositiveIntegers

hope that you can give some suggestions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions