You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using JuMP # version 0.21.10
using Clp # version 0.8.4
function decision_solver(
obj::Vector{Float64},
a::Matrix{Float64},
rhs::Vector{Float64},
ub::Vector{Float64},
lb::Vector{Float64},
maxtime::Int64,
maxiter::Int64)
model = Model(Clp.Optimizer); @variable(model, lb[i] <= x[i=1:length(lb)] <= ub[i]); @objective(model, Min, obj'x);
# Depending on the sense vector, you may need to split it into <= and >= constraints too @constraint(model, a * x .== rhs);
JuMP.set_optimizer_attribute(model, "LogLevel", 0)
JuMP.set_optimizer_attribute(model, "MaximumIterations", maxiter)
optimize!(model);
status = Symbol(lowercase(string(termination_status(model))))
if status in [:infeasible, :dual_infeasible]
JuMP.set_optimizer_attribute(model, "SolveType", 1)
optimize!(model);
status = Symbol(lowercase(string(termination_status(model))))
end
if status != :optimal
return (status, 0.0, Vector{Float64}())
end
sol = value.(x)
objval = objective_value(model)
return (status, objval, sol)
end
I inadvertently closed the previous item while attaching files.
The text was updated successfully, but these errors were encountered: