jump-dev / AmplNLWriter.jl

A Julia interface to AMPL-enabled solvers
http://ampl.com/products/solvers/all-solvers-for-ampl/
MIT License
67 stars 18 forks source link

Slow invocation? #20

Closed ulneva closed 6 years ago

ulneva commented 8 years ago

I am trying AmplNKWriter with Knitro. The code is working reasonably fast with JuMP+Knitro (Knitro is called within seconds, problem is solved in around 300 sec), however when AmplNLWriter is used, I have been waiting for 25 minutes, but I do not see any signs of knitroampl being invoked, while the physical memory usage almost tripled compared to JuMP+Knitro. Any suggestions? The code is attached. Thank you! TestOptProblem9_2.txt

adowling2 commented 7 years ago

I am having similar issues with AmplNLWriter and SCIP.

Edit: Below is an error I get for a big model.

julia> m2
Maximization problem with:
 * 1375622 linear constraints
 * 105120 quadratic constraints
 * 1 nonlinear constraint
 * 1016181 variables: 26280 binary
Solver is AmplNL
SCIP version 4.0.0 [precision: 8 byte] [memory: block] [mode: optimized] [LP solver: CPLEX 12.6.3.0] [GitHash: a80a247]
Copyright (C) 2002-2017 Konrad-Zuse-Zentrum fuer Informationstechnik Berlin (ZIB)

External codes:
  CPLEX 12.6.3.0       Linear Programming Solver developed by IBM (www.cplex.com)
  CppAD 20160000.1     Algorithmic Differentiation of C++ algorithms developed by B. Bell (www.coin-or.org/CppAD)
  Ipopt 3.12.4         Interior Point Optimizer developed by A. Waechter et.al. (www.coin-or.org/Ipopt)
  ASL                  AMPL Solver Library developed by D. Gay (www.netlib.com/ampl)

number of parameters = 2137
non-default parameter settings:
limits/time = 3600
limits/gap = 0.001

read problem </home/adowling2/.julia/v0.5/AmplNLWriter/.solverdata/tmpAuaA5T.nl>
============

ERROR: LoadError: SystemError: opening file /home/adowling2/.julia/v0.5/AmplNLWriter/.solverdata/tmpAuaA5T.sol: No such file or directory
 in #systemerror#51 at ./error.jl:34 [inlined]
 in systemerror(::String, ::Bool) at ./error.jl:34
 in open(::String, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./iostream.jl:89
 in open(::String, ::String) at ./iostream.jl:101
 in read_sol(::AmplNLWriter.AmplNLMathProgModel) at /home/adowling2/.julia/v0.5/AmplNLWriter/src/AmplNLWriter.jl:596
 in read_results(::AmplNLWriter.AmplNLMathProgModel) at /home/adowling2/.julia/v0.5/AmplNLWriter/src/AmplNLWriter.jl:532
 in optimize!(::AmplNLWriter.AmplNLMathProgModel) at /home/adowling2/.julia/v0.5/AmplNLWriter/src/AmplNLWriter.jl:387
 in optimize!(::AmplNLWriter.AmplNLNonlinearModel) at /home/adowling2/.julia/v0.5/AmplNLWriter/src/AmplNLWriter.jl:722
 in #solvenlp#150(::Bool, ::Function, ::JuMP.Model, ::JuMP.ProblemTraits) at /home/adowling2/.julia/v0.5/JuMP/src/nlp.jl:1208
 in (::JuMP.#kw##solvenlp)(::Array{Any,1}, ::JuMP.#solvenlp, ::JuMP.Model, ::JuMP.ProblemTraits) at ./<missing>:0
 in #solve#97(::Bool, ::Bool, ::Bool, ::Array{Any,1}, ::Function, ::JuMP.Model) at /home/adowling2/.julia/v0.5/JuMP/src/solvers.jl:139
 in solve(::JuMP.Model) at /home/adowling2/.julia/v0.5/JuMP/src/solvers.jl:117
 in include_from_node1(::String) at ./loading.jl:488
while loading /home/adowling2/git/DowSolarThermal/Code/CSPOptimization/EconomicDesign/max_NPV.jl, in expression starting on line 139
mlubin commented 7 years ago

Any reason why you prefer AmplNLWriter over SCIP.jl?

adowling2 commented 7 years ago

I am having trouble getting SCIP.jl to work for this problem (and some variants). I have initialization code before the solve statement to ensure the initial point is feasible. (Which I check with DegeneracyHunter.jl). When I use AmplNLWriter.jl for another variant of this model, SCIP says the initial point is feasible and the pre-solve takes ~10 seconds. For the same problem variant, however, SCIP.jl says the initial point is infeasible and pre-solve takes > 1 hour. SCIP tells me which equation is infeasible, but I don't believe it. I am trying to get a reproducible smaller example, which I'll post as an issue to SCIP.jl.

adowling2 commented 7 years ago

@mlubin I reported the issue described above as bug in SCIP.jl.

I dug into my issue with AmplNLPWriter more. It turns out the MINLP is too large. SCIP uses more than 150GB of memory while loading the problem. The OS then kills scipampl, hence the missing solution file.

odow commented 6 years ago

Closing as other than being slow, this doesn't appear to be a problem with AmplNLWriter. We also have a better error message for the second issue.