Closed vpozdnyakov closed 1 year ago
This is by design. MIP in fact is Mixed Integer linear Program. So all constraints and objective functions need to be linear. It looks like you're trying to solve a Minimum Least Squares Problem. Maybe it's an option to replace (y_mean - y)**2 by abs(y_mean - y), so "Least Absolute Deviation", which can be linearized by: y_dev = [model.addvar() for in y_list] mode.add_constr(y_dev[i] <= y_mean - y_list[i] for i in range(len(y_list))] mode.add_constr(y_dev[i] >= y_mean - y_list[i] for i in range(len(y_list))] model.objective = sum(y_dev)
@christian2022 thank you!
Describe the bug I cannot take the power in objective function. For example, I cannot minimize the variance of the set of variables.
To Reproduce
Expected behavior Here is no the error
Desktop (please complete the following information):