Transportation problem: Difference between revisions

→‎{{header|Julia}}: swap optimizers: GLPK for Ipopt (produces integer solutions)
(→‎{{header|R}}: fix double output line)
(→‎{{header|Julia}}: swap optimizers: GLPK for Ipopt (produces integer solutions))
Line 2,496:
=={{header|Julia}}==
Code taken from [https://github.com/dylanomics/transportation_problem here] using [https://jump.dev/JuMP.jl/stable/ JuMP].
<lang julia>using JuMP, IpoptGLPK
 
# cost vector
Line 2,512:
 
# construct model
model = Model(IpoptGLPK.Optimizer)
@variable(model, x[i=1:N] >= 0, base_name="traded quantities")
cost_fn = @expression(model, c'*x) # cost function
Line 2,531:
 
{{out}}
<pre>solution vector of quantities = [20.0000000087470480, 0.0, 45.99999964907831450, 0.0, 30.0000000074940980, 5.00000035092168550]
minimum total cost = 179180.999999275674360</pre>
 
=={{header|Kotlin}}==