LDLFactorizations tutorial
This tutorial shows how to use the LDLFactorizations.jl linear solver to solve a problem from the CUTEst.jl (see this tutorial) collection with Penelopt.jl.
Penelopt.jl uses an extension to load the LDLFactorizations.jl linear solver. Therefore, you need to load LDLFactorizations.jl. Our algorithm will throw a warning and switch to the default MUMPS solver if you try to use LDLFactorizations without loading the required package.
1. Load a CUTEst problem
In this example, we choose a medium size problem MSS1.
using CUTEst
nlp = CUTEstModel("MSS1")2. Load LDLFactorizations
using LDLFactorizations3. Solve with Penelopt
using Penelopt
stats = L2Penalty(nlp; linear_solver = :ldlt, print_level = 1)┌ Info:
│ This is Penelopt.jl v1.0.0.
│ Running with linear solver LDLFactorizations.jl v0.10.2.
│
│ Problem name: MSS1
│ All variables: ████████████████████ 90 All constraints: ████████████████████ 73
│ free: ████████████████████ 90 free: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
│ lower: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0 lower: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
│ upper: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0 upper: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
│ low/upp: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0 low/upp: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
│ fixed: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0 fixed: ████████████████████ 73
│ infeas: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0 infeas: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
│ nnzh: ( 49.45% sparsity) 2070 linear: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
│ nonlinear: ████████████████████ 73
│ nnzj: ( 94.25% sparsity) 378
│ lin_nnzj: (------% sparsity)
│ nln_nnzj: ( 94.25% sparsity) 378
│
└
[ Info: ------------------------------------------------------------------------------------------------------
[ Info: Iter sIter Objective pfeas dfeas τ ptol dtol ‖x‖
[ Info: ------------------------------------------------------------------------------------------------------
[ Info: 0 0 -4.0500000e+03 8.90e+01 8.79e-14 1.10e+02 1.00e+00 1.49e-08 9.49e+00
[ Info: 1 0 -4.0500000e+03 8.90e+01 8.79e-14 1.11e+02 1.00e+00 1.49e-08 9.49e+00
[ Info: 2 123 -1.6000000e+01 1.20e-11 3.31e-09 1.11e+02 1.34e-06 1.49e-08 1.00e+00
┌ Info:
│ Number of Iterations: 2
│
│
│ Objective...........: -1.600000000986272e+01
│ Primal Feasibility..: 1.200100088749601e-11
│ Dual Feasibility....: 3.308044276605830e-09
│
│
└ EXIT: first_order.println("status : ", stats.status)
println("objective : ", stats.objective)
println("solution : ", stats.solution)status : first_order
objective : -16.000000009862717
solution : [4.304671752152407e-11, -1.3571950287652918e-11, 0.10993118175443975, 0.20719496868028187, 0.18635822884443187, 0.1666451635965828, 0.10993118184474449, 0.20719496867291345, 0.07642704702853426, -0.04054980514712188, 0.10993118226269565, 0.20719496857279485, 0.07642704718197657, -0.04054980512427653, 0.10993118200616964, 0.20719496862201864, 0.07642704677920233, -0.040549805084338864, 0.18635822897942736, 0.16664516344394265, 9.80246659711139e-11, -5.2008827340127774e-11, -4.994988729277139e-11, 8.455501658780771e-11, 0.076427046989114, -0.04054980510303849, 0.10993118190814499, 0.20719496867402748, 1.0761679383696757e-10, -3.392987576565915e-11, 6.8196588185799e-11, 1.015349015966963e-11, 0.07642704688681913, -0.04054980511826873, 0.1099311820695702, 0.20719496862313264, 0.0764270470687938, -0.04054980512214587, 0.10993118185726047, 0.20719496863731254, 6.819658846953269e-11, 1.0153490102573324e-11, 0.10993118195878798, 0.20719496865109646, 0.07642704692305255, -0.04054980507957247, 1.076167941312174e-10, -3.392987586152904e-11, 0.10993118238393326, 0.20719496856453706, 0.0764270465570376, -0.04054980505913813, 6.819658816975755e-11, 1.015349005880848e-11, 1.0761679448819607e-10, -3.392987599100435e-11, 0.07642704683248493, -0.04054980504310423, 0.10993118200616968, 0.20719496862201864, 0.07642704708447777, -0.040549805130467305, 0.10993118185726049, 0.20719496863731254, 6.819658820896086e-11, 1.015349022566287e-11, 0.07642704703014354, -0.04054980505530278, 1.1720892104559421e-10, -1.58509237056459e-11, 1.1720892139639383e-10, -1.5850923727726583e-11, 3.906964071902489e-11, -5.283641418326814e-12, 0.07642704668786106, -0.0405498050822125, 0.10993118216733548, 0.2071949686298256, 3.90696406208054e-11, -5.2836413201477515e-12, 0.10993118196941391, 0.2071949686711239, 0.07642704695903821, -0.04054980513341768, 3.906964057542662e-11, -5.283641257741802e-12, 0.07642704712739454, -0.040549805141653475, 0.109931181727802, 0.20719496868926657]4. Finalize the CUTEst model
Once the CUTEst problem has been used, you should finalize it, see the CUTEst documentation.
finalize(nlp)