import HiGHS import Ipopt import Juniper using JuMP function test() optimizer = Juniper.Optimizer nl_solver= optimizer_with_attributes(Ipopt.Optimizer, "print_level" => 0) mip_solver = optimizer_with_attributes(HiGHS.Optimizer, "output_flag" => true) model = Model(optimizer_with_attributes( optimizer, "nl_solver"=>nl_solver, "mip_solver"=>mip_solver, "log_levels"=>[:Info, :Table, :Timing, :AllOptions])) # 6 fails. 5 works. problem_size = 6 # x .>= 0, sum(x) >= 4 @variable(model, x[1:problem_size], integer=true) @constraint(model, x .>= zeros(Int, problem_size)) @constraint(model, sum(x[i] for i in 1:problem_size) >= 4) # Minimize sum(x.^2) # Works if integer = false> @variable(model, x_squared[1:problem_size], integer=true) for i in 1:problem_size @NLconstraint(model, x_squared[i] == x[i] ^ 2) end @NLobjective(model, Min, x_squared[1] + x_squared[2] + x_squared[3] + x_squared[4] + x_squared[5] + x_squared[6]) # Also fails. #@NLobjective(model, Min, sum(x_squared[i] for i in 1:problem_size)) optimize!(model) #= @show termination_status(model) @show primal_status(model) solution_summary(model) println(value.(model[:x])) =# return model end @time m = test()