lanl-ansi / Juniper.jl

A JuMP-based Nonlinear Integer Program Solver
https://lanl-ansi.github.io/Juniper.jl/stable/
MIT License
179 stars 22 forks source link

Juniper (Julia/JuMP) has the difficulty in convergence during MIP FP iterations #253

Open guanghuidatafuelx opened 1 year ago

guanghuidatafuelx commented 1 year ago

I am using Juniper in Julia/JuMP to solve a feasibility problem, whose constraints are linear. The FP iterations seem to be going on forever, having the difficulty in convergence. I am looking for help for a way to get the best feasible solution out of it.

My setting is below.

using Juniper

optimizer = Juniper.Optimizer

nl_solver= optimizer_with_attributes(Ipopt.Optimizer,"print_level" => 0) mip_solver = optimizer_with_attributes(GLPK.Optimizer)

model = Model(optimizer_with_attributes( optimizer, "nl_solver"=>nl_solver, "mip_solver"=>mip_solver))

set_optimizer_attribute(model, "mip_gap", 0.0001)
set_time_limit_sec(model, 200)

set_optimizer_attribute(model, "branch_strategy", :StrongPseudoCost)
set_optimizer_attribute(model, "traverse_strategy", :DFS)

optimize!(model)

The .nl file is here Juniper_problem1.nl.txt

The .lp file is here

Juniper_model1.lp.txt

Wikunia commented 1 year ago

Hi, thanks for opening the issue. A few questions:

guanghuidatafuelx commented 1 year ago

Hi @Wikunia

Thanks for your prompt reply.

  1. Can you pass me the syntax to save the model in Julia/JuMP to a mathoptformat file?
  2. I just tried HiGHS as a MIP solver: mip_solver = optimizer_with_attributes(HiGHS.Optimizer, "output_flag" => true). It was successful!
  3. FP took 61 seconds with No integral solution found. Please see output here Juniper_output.docx
  4. What is the syntax to set it up without feasibility pump?

Guanghui

Wikunia commented 1 year ago
  1. If I remember correctly it should work like this https://github.com/jump-dev/MathOptInterface.jl/blob/a3609e5a29c4514054b11ecfff306ea6f64dd366/docs/src/submodules/FileFormats/overview.md#write-to-file
  2. Great
  3. You might want to increase the length of the feasibility pump in this case https://lanl-ansi.github.io/Juniper.jl/stable/options/#Feasibility-Pump
  4. See 3 for a way to disable it.

Seems like it's hard to find a feasible solution though so the feasibility pump would be nice if it works to have a starting solution. It seems a bit strange on first sight that the best bound stays constant though I haven't looked at your model. Do you have maybe smaller problems of the same kind to test on?

odow commented 1 year ago

Can you pass me the syntax to save the model in Julia/JuMP to a mathoptformat file?

write_to_file(model, "model.mof.json")

guanghuidatafuelx commented 1 year ago

@odow Hi Oscar: Your line of code works. Please see the attached json file. model.mof.json.txt

@Wikunia Hi Ole: I tried to disable feasibility pump with GLPK as the mip solver.

set_optimizer_attribute(model, "feasibility_pump", false)  

and also tried to increase feasibility pump time from default 60 seconds to 120 seconds.

set_optimizer_attribute(model, "feasibility_pump_time_limit", 120) 

Both didn't solve the problem. HiGHS as mip solvers works for this feasibility problem. But if I add the linear or nonlinear objective function back, it fails.

I reduced to smaller size problems, Juniper didn't show this type of issues.