Hello everyone, I have a problem with optimizing my function. I keep getting an error. Could you please help me?
function optimize_Cs(Q_e, PT501, PT401, P_HP, R_m, R_p, Qp, Pe)
#calcul initial de Cs
Pe = (( ((Q_e * 0.000277778)*((PT501*1e5) - (PT401*1e5))) - ((Q_e * 0.000277778)*((PT501*1e5) - (P_HP*1e5))) )/ (R_m*R_p)) * (1/1000)
Cs = Pe / Qp
Pe = Model(Ipopt.Optimizer)
#Declaring variables
@variable(Pe, 350<= Q_e <= 450)
@variable(Pe, 2e5<= PT401 <= 5e5)
@variable(Pe, 45e5<= PT501 <= 70e5)
@variable(Pe, 25e5<= P_HP <= 42.1e5)
@variable(Pe, 125<= Qp <= 220)
@variable(Pe, 0.7<= R_m <= 0.85)
@variable(Pe, 0.7<= R_p <= 0.9)
@variable(Pe, 45<= PT502 <= 56)
#Optimisation de CS
if Cs > 3.5
println(" The specific consumption value exceeds the average value!!!")
#setting the objecjtive
@objective(Pe, Min, (( ((Q_e * 0.000277778)*((PT501*1e5) - (PT401*1e5))) - ((Q_e * 0.000277778)*((PT501*1e5) - (P_HP*1e5))) )/ (R_m*R_p)) * (1/1000))
elseif Cs < 3.5
println(" The specific consumption value is under the average value!!!")
#setting the objecjtive
@objective(Pe, Max, (( ((Q_e * 0.000277778)*((PT501*1e5) - (PT401*1e5))) - ((Q_e * 0.000277778)*((PT501*1e5) - (P_HP*1e5))) )/ (R_m*R_p)) * (1/1000))
else
return Cs
#Adding constraints
@constraint(Pe, constraint1, Cs-3.5 == 0)
@constraint(Pe, constraint2, PT502-PT501 <= 4e5)
end
#printing the optimization problem
print(Pe)
print(Cs)
#solving the optimization problem
JuMP.optimiza!(Pe)
end
the erreur:
optimize_Cs (generic function with 1 method)
PS: The programme asks the user to enter their own values at the beginning