If we try to add an int with an objective function we get the following error:
from tests.utils import Dummy
phi = Dummy(3)
1 + phi
ValueError: Cannot add objective function 'φ(m)' with '1'. Objective functions cannot be added to integers other than zero.
But if we try to do the same with a float, we get something not so straight forward:
AttributeError: 'float' object has no attribute 'n_params'
We should improve this error by adding another check in the __add__ and __radd__ of the ii.base.Objective class.
If we try to add an int with an objective function we get the following error:
But if we try to do the same with a float, we get something not so straight forward:
We should improve this error by adding another check in the
__add__and__radd__of theii.base.Objectiveclass.