Speed up Ipopt solver

Hello,

I have a non-linear problem which I am solving with Ipopt and JuMP. The problem originally spans over around 70 days (divided in quarter-hourly periods), but I have started to solve the model for less periods. The problem aims to maximize expected profits of a market participant subject to prices which can be bid in auctions.

When I run the problem for one day (96 periods) Ipopt finds a solution after around 20 Seconds. When I change the period length to two days, it runs for ages and until now did not find a solution. The same happens if I change the number of periods to less than a day (i.e. 16 quarter-hourly periods) or if I relax some boundaries on the prices that can be offered.

I am new to Julia and therefore struggling what to do now. I would be very thankful for advice on how I can proceed when facing such a problem.

Nonlinear optimization problems can be notoriously tricky to solve. Sometimes a model can fail for no apparent reason, even when just changing a few parameters. Some things you can try:

  • If possible, set upper and lower bounds on all variables. Use your knowledge of the system you’re modeling to make them as tight as possible without eliminating physically possible solutions.
  • Use “warm starts” whenever you can. That is, give reasonable starting values to all variables. You can e.g. use the output of a previous model run with different parameters, or a simplified linear model. In your case, since the model solved for a single day, you might try using optimal variable values from the 1-day run as starting values for both days in the 2-day run.
  • Experiment with solver parameters. In some nonlinear energy system models I’ve worked with, setting the IPOPT parameter “mu_strategy” to “adaptive” decreases solve time and helps stability. But settings like this can be quite problem specific.
  • Another more advanced IPOPT technique: try using a different internal linear solver (see this section of the README). Switching to HSL MA86 was a significant improvement in our latest model, and was well worth the extra effort in manual compilation and needing to run IPOPT (and all of Julia) in Linux instead of Windows. No need for an extra Linux machine, running it in Windows Subsystem for Linux worked perfectly.

Just some immediate ideas off the top of my head. There are lots of other tricks that may work, so let’s see if others chime in with more.

3 Likes

Hi @Katti,

@NiclasMattsson offers some great points, particularly switching to HSL for larger problems.

But it’s hard to offer suggestions without a reproducible example.

Can you provide a log (the stuff Ipopt prints) of the solves?

  • How many variables and constraints?
  • How long does each iteration take?
  • What is the solution status?

It also depends on the form of model.

  • What is the nonlinearity? You’re talking about prices. Is there a price * quantity term? If so, that is non-convex. While it ca support non-convex terms, Ipopt is intended for convex problems, so if there are lots of non-convexities that could explain things.

Hi @odow,

thanks a lor for your answer.

See below the Ipopt output for the one day example:

This program contains Ipopt, a library for large-scale nonlinear optimization.
Ipopt is released as open source code under the Eclipse Public License (EPL).
For more information visit GitHub - coin-or/Ipopt: COIN-OR Interior Point Optimizer IPOPT


This is Ipopt version 3.14.4, running with linear solver MUMPS 5.4.1.

Number of nonzeros in equality constraint Jacobian…: 3840
Number of nonzeros in inequality constraint Jacobian.: 960
Number of nonzeros in Lagrangian Hessian…: 0

Total number of variables…: 10206
variables with only lower bounds: 9684
variables with lower and upper bounds: 0
variables with only upper bounds: 522
Total number of equality constraints…: 1056
Total number of inequality constraints…: 576
inequality constraints with only lower bounds: 192
inequality constraints with lower and upper bounds: 0
inequality constraints with only upper bounds: 384

iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
0 2.1790176e+03 9.90e-01 5.60e+01 0.0 0.00e+00 - 0.00e+00 0.00e+00 0
1 2.1245795e+05 8.07e-01 2.99e+02 0.5 5.40e+00 - 4.16e-03 9.90e-01f 1
2 3.7737365e+05 7.60e-01 8.39e+02 0.8 6.74e+01 - 4.90e-02 5.88e-02f 1
3 7.3672881e+05 8.11e-01 4.33e+04 1.8 4.28e+02 - 8.58e-02 2.54e-02f 1
4 1.2217455e+06 7.86e-01 5.55e+04 1.7 2.31e+02 - 1.06e-01 7.71e-02f 1
5 1.3557349e+06 6.87e-01 2.85e+05 1.4 4.50e+01 - 1.00e+00 1.26e-01f 1
6 1.4493227e+06 6.45e-01 1.25e+06 1.9 9.42e+01 - 1.00e+00 1.43e-01f 1
7 1.4229630e+06 4.76e-01 1.64e+06 2.0 4.45e+01 - 1.00e+00 4.25e-01f 1
8 1.3612846e+06 4.19e-01 4.28e+05 1.8 5.55e+01 - 1.00e+00 8.67e-01f 1
9 1.2940972e+06 3.02e-01 1.79e+07 2.2 9.27e+01 - 1.00e+00 5.14e-01f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
10 1.3291560e+06 3.05e-02 9.86e+04 1.4 5.90e+02 - 7.08e-01 8.99e-01f 1
11 1.4307836e+06 9.67e-03 4.87e+07 1.6 1.72e+02 - 1.00e+00 6.84e-01f 1
12 1.5170328e+06 3.98e-03 1.14e+08 1.3 8.46e+00 - 1.00e+00 5.89e-01f 1
13 1.5585398e+06 2.75e-04 1.33e+07 0.9 7.67e+00 - 1.00e+00 9.31e-01f 1
14 1.5859755e+06 3.89e-05 2.54e+07 0.4 8.67e+00 - 1.00e+00 8.59e-01f 1
15 1.5988324e+06 1.42e-05 8.39e+07 0.0 8.56e+00 - 1.00e+00 6.36e-01f 1
16 1.6063414e+06 7.29e-06 8.73e+07 -0.6 8.35e+00 - 1.00e+00 4.85e-01f 1
17 1.6120608e+06 1.41e-02 5.96e+07 -1.5 7.57e+00 - 1.00e+00 4.58e-01f 1
18 1.6149148e+06 9.82e-03 4.33e+07 -2.1 7.54e+00 - 1.00e+00 3.03e-01f 1
19 1.6185916e+06 5.43e-03 2.43e+07 -2.8 7.43e+00 - 1.00e+00 4.47e-01f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
20 1.6195375e+06 4.64e-03 2.06e+07 -2.4 7.58e+00 - 1.00e+00 1.45e-01f 1
21 1.6219096e+06 2.85e-03 1.28e+07 -3.1 7.56e+00 - 1.00e+00 3.85e-01f 1
22 1.6233912e+06 2.10e-03 9.50e+06 -4.3 7.38e+00 - 1.00e+00 2.63e-01f 1
23 1.6237799e+06 1.93e-03 8.74e+06 -4.4 6.91e+00 - 1.00e+00 7.98e-02f 1
24 1.6252651e+06 1.24e-03 5.60e+06 -4.5 6.91e+00 - 1.00e+00 3.59e-01f 1
25 1.6254768e+06 1.17e-03 5.29e+06 -4.7 6.83e+00 - 1.00e+00 5.64e-02f 1
26 1.6260970e+06 9.67e-04 4.37e+06 -4.7 6.35e+00 - 1.00e+00 1.73e-01f 1
27 1.6263548e+06 8.84e-04 3.98e+06 -3.7 5.60e+00 - 1.00e+00 8.58e-02f 1
28 1.6268612e+06 7.29e-04 3.30e+06 -4.6 5.60e+00 - 1.00e+00 1.76e-01f 1
29 1.6273491e+06 5.87e-04 2.66e+06 -4.9 5.60e+00 - 1.00e+00 1.94e-01f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
30 1.6279268e+06 4.50e-04 2.04e+06 -5.0 5.60e+00 - 1.00e+00 2.34e-01f 1
31 1.6279532e+06 4.45e-04 2.01e+06 -5.1 5.60e+00 - 1.00e+00 1.15e-02f 1
32 1.6284481e+06 3.47e-04 1.57e+06 -5.1 5.59e+00 - 1.00e+00 2.19e-01f 1
33 1.6285552e+06 3.30e-04 1.50e+06 -5.2 5.26e+00 - 1.00e+00 4.84e-02f 1
34 1.6286734e+06 3.10e-04 1.39e+06 -3.9 4.05e+00 - 1.00e+00 6.32e-02f 1
35 1.6289537e+06 2.63e-04 1.19e+06 -4.6 4.05e+00 - 1.00e+00 1.51e-01f 1
36 1.6291700e+06 2.32e-04 1.04e+06 -3.8 4.05e+00 - 1.00e+00 1.18e-01f 1
37 1.6293392e+06 2.10e-04 9.53e+05 -4.6 4.05e+00 - 1.00e+00 9.28e-02f 1
38 1.6297818e+06 1.59e-04 7.10e+05 -3.9 4.05e+00 - 1.00e+00 2.46e-01f 1
39 1.6297980e+06 1.57e-04 7.15e+05 -4.7 4.05e+00 - 1.00e+00 9.20e-03f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
40 1.6301281e+06 1.27e-04 5.79e+05 -5.5 4.05e+00 - 1.00e+00 1.93e-01f 1
41 1.6301728e+06 1.23e-04 5.63e+05 -5.6 4.05e+00 - 1.00e+00 2.73e-02f 1
42 1.6305320e+06 1.42e-02 4.37e+05 -5.7 4.05e+00 - 1.00e+00 2.25e-01f 1
43 1.6306145e+06 1.34e-02 4.13e+05 -5.8 4.05e+00 - 1.00e+00 5.44e-02f 1
44 1.6319095e+06 1.41e-02 6.75e+05 -1.7 3.18e+04 - 5.15e-01 1.14e-04f 1
45 1.6343390e+06 1.41e-02 6.81e+05 -1.7 5.58e+03 - 9.39e-03 1.39e-03f 1
46 1.6380819e+06 4.15e-02 6.75e+05 -2.3 3.74e+03 - 1.97e-02 4.10e-03f 1
47 1.6381180e+06 4.00e-02 3.45e+05 -3.3 3.39e+00 - 9.88e-01 3.65e-02f 1
48 1.6396890e+06 3.97e-02 3.39e+05 -3.0 1.04e+03 - 8.26e-02 6.56e-03f 1
49 1.6412714e+06 5.33e-02 3.31e+05 -3.2 6.17e+02 - 4.10e-01 1.37e-02f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
50 1.6418662e+06 5.26e-02 3.17e+05 -3.1 2.90e+02 - 7.71e-01 1.21e-02f 1
51 1.6419775e+06 2.98e-02 2.13e+05 -3.8 2.39e+00 - 9.91e-01 4.35e-01f 1
52 1.6422726e+06 6.79e-03 4.97e+04 -4.0 2.39e+00 - 1.00e+00 7.72e-01f 1
53 1.6424879e+06 3.49e-03 2.93e+04 -4.5 2.39e+00 - 1.00e+00 4.87e-01f 1
54 1.6427646e+06 1.53e-02 1.16e+04 -5.8 2.39e+00 - 1.00e+00 6.39e-01f 1
55 1.6428846e+06 1.03e-02 4.78e+03 -4.3 2.39e+00 - 1.00e+00 3.31e-01f 1
56 1.6429383e+06 8.80e-03 1.88e+03 -4.1 2.39e+00 - 1.00e+00 1.43e-01f 1
57 1.6430264e+06 1.44e-02 6.67e+03 -5.5 2.39e+00 - 1.00e+00 2.34e-01f 1
58 1.6431454e+06 9.69e-03 4.20e+03 -5.1 2.39e+00 - 1.00e+00 3.26e-01f 1
59 1.6431605e+06 9.29e-03 2.75e+03 -4.7 2.39e+00 - 1.00e+00 4.12e-02f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
60 1.6433615e+06 4.21e-03 2.02e+03 -5.4 2.39e+00 - 1.00e+00 5.46e-01f 1
61 1.6433732e+06 4.09e-03 7.34e+02 -4.6 2.39e+00 - 1.00e+00 3.05e-02f 1
62 1.6434263e+06 3.52e-03 1.99e+03 -5.9 2.39e+00 - 1.00e+00 1.39e-01f 1
63 1.6434934e+06 2.90e-03 5.71e+03 -4.1 2.39e+00 - 1.00e+00 1.76e-01f 1
64 1.6435671e+06 2.34e-03 2.27e+03 -5.4 2.39e+00 - 1.00e+00 1.92e-01f 1
65 1.6437165e+06 1.43e-03 7.55e+03 -3.8 2.39e+00 - 1.00e+00 3.89e-01f 1
66 1.6437197e+06 1.42e-03 6.58e+03 -5.2 2.39e+00 - 1.00e+00 8.33e-03f 1
67 1.6438000e+06 1.12e-03 5.72e+03 -6.8 2.39e+00 - 1.00e+00 2.10e-01f 1
68 1.6439975e+06 5.37e-04 1.46e+03 -4.6 2.39e+00 - 1.00e+00 5.21e-01f 1
69 1.6440006e+06 5.32e-04 3.98e+03 -5.9 2.39e+00 - 1.00e+00 8.04e-03f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
70 1.6440484e+06 4.65e-04 3.59e+03 -7.4 2.39e+00 - 1.00e+00 1.26e-01f 1
71 1.6442126e+06 2.63e-04 2.03e+03 -7.6 2.39e+00 - 1.00e+00 4.34e-01f 1
72 1.6442160e+06 2.61e-04 2.01e+03 -7.9 2.39e+00 - 1.00e+00 8.97e-03f 1
73 1.6445100e+06 1.41e-02 3.83e+02 -5.5 2.39e+00 - 1.00e+00 7.79e-01f 1
74 1.6445125e+06 1.40e-02 3.50e+02 -5.5 2.39e+00 - 1.00e+00 7.83e-03f 1
75 1.6448343e+06 2.82e-02 5.26e+00 -4.3 2.39e+00 - 1.00e+00 1.00e+00f 1
76 1.6450871e+06 1.16e-02 1.53e+03 -4.1 2.39e+00 - 1.00e+00 5.88e-01f 1
77 1.6453276e+06 1.16e-02 2.89e+04 -2.2 7.60e+03 - 4.11e-02 2.07e-04f 1
78 1.6477277e+06 2.82e-02 2.90e+04 -1.5 2.73e+06 - 4.55e-05 1.87e-05f 1
79 1.6484859e+06 5.63e-02 2.98e+04 -1.5 1.41e+06 - 2.53e-04 2.06e-05f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
80 1.6502226e+06 1.55e-01 3.15e+04 -1.4 1.20e+05 - 6.26e-04 1.71e-04f 1
81 1.6502204e+06 1.54e-01 4.89e+03 -3.9 2.39e+00 - 1.00e+00 9.03e-03h 1
82 1.6501430e+06 1.09e-01 1.11e+04 -3.6 2.38e+00 - 1.00e+00 2.89e-01h 1
83 1.6501409e+06 1.07e-01 5.79e+04 -3.1 2.34e+00 - 1.00e+00 1.95e-02h 1
84 1.6501180e+06 8.16e-02 7.80e+03 -4.5 2.16e+00 - 1.00e+00 2.37e-01h 1
85 1.6501121e+06 7.35e-02 3.30e+03 -3.8 1.56e+00 - 1.00e+00 9.95e-02h 1
86 1.6500905e+06 8.34e-03 1.21e+03 -5.2 1.57e+00 - 1.00e+00 8.86e-01h 1
87 1.6500924e+06 8.27e-03 1.86e+03 -6.6 1.61e+00 - 1.00e+00 8.57e-03f 1
88 1.6501099e+06 7.54e-03 8.21e+03 -4.0 1.61e+00 - 1.00e+00 8.92e-02f 1
89 1.6502553e+06 2.04e-03 5.74e+02 -5.2 1.61e+00 - 1.00e+00 7.29e-01f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
90 1.6502570e+06 2.02e-03 1.12e+03 -6.9 1.62e+00 - 1.00e+00 7.49e-03f 1
91 1.6502626e+06 1.97e-03 2.91e+02 -4.8 1.62e+00 - 1.00e+00 2.85e-02f 1
92 1.6502844e+06 1.73e-03 9.36e+02 -6.1 1.62e+00 - 1.00e+00 1.23e-01f 1
93 1.6503292e+06 1.29e-03 7.52e+02 -6.9 1.62e+00 - 1.00e+00 2.51e-01f 1
94 1.6503300e+06 1.29e-03 7.60e+02 -8.1 1.25e+00 - 1.00e+00 4.58e-03f 1
95 1.6504043e+06 6.44e-04 1.31e+02 -5.0 1.25e+00 - 1.00e+00 5.00e-01f 1
96 1.6504051e+06 6.41e-04 8.28e+02 -6.3 1.25e+00 - 1.00e+00 5.20e-03f 1
97 1.6504103e+06 6.15e-04 6.00e+02 -5.6 1.25e+00 - 1.00e+00 3.92e-02f 1
98 1.6504504e+06 4.26e-02 5.93e+02 -6.9 1.25e+00 - 1.00e+00 3.01e-01f 1
99 1.6504505e+06 4.24e-02 3.52e+02 -5.0 1.13e+00 - 1.00e+00 3.55e-03h 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
100 1.6504518e+06 1.42e-14 2.10e+00 -4.2 1.13e+00 - 1.00e+00 1.00e+00h 1
101 1.6505666e+06 1.42e-14 1.28e+00 -5.4 1.28e+00 - 1.00e+00 8.99e-01f 1
102 1.6505677e+06 1.42e-14 1.28e+00 -7.1 1.28e+00 - 1.00e+00 9.01e-03f 1
103 1.6505681e+06 2.13e-14 1.28e+00 -8.0 1.28e+00 - 1.00e+00 3.01e-03f 1
104 1.6505936e+06 2.13e-14 1.28e+00 -8.3 1.28e+00 - 1.00e+00 2.24e-01f 1
105 1.6505945e+06 1.42e-14 1.28e+00 -8.4 1.28e+00 - 1.00e+00 7.90e-03f 1
106 1.6506189e+06 1.42e-14 1.28e+00 -8.3 1.28e+00 - 1.00e+00 2.21e-01f 1
107 1.6506217e+06 1.42e-14 1.27e+00 -8.5 1.27e+00 - 1.00e+00 2.54e-02f 1
108 1.6506376e+06 1.42e-14 1.22e+00 -8.3 1.22e+00 - 1.00e+00 1.48e-01f 1
109 1.6506419e+06 2.13e-14 1.21e+00 -7.8 1.21e+00 - 1.00e+00 4.78e-02f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
110 1.6506520e+06 1.42e-14 1.22e+00 -8.5 1.22e+00 - 1.00e+00 1.13e-01f 1
111 1.6506753e+06 2.13e-14 1.22e+00 -8.6 1.22e+00 - 1.00e+00 2.70e-01f 1
112 1.6507586e+06 1.42e-14 1.22e+00 -8.8 1.22e+00 - 1.00e+00 9.64e-01f 1
113 1.6507683e+06 1.42e-14 1.22e+00 -10.1 1.22e+00 - 1.00e+00 1.13e-01f 1
114 1.6507684e+06 1.42e-14 1.22e+00 -10.0 1.22e+00 - 1.00e+00 1.13e-03f 1
115 1.6507685e+06 2.13e-14 1.27e+00 -9.5 1.27e+00 - 1.00e+00 4.29e-04f 1
116 1.6508210e+06 1.42e-14 1.27e+00 -11.0 1.27e+00 - 1.00e+00 6.20e-01f 1
117 1.6508215e+06 1.42e-14 1.27e+00 -10.1 1.27e+00 - 1.00e+00 6.20e-03f 1
118 1.6508215e+06 1.42e-14 1.16e+00 -10.0 1.16e+00 - 1.00e+00 6.83e-05f 1
119 1.6508225e+06 1.42e-14 8.02e-01 -9.7 8.02e-01 - 1.00e+00 1.52e-02f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
120 1.6508230e+06 1.42e-14 8.02e-01 -9.5 8.02e-01 - 1.00e+00 9.12e-03f 1
121 1.6508705e+06 2.82e-02 2.43e+00 -11.0 8.02e-01 - 1.00e+00 7.69e-01f 1
122 1.6508705e+06 2.80e-02 3.86e+00 -7.7 8.02e-01 - 1.00e+00 7.69e-03h 1
123 1.6508705e+06 2.79e-02 2.44e+00 -8.4 8.02e-01 - 1.00e+00 1.54e-04h 1
124 1.6508683e+06 1.42e-14 1.26e+00 -7.8 8.02e-01 - 1.00e+00 1.00e+00h 1
125 1.6508882e+06 1.42e-14 8.02e-01 -9.3 8.02e-01 - 1.00e+00 3.16e-01f 1
126 1.6509200e+06 1.42e-14 8.02e-01 -10.2 8.02e-01 - 1.00e+00 5.07e-01f 1
127 1.6509204e+06 1.42e-14 8.02e-01 -11.0 8.02e-01 - 1.00e+00 5.07e-03f 1
128 1.6509204e+06 1.42e-14 8.02e-01 -11.0 8.02e-01 - 1.00e+00 8.63e-05f 1
129 1.6509312e+06 1.42e-14 8.02e-01 -11.0 8.02e-01 - 1.00e+00 1.94e-01f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
130 1.6509313e+06 1.42e-14 8.02e-01 -11.0 8.02e-01 - 1.00e+00 1.97e-03f 1
131 1.6509324e+06 1.42e-14 8.02e-01 -11.0 8.02e-01 - 1.00e+00 1.96e-02f 1
132 1.6509818e+06 1.42e-14 8.02e-01 -11.0 8.02e-01 - 1.00e+00 8.92e-01f 1
133 1.6509860e+06 1.42e-14 8.02e-01 -11.0 8.02e-01 - 1.00e+00 7.57e-02f 1
134 1.6509860e+06 1.42e-14 8.02e-01 -11.0 8.02e-01 - 1.00e+00 7.57e-04f 1
135 1.6509860e+06 1.42e-14 8.02e-01 -11.0 8.02e-01 - 1.00e+00 2.96e-04f 1
136 1.6510192e+06 1.42e-14 8.02e-01 -11.0 8.02e-01 - 1.00e+00 6.36e-01f 1
137 1.6510360e+06 1.42e-14 8.02e-01 -11.0 8.02e-01 - 1.00e+00 3.22e-01f 1
138 1.6510881e+06 2.82e-02 3.25e+00 -11.0 8.02e-01 - 1.00e+00 1.00e+00f 1
139 1.6510969e+06 4.23e-02 3.25e+00 -9.0 8.02e-01 - 1.00e+00 3.18e-01f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
140 1.6510972e+06 4.23e-02 1.79e+01 -11.0 9.21e+01 - 2.22e-01 5.65e-05f 1
141 1.6510973e+06 4.22e-02 1.85e+01 -8.2 7.70e+01 - 1.66e-02 2.87e-05f 1
142 1.6510994e+06 4.22e-02 1.88e+01 -9.1 6.76e+01 - 1.06e-02 5.38e-04f 1
143 1.6510992e+06 4.21e-02 3.40e+00 -9.4 7.06e-01 - 1.00e+00 2.46e-03h 1
144 1.6510382e+06 4.22e-03 3.30e+00 -8.2 7.06e-01 - 1.00e+00 9.00e-01h 1
145 1.6510639e+06 5.90e-04 3.54e+00 -8.2 7.74e-01 - 1.00e+00 8.60e-01f 1
146 1.6510642e+06 5.85e-04 3.54e+00 -8.0 7.81e-01 - 1.00e+00 8.60e-03f 1
147 1.6510642e+06 5.85e-04 4.50e+00 -7.6 7.81e-01 - 1.00e+00 1.89e-04h 1
148 1.6510695e+06 5.03e-04 3.55e+00 -8.0 7.81e-01 - 1.00e+00 1.39e-01f 1
149 1.6510696e+06 5.02e-04 3.55e+00 -8.0 7.52e-01 - 1.00e+00 1.45e-03f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
150 1.6510707e+06 4.84e-04 3.46e+00 -8.0 5.60e-01 - 1.00e+00 3.63e-02f 1
151 1.6511018e+06 1.42e-14 5.50e-01 -8.2 5.60e-01 - 1.00e+00 1.00e+00f 1
152 1.6511122e+06 1.42e-14 5.61e-01 -9.8 5.61e-01 - 1.00e+00 3.22e-01f 1
153 1.6511322e+06 1.42e-14 5.61e-01 -10.7 5.61e-01 - 1.00e+00 6.17e-01f 1
154 1.6511364e+06 7.11e-15 5.61e-01 -11.0 5.61e-01 - 1.00e+00 1.30e-01f 1
155 1.6511364e+06 1.42e-14 5.61e-01 -11.0 5.61e-01 - 1.00e+00 1.30e-03f 1
156 1.6511364e+06 1.42e-14 5.61e-01 -11.0 5.61e-01 - 1.00e+00 1.85e-04f 1
157 1.6511605e+06 1.42e-14 5.61e-01 -11.0 5.61e-01 - 1.00e+00 8.08e-01f 1
158 1.6511607e+06 2.13e-14 5.61e-01 -11.0 5.61e-01 - 1.00e+00 8.08e-03f 1
159 1.6511607e+06 1.42e-14 5.36e-01 -11.0 5.36e-01 - 1.00e+00 8.45e-05f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
160 1.6511618e+06 1.42e-14 5.39e-01 -11.0 5.39e-01 - 1.00e+00 4.09e-02f 1
161 1.6511700e+06 1.42e-14 5.39e-01 -11.0 5.39e-01 - 1.00e+00 3.13e-01f 1
162 1.6511960e+06 1.41e-02 2.66e+00 -10.7 5.39e-01 - 1.00e+00 9.95e-01f 1
163 1.6511958e+06 1.30e-02 2.81e+00 -8.7 5.39e-01 - 1.00e+00 7.55e-02h 1
164 1.6511958e+06 1.30e-02 3.02e+00 -8.4 5.41e-01 - 1.00e+00 7.56e-04h 1
165 1.6511958e+06 1.30e-02 2.79e+00 -8.8 5.41e-01 - 1.00e+00 1.12e-03h 1
166 1.6511956e+06 1.13e-02 2.95e+00 -8.4 5.41e-01 - 1.00e+00 1.29e-01h 1
167 1.6511956e+06 1.13e-02 2.66e+00 -9.2 5.43e-01 - 1.00e+00 1.36e-03h 1
168 1.6511955e+06 1.07e-02 2.93e+00 -8.4 5.43e-01 - 1.00e+00 5.10e-02h 1
169 1.6511953e+06 2.06e-03 2.67e+00 -9.0 5.43e-01 - 1.00e+00 8.08e-01h 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
170 1.6511977e+06 1.78e-03 2.96e+00 -8.3 5.54e-01 - 1.00e+00 1.33e-01f 1
171 1.6511977e+06 1.78e-03 2.83e+00 -8.5 5.54e-01 - 1.00e+00 1.33e-03h 1
172 1.6511977e+06 1.78e-03 2.82e+00 -8.5 5.54e-01 - 1.00e+00 2.04e-03h 1
173 1.6512111e+06 4.33e-04 2.79e+00 -8.2 5.54e-01 - 1.00e+00 7.57e-01f 1
174 1.6512113e+06 4.30e-04 3.33e+00 -7.9 5.56e-01 - 1.00e+00 7.59e-03f 1
175 1.6512113e+06 4.29e-04 3.05e+00 -8.0 5.56e-01 - 1.00e+00 2.58e-04h 1
176 1.6512314e+06 5.56e-09 5.47e-01 -8.1 5.56e-01 - 1.00e+00 1.00e+00f 1
177 1.6512442e+06 2.18e-09 5.57e-01 -9.7 5.57e-01 - 1.00e+00 6.08e-01f 1
178 1.6512451e+06 2.08e-09 5.57e-01 -10.8 5.57e-01 - 1.00e+00 4.48e-02f 1
179 1.6512451e+06 2.08e-09 5.51e-01 -11.0 5.51e-01 - 1.00e+00 4.53e-04f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
180 1.6512453e+06 2.06e-09 4.47e-01 -11.0 4.47e-01 - 1.00e+00 9.65e-03f 1
181 1.6512550e+06 9.05e-10 4.47e-01 -11.0 4.47e-01 - 1.00e+00 5.61e-01f 1
182 1.6512723e+06 2.13e-14 4.47e-01 -9.8 4.47e-01 - 1.00e+00 1.00e+00f 1
183 1.6512895e+06 4.23e-02 2.67e+00 -11.0 4.47e-01 - 1.00e+00 9.99e-01f 1
184 1.6512214e+06 1.42e-14 1.90e+00 -11.0 4.47e-01 - 1.00e+00 1.00e+00h 1
185 1.6512386e+06 7.11e-15 4.47e-01 -11.0 4.47e-01 - 1.00e+00 1.00e+00f 1
186 1.6512396e+06 1.42e-14 4.47e-01 -11.0 4.47e-01 - 1.00e+00 5.78e-02f 1
187 1.6512407e+06 1.42e-14 5.21e-01 -11.0 5.21e-01 - 1.00e+00 7.66e-02f 1
188 1.6512504e+06 1.42e-14 4.29e-01 -11.0 4.29e-01 - 1.00e+00 8.38e-01f 1
189 1.6512575e+06 1.42e-14 4.29e-01 -11.0 4.29e-01 - 1.00e+00 6.09e-01f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
190 1.6512689e+06 1.42e-14 4.29e-01 -11.0 4.29e-01 - 1.00e+00 9.98e-01f 1
191 1.6512708e+06 7.11e-15 4.29e-01 -11.0 4.29e-01 - 1.00e+00 1.67e-01f 1
192 1.6512821e+06 1.42e-14 4.29e-01 -11.0 4.29e-01 - 1.00e+00 9.97e-01f 1
193 1.6512934e+06 1.42e-14 4.29e-01 -11.0 4.29e-01 - 1.00e+00 1.00e+00f 1
194 1.6512984e+06 1.41e-02 8.50e-01 -11.0 4.29e-01 - 1.00e+00 4.46e-01f 1
195 1.6512984e+06 1.40e-02 8.55e-01 -8.4 4.29e-01 - 1.00e+00 4.46e-03h 1
196 1.6512984e+06 1.40e-02 8.43e+00 -11.0 7.11e+01 - 1.86e-01 1.60e-06f 1
197 1.6513155e+06 1.41e-02 8.47e+00 -7.0 4.38e+04 - 1.03e-03 1.80e-05f 1
198 1.6513224e+06 1.41e-02 8.75e+00 -6.6 2.26e+04 - 1.21e-02 1.57e-05f 1
199 1.6513784e+06 1.41e-02 1.10e+01 -7.0 1.77e+04 - 2.67e-03 1.64e-04f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
200 1.6513740e+06 1.31e-02 1.04e+01 -9.2 4.26e-01 - 1.00e+00 6.83e-02h 1
201 1.6513743e+06 1.31e-02 1.41e+01 -8.9 9.21e+00 - 1.00e+00 4.03e-03h 1
202 1.6513881e+06 1.31e-02 1.43e+01 -8.5 9.92e+02 - 3.13e-02 1.16e-03f 1
203 1.6513979e+06 1.30e-02 1.48e+01 -8.7 7.47e+02 - 7.11e-02 1.06e-03f 1
204 1.6514127e+06 1.30e-02 1.49e+01 -11.0 4.13e+02 - 6.46e-02 4.01e-03f 1
205 1.6514111e+06 1.27e-02 1.04e+01 -11.0 2.62e-01 - 9.95e-01 2.55e-02h 1
206 1.6514112e+06 1.26e-02 1.55e+01 -11.0 1.11e+01 - 5.92e-01 1.77e-03h 1
207 1.6514343e+06 1.26e-02 1.57e+01 -11.0 5.51e+02 - 3.71e-02 4.63e-03f 1
208 1.6514353e+06 1.26e-02 1.49e+01 -11.0 4.02e+02 - 1.57e-01 2.89e-04f 1
209 1.6514825e+06 1.24e-02 2.33e+01 -11.0 3.73e+02 - 1.88e-01 1.58e-02f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
210 1.6514824e+06 1.24e-02 2.33e+01 -11.0 2.09e-01 - 9.90e-01 1.09e-03h 1
211 1.6514880e+06 1.11e-02 2.33e+01 -11.0 1.52e+01 - 5.27e-01 1.01e-01f 1
212 1.6514881e+06 1.11e-02 2.33e+01 -11.0 1.51e+03 - 8.92e-03 1.01e-05f 1
213 1.6514893e+06 1.11e-02 2.38e+01 -11.0 2.44e+02 - 1.24e-01 5.43e-04f 1
214 1.6515106e+06 2.50e-02 3.21e+01 -11.0 2.44e+02 - 3.39e-01 9.82e-03f 1
215 1.6515079e+06 2.42e-02 3.11e+01 -11.0 9.83e-02 - 9.94e-01 3.38e-02h 1
216 1.6515078e+06 2.41e-02 3.10e+01 -11.0 3.15e+00 - 5.80e-01 2.98e-03h 1
217 1.6515115e+06 2.41e-02 3.21e+01 -11.0 1.40e+02 - 1.57e-02 2.59e-03f 1
218 1.6515283e+06 2.40e-02 4.05e+01 -7.5 1.88e+05 - 1.29e-03 9.17e-06f 1
219 1.6515294e+06 2.40e-02 4.11e+01 -7.9 1.40e+05 - 8.58e-04 8.61e-07f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
220 1.6515553e+06 3.81e-02 6.85e+01 -6.7 1.99e+06 - 3.55e-04 3.64e-06f 1
221 1.6515570e+06 3.81e-02 6.77e+01 -7.2 6.40e+05 - 5.23e-05 6.26e-07f 1
222 1.6515894e+06 8.04e-02 6.70e+01 -5.9 7.38e+06 - 7.76e-05 1.15e-06f 1
223 1.6516477e+06 1.09e-01 6.28e+01 -6.2 5.14e+06 - 1.65e-05 3.32e-06f 1
224 1.6516493e+06 1.09e-01 6.23e+01 -6.4 2.19e+06 - 1.73e-04 3.68e-07f 1
225 1.6516491e+06 1.08e-01 6.23e+01 -11.0 1.09e-01 - 9.91e-01 8.83e-04h 1
226 1.6516469e+06 1.08e-01 6.18e+01 -11.0 6.20e-01 - 7.68e-01 8.48e-03h 1
227 1.6516463e+06 1.07e-01 6.14e+01 -11.0 1.17e+01 - 3.89e-02 5.21e-03h 1
228 1.6516513e+06 1.07e-01 6.14e+01 -8.6 3.38e+02 - 1.11e-02 1.49e-03f 1
229 1.6516539e+06 1.07e-01 6.14e+01 -11.0 1.77e+03 - 7.00e-02 1.59e-03f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
230 1.6516675e+06 1.07e-01 8.00e+01 -8.4 2.15e+04 - 5.71e-02 6.67e-04f 1
231 1.6516677e+06 1.07e-01 8.01e+01 -11.0 3.64e+04 - 3.95e-03 3.94e-06f 1
232 1.6516928e+06 1.06e-01 1.05e+02 -11.0 2.80e+04 - 3.71e-03 1.22e-03f 1
233 1.6516943e+06 1.06e-01 1.05e+02 -11.0 4.47e+04 - 3.55e-03 4.67e-05f 1
234 1.6516944e+06 1.06e-01 1.04e+02 -11.0 2.65e+04 - 6.84e-03 1.42e-05f 1
235 1.6516952e+06 1.06e-01 6.25e+01 -11.0 2.40e+03 - 4.98e-02 7.85e-04f 1
236 1.6516870e+06 1.04e-01 9.47e+01 -11.0 2.80e+03 - 5.51e-02 1.88e-02h 1
237 1.6516621e+06 9.74e-02 5.05e+02 -11.0 1.07e+03 - 1.25e-01 6.71e-02h 1
238 1.6516619e+06 9.73e-02 5.06e+02 -6.1 8.47e+02 - 1.16e-04 8.10e-04h 1
239 1.6516597e+06 9.67e-02 5.16e+02 -6.1 4.52e+03 - 1.33e-03 5.95e-03h 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
240 1.6516558e+06 9.50e-02 5.09e+02 -7.6 1.51e+03 - 1.11e-01 1.72e-02h 1
241 1.6516538e+06 9.44e-02 5.05e+02 -8.0 2.11e+02 - 6.94e-01 7.10e-03h 1
242 1.6515397e+06 5.60e-02 3.00e+02 -11.0 1.32e+02 - 4.91e-01 4.07e-01h 1
243 1.6514045e+06 1.02e-02 1.23e+02 -5.9 4.64e+01 - 1.12e-03 8.19e-01h 1
244 1.6513757e+06 3.67e-04 3.32e+01 -6.3 1.80e+01 - 5.84e-01 9.64e-01h 1
245 1.6513757e+06 3.41e-04 4.73e+01 -5.3 1.66e+02 - 7.70e-02 7.05e-02h 1
246 1.6513757e+06 3.41e-04 6.67e+01 -6.4 4.77e+01 - 8.51e-01 2.46e-03h 1
247 1.6513748e+06 4.18e-05 3.15e+01 -7.7 1.05e+01 - 8.17e-01 8.77e-01h 1
248 1.6513748e+06 2.92e-05 1.74e+01 -9.1 1.21e+00 - 9.79e-01 3.03e-01h 1
249 1.6513747e+06 1.32e-05 9.97e+00 -11.0 8.44e-01 - 9.55e-01 5.47e-01h 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
250 1.6513747e+06 5.67e-06 4.39e+00 -8.6 9.65e-05 - 1.00e+00 5.71e-01h 1
251 1.6513747e+06 1.92e-08 3.20e-04 -8.2 9.07e-05 - 1.00e+00 9.97e-01h 1
252 1.6513747e+06 9.50e-09 5.13e-05 -9.5 9.96e-05 - 1.00e+00 5.06e-01h 1
253 1.6513747e+06 4.23e-09 5.16e-05 -9.9 1.00e-04 - 1.00e+00 5.55e-01h 1
254 1.6513747e+06 1.89e-09 4.20e-05 -10.3 8.16e-05 - 1.00e+00 5.53e-01h 1
255 1.6513747e+06 1.10e-09 1.53e-05 -10.9 2.97e-05 - 1.00e+00 4.16e-01h 1
256 1.6513747e+06 1.42e-14 1.54e-05 -11.0 3.00e-05 - 1.00e+00 1.00e+00h 1
257 1.6513747e+06 1.42e-14 1.54e-05 -11.0 2.99e-05 - 1.00e+00 1.00e+00h 1
258 1.6513747e+06 1.42e-14 1.49e-05 -11.0 2.90e-05 - 1.00e+00 5.73e-01h 1
259 1.6513747e+06 1.42e-14 3.65e-06 -11.0 7.09e-06 - 1.00e+00 5.00e-01f 2
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
260 1.6513747e+06 1.42e-14 1.23e-06 -11.0 2.39e-06 - 1.00e+00 1.00e+00h 1
261 1.6513747e+06 7.11e-15 4.51e-07 -11.0 8.76e-07 - 1.00e+00 1.00e+00h 1
262 1.6513747e+06 1.42e-14 1.42e-07 -11.0 2.36e-07 - 1.00e+00 1.00e+00h 1
263 1.6513747e+06 1.42e-14 1.42e-07 -11.0 2.34e-07 - 1.00e+00 1.00e+00h 1
264 1.6513747e+06 7.11e-15 1.42e-07 -11.0 2.33e-07 - 1.00e+00 1.00e+00h 1
265 1.6513747e+06 7.11e-15 1.42e-07 -11.0 2.32e-07 - 1.00e+00 1.00e+00h 1
266 1.6513747e+06 7.11e-15 1.41e-07 -11.0 2.31e-07 - 1.00e+00 1.00e+00h 1
267 1.6513747e+06 1.42e-14 1.41e-07 -11.0 2.30e-07 - 1.00e+00 1.00e+00h 1
268 1.6513747e+06 1.42e-14 1.41e-07 -11.0 2.29e-07 - 1.00e+00 1.00e+00h 1
269 1.6513747e+06 1.42e-14 1.41e-07 -11.0 2.28e-07 - 1.00e+00 1.00e+00h 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
270 1.6513747e+06 7.11e-15 1.41e-07 -11.0 2.27e-07 - 1.00e+00 1.00e+00h 1
271 1.6513747e+06 1.42e-14 1.41e-07 -11.0 2.26e-07 - 1.00e+00 1.00e+00h 1
272 1.6513747e+06 1.42e-14 1.40e-07 -11.0 2.25e-07 - 1.00e+00 1.00e+00h 1
273 1.6513747e+06 1.42e-14 1.40e-07 -11.0 2.24e-07 - 1.00e+00 1.00e+00h 1
274 1.6513747e+06 7.11e-15 1.40e-07 -11.0 2.23e-07 - 1.00e+00 1.00e+00h 1
275 1.6513747e+06 1.42e-14 1.40e-07 -11.0 2.22e-07 - 1.00e+00 1.00e+00h 1

