Source code for biogeme.expressions.unary_expressions
"""Arithmetic expressions accepted by Biogeme: unary operators:author: Michel Bierlaire:date: Sat Sep 9 15:51:53 2023"""from__future__importannotationsimportloggingfrom.base_expressionsimportExpression,ExpressionOrNumericfrom.convertimportvalidate_and_convertlogger=logging.getLogger(__name__)
[docs]classUnaryOperator(Expression):""" Base class for arithmetic expressions that are unary operators. Such an expression is the result of the modification of another expressions, typically changing its sign. """def__init__(self,child:ExpressionOrNumeric):"""Constructor :param child: first arithmetic expression :type child: biogeme.expressions.Expression :raise BiogemeError: if one of the expressions is invalid, that is neither a numeric value nor a biogeme.expressions.Expression object. """super().__init__()self.child=validate_and_convert(child)self.children.append(self.child)