I have a few questions about how APOPT solves MINLPs.
- What nonlinear programming method APOPT uses (interior point, trust region, etc.)?
- How does APOPT deal with mixed integers (B&B, outer approximation, generalized benders decomposition,etc)?
I have a few questions about how APOPT solves MINLPs.
APOPT is an active-set Sequential Quadratic Programming (SQP) solver that uses Branch and Bound. APOPT uses a warm-start method to speed up successive Nonlinear Programming (NLP) solutions. There is more information about APOPT from Wikipedia, APMonitor documentation, and APOPT.com. There is benchmark information from a 2013 INFORMS presentation and in the 2014 APMonitor CACE paper.
Here is a sample MINLP problem solved with Python Gekko after getting the package with pip install gekko
from gekko import GEKKO
m = GEKKO() # Initialize gekko
m.options.SOLVER=1 # APOPT is an MINLP solver
# optional solver settings with APOPT
m.solver_options = ['minlp_maximum_iterations 500', \
# minlp iterations with integer solution
'minlp_max_iter_with_int_sol 10', \
# treat minlp as nlp
'minlp_as_nlp 0', \
# nlp sub-problem max iterations
'nlp_maximum_iterations 50', \
# 1 = depth first, 2 = breadth first
'minlp_branch_method 1', \
# maximum deviation from whole number
'minlp_integer_tol 0.05', \
# covergence tolerance
'minlp_gap_tol 0.01']
# Initialize variables
x1 = m.Var(value=1,lb=1,ub=5)
x2 = m.Var(value=5,lb=1,ub=5)
# Integer constraints for x3 and x4
x3 = m.Var(value=5,lb=1,ub=5,integer=True)
x4 = m.Var(value=1,lb=1,ub=5,integer=True)
m.Equation(x1*x2*x3*x4>=25)
m.Equation(x1**2+x2**2+x3**2+x4**2==40)
m.Obj(x1*x4*(x1+x2+x3)+x3) # Objective
m.solve(disp=False) # Solve
print('x1: ' + str(x1.value))
print('x2: ' + str(x2.value))
print('x3: ' + str(x3.value))
print('x4: ' + str(x4.value))
print('Objective: ' + str(m.options.objfcnval))
The iteration summary gives more information about the branch and bound process to find the solution.
----------------------------------------------
Steady State Optimization with APOPT Solver
----------------------------------------------
Iter: 1 I: 0 Tm: 0.00 NLPi: 7 Dpth: 0 Lvs: 3 Obj: 1.70E+01 Gap: NaN
--Integer Solution: 1.75E+01 Lowest Leaf: 1.70E+01 Gap: 3.00E-02
Iter: 2 I: 0 Tm: 0.00 NLPi: 5 Dpth: 1 Lvs: 2 Obj: 1.75E+01 Gap: 3.00E-02
Iter: 3 I: 0 Tm: 0.00 NLPi: 6 Dpth: 1 Lvs: 2 Obj: 1.75E+01 Gap: 3.00E-02
--Integer Solution: 1.75E+01 Lowest Leaf: 1.70E+01 Gap: 3.00E-02
Iter: 4 I: 0 Tm: 0.00 NLPi: 6 Dpth: 2 Lvs: 1 Obj: 2.59E+01 Gap: 3.00E-02
Iter: 5 I: 0 Tm: 0.00 NLPi: 5 Dpth: 1 Lvs: 0 Obj: 2.15E+01 Gap: 3.00E-02
No additional trial points, returning the best integer solution
Successful solution
---------------------------------------------------
Solver : APOPT (v1.0)
Solution time : 1.609999999345746E-002 sec
Objective : 17.5322673012512
Successful solution
---------------------------------------------------
x1: [1.3589086474]
x2: [4.5992789966]
x3: [4.0]
x4: [1.0]
Objective: 17.532267301