Number of Iterations…: 275

                               (scaled)                 (unscaled)

Objective…: -2.0688215116841363e+05 1.6513747070565114e+06
Dual infeasibility…: 1.3982862331006722e-07 1.1161400369856187e-06
Constraint violation…: 1.4210854715202004e-14 1.4210854715202004e-14
Variable bound violation: 9.9999133969838339e-09 9.9999133969838339e-09
Complementarity…: 1.0000000000064183e-11 7.9822000000512328e-11
Overall NLP error…: 1.3982862331006722e-07 1.1161400369856187e-06

Number of objective function evaluations = 280
Number of objective gradient evaluations = 276
Number of equality constraint evaluations = 280
Number of inequality constraint evaluations = 280
Number of equality constraint Jacobian evaluations = 276
Number of inequality constraint Jacobian evaluations = 276
Number of Lagrangian Hessian evaluations = 0
Total seconds in IPOPT = 16.336

EXIT: Solved To Acceptable Level.

Indeed the problem is non-convex. I am maximizing

expected profit = probability of price being accepted in an auction * price * quantity

with the acceptance probability decreasing with higher price.

Thanks a lot for your suggestions @NiclasMattsson! I will try them out and see whether the model becomes faster.

Do you have the formulation? Each iteration is quite slow. Are you using a user-defined function?

