BYU-PRISM / GEKKO

GEKKO Python for Machine Learning and Dynamic Optimization
https://machinelearning.byu.edu
Other
580 stars 103 forks source link

Adjust names of variables and parameters to replace strings and special characters with underscore #53

Closed jjpantano closed 5 years ago

jjpantano commented 5 years ago

Would like to suggest improved readability of names by replacing special characters and spaces with an underscore.

For example the name, 'pseudo effective Heat Transfer Coefficient (W/m2-K)' instead of current value of 'pseudoeffectiveheattransfercoefficeintwm2k' can become 'pseudo_effective_heat_transfer_coefficient_w_m2k' with name = re.sub('[^0-9a-zA-Z]+', '_',t).lower()

Looks like APM doesn't like upper case and the fix was accomplished with def MV(self, value=None, lb=None, ub=None, integer=False, fixed_initial=True, name=None): """Change these variables optimally to meet objectives""" if name is not None: name = re.sub(r'\W+', '', name).lower() else: name = 'p' + str(len(self.parameters) + 1) if integer == True: name = 'int'+name

abe-mart commented 5 years ago

I just made this change, and it should be included in the next test release.