Dear Community,
Is it possible to have a square root (sqrt() or math.sqrt() or ()**0.5 or ...) in the objective function of a Pyomo ConcreteModel? I assume that it depends on the solver and so far I have tried solver=glpk, cplex and gurobi.
I obtain the following error message when using all three solvers:
Cannot write legal LP file. Objective 'OBJ' has nonlinear terms that are not quadratic.
Is there a Pyomo-compatible solver that can deal with nonlinear terms?
My goal is to minimize the root-mean-square error (
RMSE). I formulate my Objective as follows:
model.OBJ = Objective(expr = sqrt( np.mean( [(error[i]**2)*model.x[i] for i in range(N_models)] ) ) )
I wonder if the sqrt() part is even necessary or if the optimization algorithm would end up with the same solution if I defined my Objective as the mean squared error (
MSE) instead, as such:
model.OBJ = Objective(expr = np.mean( [(error[i]**2)*model.x[i] for i in range(N_models)] ))
Any ideas?
Thanks for your help!
Kind regards,
Nadja