sustainable-processes / summit

Optimising chemical reactions using machine learning
https://gosummit.readthedocs.io/en/latest/
MIT License
120 stars 25 forks source link

`Domain.to_dict()` doesn't include information for `maximize` of objectives #231

Closed jb2197 closed 1 year ago

jb2197 commented 1 year ago

Description

When trying to print out the constructed domain, the maximize of the objectives is not presented in the dictionary.

What I Did

from summit.domain import Domain
from summit.domain import ContinuousVariable
domain = Domain()
domain += ContinuousVariable(
    name='name',
    description='description',
    bounds=[-5, 5],
    is_objective=True,
    maximize=True
)
domain += ContinuousVariable(
    name='name',
    description='description',
    bounds=[-50, 50],
    is_objective=True,
    maximize=False
)
print(domain.to_dict())

Outputs:

[{'type': 'ContinuousVariable',
  'is_objective': True,
  'name': 'name',
  'description': 'description',
  'units': None,
  'bounds': [-5.0, 5.0]},
 {'type': 'ContinuousVariable',
  'is_objective': True,
  'name': 'name',
  'description': 'description',
  'units': None,
  'bounds': [-50.0, 50.0]}]