File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed
Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -213,19 +213,10 @@ function ipopt(nls::AbstractNLSModel; kwargs...)
213213 ff_nls = FeasibilityFormNLS(nls)
214214 stats = ipopt(ff_nls; kwargs... )
215215
216- stats. solution = stats. solution[1 : nls. meta. nvar]
217-
218- if hasproperty(stats, :multipliers_L)
219- stats. multipliers_L = stats. multipliers_L[1 : nls. meta. nvar]
220- end
221- if hasproperty(stats, :multipliers_U)
222- stats. multipliers_U = stats. multipliers_U[1 : nls. meta. nvar]
223- end
224-
225- if hasproperty(stats, :multipliers)
226- stats. multipliers = stats. multipliers[end - nls. meta. ncon+ 1 : end ]
227- end
228-
216+ stats. solution = length(stats. solution) >= nls. meta. nvar ? stats. solution[1 : nls. meta. nvar] : stats. solution
217+ stats. multipliers_L = length(stats. multipliers_L) >= nls. meta. nvar ? stats. multipliers_L[1 : nls. meta. nvar] : stats. multipliers_L
218+ stats. multipliers_U = length(stats. multipliers_U) >= nls. meta. nvar ? stats. multipliers_U[1 : nls. meta. nvar] : stats. multipliers_U
219+ stats. multipliers = length(stats. multipliers) >= nls. meta. ncon ? stats. multipliers[end - nls. meta. ncon+ 1 : end ] : stats. multipliers
229220 return stats
230221end
231222
You can’t perform that action at this time.
0 commit comments