-
Notifications
You must be signed in to change notification settings - Fork 49
Add hs67
#235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
It misses the JuMP implementation |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #235 +/- ##
==========================================
- Coverage 99.87% 99.78% -0.09%
==========================================
Files 766 768 +2
Lines 7011 7056 +45
==========================================
+ Hits 7002 7041 +39
- Misses 9 15 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @odow ! Sorry to bother you, but any chance you would have a suggestion to make a JuMP model for this one? |
Two options jump out:
let me have a go |
|
It's not quite the same, but perhaps:
function yvec(x)
y = similar(x, 8)
yc = 1.6x[1]
while true
y[2] = yc
y[3] = 1.22y[2] - x[1]
y[6] = (x[2] + y[3]) / x[1]
yc = 0.01x[1] * (112 + 13.167y[6] - 0.6667y[6]^2)
if abs(yc - y[2]) <= 0.001
break
end
end
yc = 93
while true
y[4] = yc
y[5] = 86.35 + 1.098y[6] - 0.038y[6]^2 + 0.325(y[4] - 89)
y[8] = 3y[5] - 133
y[7] = 35.82 - 0.222y[8]
yc = 98_000x[3] / (y[2] * y[7] + 1_000x[3])
if abs(yc - y[4]) <= 0.001
break
end
end
return y
end
k_iter = 10
a = [0, 0, 85, 90, 3, 0.01, 145, 5_000, 2_000, 93, 95, 12, 4, 162]
using JuMP, Ipopt
model = Model(Ipopt.Optimizer)
x0 = [1_745, 12_000, 110.0]
ub = [2e3, 1.6e4, 1.2e2]
@variable(model, 1e-5 <= x[i=1:3] <= ub[i], start = x0[i])
@variable(model, y[i=1:8, 1:k_iter])
@variable(model, y_actual[i=1:8])
for k in 1:k_iter
if k == 1
@constraint(model, y[2, 1] == 1.6x[1])
@constraint(model, y[4, 1] == 93)
else
@NLconstraint(model, y[2, k] == 0.01x[1] * (112 + 13.167y[6, k-1] - 0.6667y[6, k-1]^2))
@NLconstraint(model, y[4, k] == 98_000x[3] / (y[2, k_iter] * y[7, k-1] + 1_000x[3]))
end
@constraint(model, y[3, k] == 1.22y[2, k] - x[1])
@NLconstraint(model, y[6, k] == (x[2] + y[3, k]) / x[1])
@constraint(model, y[5, k] == 86.35 + 1.098y[6, k_iter] - 0.038y[6, k_iter]^2 + 0.325(y[4, k] - 89))
@constraint(model, y[8, k] == 3y[5, k] - 133)
@constraint(model, y[7, k] == 35.82 - 0.222y[8, k])
end
@objective(model, Min, -(0.063y[2, k_iter] * y[5, k_iter] - 5.04x[1] - 3.36y[3, k_iter] - 0.035x[2] - 10x[3]))
@constraint(model, [i=1:7], y[i+1] - a[i] >= 0)
@constraint(model, [i=8:14], a[i] - y[i-6] >= 0)
optimize!(model)
x_sol = value.(x)
y_sol = yvec(x_sol)
x, y = x_sol, y_sol
-(0.063y[2] * y[5] - 5.04x[1] - 3.36y[3] - 0.035x[2] - 10x[3])JuMP isn't really built for expression graphs of varying size. |
|
Ok, I get the idea. Thanks for your help! |


#113