File tree Expand file tree Collapse file tree
include/roboptim/core/plugin/ipopt Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -123,6 +123,9 @@ namespace roboptim
123123 // / \brief Intermediate callback (called at each end
124124 // / of iteration).
125125 callback_t callback_;
126+
127+ // / \brief Number of times the solve method was called.
128+ int solveCounter_;
126129 };
127130
128131 // / @}
Original file line number Diff line number Diff line change @@ -47,7 +47,8 @@ namespace roboptim
4747 : parent_t (pb),
4848 nlp_ (tnlp),
4949 app_ (IpoptApplicationFactory ()),
50- callback_ ()
50+ callback_ (),
51+ solveCounter_ (0 )
5152 {
5253 app_->Jnlst ()->DeleteAllJournals ();
5354
@@ -80,7 +81,12 @@ namespace roboptim
8081#define SWITCH_OK (NAME, CASES ) \
8182 case NAME : \
8283 { \
83- int status = app_->OptimizeTNLP (nlp_); \
84+ int status; \
85+ if (solveCounter_ == 0 ) \
86+ status = app_->OptimizeTNLP (nlp_); \
87+ else \
88+ status = app_->ReOptimizeTNLP (nlp_); \
89+ solveCounter_++; \
8490 switch (status) \
8591 { \
8692 CASES ; \
You can’t perform that action at this time.
0 commit comments