lanl-ansi / Alpine.jl

A Julia/JuMP-based Global Optimization Solver for Non-convex Programs
https://lanl-ansi.github.io/Alpine.jl/latest/
Other
243 stars 39 forks source link

Precompiling Issue #136

Closed asavasci closed 4 years ago

asavasci commented 4 years ago

I am new to Alpine, having issues with precompile stage as follows

[ Info: Precompiling Alpine [07493b3f-dabb-5b16-a503-4139292d7dd4] ERROR: LoadError: LoadError: UndefVarError: Variable not defined Stacktrace: [1] getproperty(::Module, ::Symbol) at ./sysimg.jl:13 [2] top-level scope at none:0 [3] include at ./boot.jl:317 [inlined] [4] include_relative(::Module, ::String) at ./loading.jl:1044 [5] include at ./sysimg.jl:29 [inlined] [6] include(::String) at /Users/alpersavasci/.julia/packages/Alpine/k3g7z/src/Alpine.jl:3 [7] top-level scope at none:0 [8] include at ./boot.jl:317 [inlined] [9] include_relative(::Module, ::String) at ./loading.jl:1044 [10] include(::Module, ::String) at ./sysimg.jl:29 [11] top-level scope at none:2 [12] eval at ./boot.jl:319 [inlined] [13] eval(::Expr) at ./client.jl:393 [14] top-level scope at ./none:3 in expression starting at /Users/alpersavasci/.julia/packages/Alpine/k3g7z/src/tmc.jl:203 in expression starting at /Users/alpersavasci/.julia/packages/Alpine/k3g7z/src/Alpine.jl:57 ERROR: LoadError: Failed to precompile Alpine [07493b3f-dabb-5b16-a503-4139292d7dd4] to /Users/alpersavasci/.julia/compiled/v1.0/Alpine/TRSJF.ji. Stacktrace: [1] compilecache(::Base.PkgId, ::String) at ./loading.jl:1203 [2] _require(::Base.PkgId) at ./loading.jl:960 [3] require(::Base.PkgId) at ./loading.jl:858 [4] require(::Module, ::Symbol) at ./loading.jl:853 in expression starting at

how can we resolve it?

harshangrjn commented 4 years ago

Alpine currently works only with JuMP <= v0.18.5. You are probably on v0.19+, which may be the reason why you see this bug. Let me know if this fixes your issue.

asavasci commented 4 years ago

Yes, older version works with Alpine. Now, I am getting different error regarding LinearQuadraticModel as follows

LoadError: MethodError: no method matching LinearQuadraticModel(::AlpineSolver) Closest candidates are: LinearQuadraticModel(!Matched::ECOSSolver) at C:\Users\alper.julia\packages\ECOS\pP33Q\src\MPB_wrapper.jl:81 LinearQuadraticModel(!Matched::GurobiSolver) at C:\Users\alper.julia\packages\Gurobi\dlJep\src\MPB_wrapper.jl:71 LinearQuadraticModel(!Matched::CbcSolver) at C:\Users\alper.julia\packages\Cbc\rWU6K\src\MPB_wrapper.jl:33 ... in expression starting at C:\Users\alper\Desktop\uc\basicUC.jl:105

build#108(::Bool, ::Bool, ::JuMP.ProblemTraits, ::Function, ::Model) at solvers.jl:358

build at none:0 [inlined]

solve#105(::Bool, ::Bool, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Model) at solvers.jl:168

solve(::Model) at solvers.jl:150 top-level scope at none:0

harshangrjn commented 4 years ago

Can you post the problem you are trying to run here (if it's not too big)?

asavasci commented 4 years ago

basic_UC.txt

harshangrjn commented 4 years ago

Looks like your problem is just an MIQP with linear constraints, which is convex. You should be able to solve it directly using Gurobi/CPLEX. Alpine is meant for solving nonconvex programs. In any case, use @NLobjective (as your objective is quadratic) in your problem and Alpine will still try to solve it.

asavasci commented 4 years ago

When I specify @NLobjective I am getting following error

ERROR: LoadError: Problem is a MINLP and no MINLP local solver given; use minlp_solver to specify a MINLP local solver Stacktrace: [1] loadproblem!(::Alpine.AlpineNonlinearModel, ::Int64, ::Int64, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Symbol, ::JuMP.NLPEvaluator) at C:\Users\alper.julia\packages\Alpine\k3g7z\src\solver.jl:680 [2] _buildInternalModel_nlp(::Model, ::JuMP.ProblemTraits) at C:\Users\alper.julia\packages\JuMP\I7whV\src\nlp.jl:1244 [3] #build#108(::

ERROR: LoadError: Problem is a MINLP and no MINLP local solver given; use minlp_solver to specify a MINLP local solver Stacktrace: [1] loadproblem!(::Alpine.AlpineNonlinearModel, ::Int64, ::Int64, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Symbol, ::JuMP.NLPEvaluator) at C:\Users\alper.julia\packages\Alpine\k3g7z\src\solver.jl:680 [2] _buildInternalModel_nlp(::Model, ::JuMP.ProblemTraits) at C:\Users\alper.julia\packages\JuMP\I7whV\src\nlp.jl:1244 [3] #build#108(::Bool, ::Bool, ::JuMP.ProblemTraits, ::Function, ::Model) at C:\Users\alper.julia\packages\JuMP\I7whV\src\solvers.jl:305 [4] #build at .\none:0 [inlined] [5] #solve#105(::Bool, ::Bool, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Model) at C:\Users\alper.julia\packages\JuMP\I7whV\src\solvers.jl:168 [6] solve(::Model) at C:\Users\alper.julia\packages\JuMP\I7whV\src\solvers.jl:150 [7] top-level scope at none:0 in expression starting at C:\Users\alper\Desktop\uc\basicUC.jl:102

harshangrjn commented 4 years ago

If you use setsolver(uc, GurobiSolver()) instead of Alpine, you will be able to solve your problem.

This is not necessary for your problem. But if you have a nonconvex MINLP, you will need to provide a minlp_solver instead of nlp_solver. You can use this as the local MINLP solver for Alpine: https://github.com/lanl-ansi/Juniper.jl

asavasci commented 4 years ago

Okay. Thanks for your time

harshangrjn commented 4 years ago

Closing the issue for now. If you encounter anything else, feel free to open this back.

asavasci commented 4 years ago

Having issues with Juniper solver call. I slightly changed my problem into an MINLP, but JuniperSolver() seems not supported by JuMP 0.18. Could you please verify it? basic_UC_v2.txt

Wikunia commented 4 years ago

I currently can't test it easily as I have the newest versions installed but I think you simply have to use JuniperSolver(IpoptSolver(print_level=0)) instead of just JuniperSolver as Juniper needs a nlp solver. You're probably using v0.3.0 of Juniper which is described here: https://lanl-ansi.github.io/Juniper.jl/v0.3/

asavasci commented 4 years ago

I tested Juniper on separate example given here : https://lanl-ansi.github.io/Juniper.jl/v0.3/. Juniper is working. However, I am getting the following error

LoadError: Unsupported MINLP local solver Juniper.JuniperSolverObj(IpoptSolver(Tuple[(:print_level, 0)]), log_levels : Symbol[:Options, :Table, :Info] atol : 1.0e-6 num_resolve_root_relaxation : 3 branch_strategy : StrongPseudoCost gain_mu : 0.167 strong_branching_perc : 100.0 strong_branching_nsteps : 1 strong_branching_approx_time_limit : 100.0 strong_restart : true reliability_branching_threshold : 5 reliability_branching_perc : 25.0 incumbent_constr : false obj_epsilon : 0.0 time_limit : Inf mip_gap : 0.0001 best_obj_stop : NaN solution_limit : 0 all_solutions : false list_of_solutions : false processors : 1 traverse_strategy : BFS feasibility_pump : false feasibility_pump_time_limit : 60.0 feasibility_pump_tolerance_counter : 5 tabu_list_length : 30 num_resolve_nlp_feasibility_pump : 1 mip_solver : NA force_parallel : false debug : false debug_write : false debug_file_path : debug.json fixed_gain_mu : false ); use a Alpine-supported MINLP local solver in expression starting at C:\Users\alper\Desktop\uc\Deterministic_UC.jl:103 error(::String) at error.jl:33

fetch_minlp_solver_identifier#338(::String, ::Function, ::Alpine.AlpineNonlinearModel) at utility.jl:794

fetch_minlp_solver_identifier at utility.jl:771 [inlined] loadproblem!(::Alpine.AlpineNonlinearModel, ::Int64, ::Int64, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Symbol, ::JuMP.NLPEvaluator) at solver.jl:722 _buildInternalModel_nlp(::Model, ::JuMP.ProblemTraits) at nlp.jl:1244

build#108(::Bool, ::Bool, ::JuMP.ProblemTraits, ::Function, ::Model) at solvers.jl:305

build at none:0 [inlined]

solve#105(::Bool, ::Bool, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Model) at solvers.jl:168

solve(::Model) at solvers.jl:150 top-level scope at none:0