Commit 5963a2a0 authored by Max Lyon's avatar Max Lyon
Browse files

allow setting max number of iterations in IPOPTSolverLean

parent 2e43feb1
......@@ -41,13 +41,14 @@ class IPOPTSolverLean::Impl
{// Create an instance of the IpoptApplication
public:
Impl()
: app_(IpoptApplicationFactory()), alm_infsb_thrsh_(0.5),
: app_(IpoptApplicationFactory()), max_iter_(200), alm_infsb_thrsh_(0.5),
incr_lazy_cnstr_max_iter_nmbr_(5), enbl_all_lzy_cnstr_(true)
{}
public:
Ipopt::SmartPtr<Ipopt::IpoptApplication> app_;
int max_iter_;
double alm_infsb_thrsh_;
int incr_lazy_cnstr_max_iter_nmbr_;
bool enbl_all_lzy_cnstr_;
......@@ -96,6 +97,16 @@ double IPOPTSolverLean::energy()
//-----------------------------------------------------------------------------
void IPOPTSolverLean::set_max_iterations(const int _max_iterations)
{
impl_->max_iter_ = _max_iterations;
}
int IPOPTSolverLean::max_iterations() const
{
return impl_->max_iter_;
}
double IPOPTSolverLean::almost_infeasible_threshold() const
{
return impl_->alm_infsb_thrsh_;
......@@ -268,6 +279,8 @@ void IPOPTSolverLean::solve(
std::vector<int> n_inf;
std::vector<int> n_almost_inf;
// set max iterations
impl_->app_->Options()->SetIntegerValue("max_iter", impl_->max_iter_);
while(!feasible_point_found && cur_pass < max_passes)
{
......
......@@ -49,6 +49,12 @@ public:
// *********** OPTIONS **************//
/*!
Set the maximum number of iterations
*/
void set_max_iterations(const int _max_iterations);
int max_iterations() const;
/*!
Set the threshold on the lazy inequality constraint to decide if we are near
the constraint boundary.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment