-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Exchanger Heat Transfer Equation is Q=del_TA0U, in here U is 200 (constant)
The goal is to maximize Q, and to get the optimal value of del_T and A0
Note: Importing libraries and working directory codes are omitted here.
a=pd.read_csv('some.csv')
features=['del_T','A0']
x=a[features]
y=a['Q'] # to extract a series
Define a function
def objective(x,y,sign= -1.0): # to get maximum by using '-1' sign
x1=x[0]
x2=x[1]
x3=200
pred_Q=signx1x2*x3
return pred_Q
Set initial guess
x0=[100,100]
Use scipy.optimize.minimize function to solve the problem
solution=minimize(objective,x0,method='BFGS',args=(x,),tol=1e-06)
Result
print(solution)
fun: -138217962.454975
hess_inv: array([[ 0.49750004, -0.50249996],
[-0.50249996, 0.49750004]])
jac: array([-166266., -166266.])
message: 'Desired error not necessarily achieved due to precision loss.'
nfev: 348
nit: 1
njev: 112
status: 2
success: False
x: array([831.31811737, 831.31811737])
From the above codes,