I am trying to use gekko for optimization, but I am getting error - 13 (If I use the commented equation (see below) and an error code 2 if I use different version of that equation). Kindly guide how to solve this. I am unable to get a solution. I tried to add a lower bound, but still it is not working. The two equations are same, one is with log y and other one is with y value.
import numpy as np
from gekko import GEKKO
import pandas as pd
import matplotlib.pyplot as plt
import math
# Data points
xm = np.array([0.122, 0.276, 0.303, 0.356, 0.384, 0.444, 0.662 , 0.779, 0.867, 0.964 ,1.09, 1.17, 1.3, 1.33 ,1.41])
ym = np.array([0.00515, 0.00297, 0.00271, 0.00249, 0.00228, 0.00216, 0.0016, 0.00139, 0.0013, 0.00116, 0.00105, 0.00101, 0.000888, 0.000904, 0.000854])
# Define GEKKO model
# Parameters and variable
m = GEKKO(remote=False)
a= m.FV(lb=-4000.0,ub=-4000.0)
b= m.FV(lb=-4000.0,ub=-4000.0)
lower = 1e-4
x =m.Param(value=xm)
y_measure = m.Param(value =ym)
y_predict=m.Var(lb = lower)
# Parameters and variable options
# 1 = avaiable to optimizer to minimize objective
a.status = 1
b.status = 1
# Equation
m.Equation(m.log(y_predict) == a + b * m.log (x))
#m.Equation(y_predict == m.exp(a + b * m.log (x)))
# Objective
m.Minimize(((y_predict-y_measure)/y_measure)**2)
# application options
m.options.IMODE = 2 # regression mode
# m.options.SOLVER=1
# solve
m.solve() # remote=False for local solve
# show final objective
print('Final SSE Objective: ' + str(m.options.objfcnval))
# print solution
print('Solution')
print('a = ' + str(a.value[0]))
print('b = ' + str(b.value[0]))