But for the full problem, using a good starting point should help a lot.

It’s possible that the order of magnitude of the objective is too high compared to that of the constraints. Interior-point methods are quite sensitive to numerics. Can you try dividing your objective by, say, 100000? That is, instead of maximizing
expected profit = probability of price being accepted in an auction * price * quantity,
you maximize
expected profit = probability of price being accepted in an auction * price * quantity/100000.
The solution will be the same, but you bring the objective back in the [0, 20] range.

There is something that puzzles me in Ipopt’s log above.

  • The problem has 10206 variables, and 1632 constraints excluding variable bounds (576 equality and 1056 inequality constraints). So far so good.
  • The constraints’ Jacobian has size 1,632x10,206, but according to Ipopt it has only 4,800 non-zeros. This means that at least 5,406 columns in the Jacobian are zeros, which suggests that the corresponding variables do not appear in any constraint
  • The Lagrangian Hessian has 0 non-zero coefficients, which is also weird.

Can you share your problem’s formulation and a reproducible example?

2 Likes

Hello @odow,

it is a bit difficult for me to provide a reproducible example because the problem includes user-defined functions indeed which rely on an external dataset. But I will try to generate a simplified example!

Yes, I use user-defined functions (for example a function calculating the acceptance probability of an offered price in an auction).

it is a bit difficult for me to provide a reproducible example because the problem includes user-defined functions indeed which rely on an external dataset.

My guess is that you could greatly improve how this works. The sparsity pattern of the Jacobian suggests that you have too many variables, and the slow iteration time could be because of an expensive user-defined function.

It’s hard (impossible) to offer deeper advice without looking at the code.

For the external dataset, you could just fudge the numbers (e.g., use rand() to create a random time-series for prices). It doesn’t have to get the same result, it just has to demonstrate the same performance problem.

1 Like

Hey @NiclasMattsson,

I am coming back to your suggestion on adding a warm start with the solutions of the first day for the previous day. Unfortunately, I did not find a tutorial on how to add such a warm start.

Is the following approach correct?

  • Run the model once for the first period (finds a solution)
  • Then add the following to the model

set_optimizer_attribute(m2n, “warm_start_init_point”, “yes”)

  • Change the time parameter to the second day and let the model run.

See Variables · JuMP

Thank you @odow!

1 Like