Ignore:
Timestamp:
Jun 28, 2012 6:14:38 PM (7 years ago)
Author:
jwatson
Message:

Fixing a number of issues with PySP relating to upgrading the Param mutable=True to mutable=False by default. Baseline changes to follow. Most of these changes relate to bad uses of "()" instead of "value()".

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.pysp/trunk/coopr/pysp/wwphextension.py

    r5775 r5930  
    431431                    # is a singleton. this case be cleaned up when the source issue in Pyomo is fixed.
    432432                    if (len(parameter_index_set) is 1) and (None in parameter_index_set):
    433                         new_stat_parameter = Param(name=new_stat_parameter_name, default=0.0)
     433                        new_stat_parameter = Param(name=new_stat_parameter_name, default=0.0, mutable=True)
    434434                    else:
    435                         new_stat_parameter = Param(parameter_index_set, name=new_stat_parameter_name, default=0.0)
     435                        new_stat_parameter = Param(parameter_index_set, name=new_stat_parameter_name, default=0.0, mutable=True)
    436436                    for newindex in parameter_index_set:
    437437                        new_stat_parameter[newindex] = 0
     
    442442                    new_conv_parameter = None
    443443                    if (len(parameter_index_set) is 1) and (None in parameter_index_set):
    444                         new_conv_parameter = Param(name=new_conv_parameter_name, default=0.0)
     444                        new_conv_parameter = Param(name=new_conv_parameter_name, default=0.0, mutable=True)
    445445                    else:
    446                         new_conv_parameter = Param(parameter_index_set, name=new_conv_parameter_name, default=0.0)
     446                        new_conv_parameter = Param(parameter_index_set, name=new_conv_parameter_name, default=0.0, mutable=True)
    447447                    for newindex in parameter_index_set:
    448448                        new_conv_parameter[newindex] = 0.5 # not an int, so harmless
     
    453453                    new_fix_parameter = None
    454454                    if (len(parameter_index_set) is 1) and (None in parameter_index_set):
    455                         new_fix_parameter = Param(name=new_fix_parameter_name, default=0.0)
     455                        new_fix_parameter = Param(name=new_fix_parameter_name, default=0.0, mutable=True)
    456456                    else:
    457                         new_fix_parameter = Param(parameter_index_set, name=new_fix_parameter_name, default=0.0)
     457                        new_fix_parameter = Param(parameter_index_set, name=new_fix_parameter_name, default=0.0, mutable=True)
    458458                    for newindex in parameter_index_set:
    459459                        new_fix_parameter[newindex] = False
     
    464464                    new_hash_parameter = None
    465465                    if (len(parameter_index_set) is 1) and (None in parameter_index_set):
    466                         new_hash_parameter = Param(ph._iteration_index_set, name=new_hash_parameter_name, default=0.0)
     466                        new_hash_parameter = Param(ph._iteration_index_set, name=new_hash_parameter_name, default=0.0, mutable=True)
    467467                        for new_index in ph._iteration_index_set:
    468468                            new_hash_parameter[new_index] = 0                       
    469469                    else:
    470                         new_hash_parameter = Param(parameter_index_set * ph._iteration_index_set, name=new_hash_parameter_name, default=0.0)
     470                        new_hash_parameter = Param(parameter_index_set * ph._iteration_index_set, name=new_hash_parameter_name, default=0.0, mutable=True)
    471471                        for new_index in new_hash_parameter:
    472472                            new_hash_parameter[new_index] = 0
Note: See TracChangeset for help on using the changeset viewer.