'Non-constant expressions cannot be multiplied - PuLP Package

I am working on an optimisation problem for which I am using PuLP lienar programming package. Please find my linear programming model parameters below: #model model = LpProblem(name="variable_rate", sense = LpMaximize)

Defining variable

var_rate = LpVariable.dicts("variable_rate", len, lowBound=10, upBound=26, cat='integer')

expression = variable_xvar_ratevar_rate #part of the expression

I get the error 'TypeError: Non-constant expressions cannot be multiplied'

So, if my expression involves multiplication of the LpVariable, I get this error. I read that PuLP is a linear programming package and accepts only addition or subtraction within the LpVariable. But I need to have that multiplication factor in my expression. Is there a way I can solve this problem with PuLP or do you suggest any other optimisation package.

Thank you in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source