66 expression: model.QuadraticTypes,
69 """Evaluates a linear or quadratic expression for given variable values.
71 E.g. if expression = 3 * x + 4 and variable_values = {x: 2.0}, then
72 evaluate_expression(expression, variable_values) equals 10.0.
75 expression: The expression to evaluate.
76 variable_values: Must contain a value for every variable in expression.
79 The value of the expression when replacing variables by their value.
82 return model.as_flat_quadratic_expression(expression).evaluate(variable_values)
83 return model.as_flat_linear_expression(expression).evaluate(variable_values)