General implementation of a backtracking line search. More...
#include <IpBacktrackingLineSearch.hpp>
Public Member Functions | |
virtual bool | InitializeImpl (const OptionsList &options, const std::string &prefix) |
InitializeImpl - overloaded from AlgorithmStrategyObject. | |
virtual void | FindAcceptableTrialPoint () |
Perform the line search. | |
virtual void | Reset () |
Reset the line search. | |
virtual void | SetRigorousLineSearch (bool rigorous) |
Set flag indicating whether a very rigorous line search should be performed. | |
virtual bool | CheckSkippedLineSearch () |
Check if the line search procedure didn't accept a new iterate during the last call of FindAcceptableTrialPoint(). | |
virtual bool | ActivateFallbackMechanism () |
Activate fallback mechanism. | |
void | StopWatchDog () |
Stop watch dog if started and restore iterate from before watchdog started. | |
Constructors/Destructors | |
BacktrackingLineSearch (const SmartPtr< BacktrackingLSAcceptor > &acceptor, const SmartPtr< RestorationPhase > &resto_phase, const SmartPtr< ConvergenceCheck > &conv_check) | |
Constructor. | |
virtual | ~BacktrackingLineSearch () |
Destructor. | |
Public Member Functions inherited from Ipopt::LineSearch | |
LineSearch () | |
Default Constructor. | |
virtual | ~LineSearch () |
Destructor. | |
Public Member Functions inherited from Ipopt::AlgorithmStrategyObject | |
bool | Initialize (const Journalist &jnlst, IpoptNLP &ip_nlp, IpoptData &ip_data, IpoptCalculatedQuantities &ip_cq, const OptionsList &options, const std::string &prefix) |
This method is called every time the algorithm starts again - it is used to reset any internal state. | |
bool | ReducedInitialize (const Journalist &jnlst, const OptionsList &options, const std::string &prefix) |
Reduced version of the Initialize method, which does not require special Ipopt information. | |
AlgorithmStrategyObject () | |
Default Constructor. | |
virtual | ~AlgorithmStrategyObject () |
Destructor. | |
Public Member Functions inherited from Ipopt::ReferencedObject | |
ReferencedObject () | |
virtual | ~ReferencedObject () |
Index | ReferenceCount () const |
void | AddRef (const Referencer *referencer) const |
void | ReleaseRef (const Referencer *referencer) const |
Static Public Member Functions | |
static void | RegisterOptions (SmartPtr< RegisteredOptions > roptions) |
Methods for OptionsList. | |
Private Member Functions | |
bool | DoBacktrackingLineSearch (bool skip_first_trial_point, Number &alpha_primal, bool &corr_taken, bool &soc_taken, Index &n_steps, bool &evaluation_error, SmartPtr< IteratesVector > &actual_delta) |
Method performing the backtracking line search. | |
void | StartWatchDog () |
Method for starting the watch dog. | |
void | StopWatchDog (SmartPtr< IteratesVector > &actual_delta) |
Method for stopping the watch dog. | |
bool | CheckAcceptabilityOfTrialPoint (Number alpha_primal) |
Method for checking if current trial point is acceptable. | |
void | PerformDualStep (Number alpha_primal, Number alpha_dual, SmartPtr< IteratesVector > &delta) |
Method for setting the dual variables in the trial fields in IpData, given the search direction. | |
bool | TrySoftRestoStep (SmartPtr< IteratesVector > &actual_delta, bool &satisfies_original_criterion) |
Try a step for the soft restoration phase and check if it is acceptable. | |
bool | TrySecondOrderCorrection (Number alpha_primal_test, Number &alpha_primal, SmartPtr< IteratesVector > &actual_delta) |
Try a second order correction for the constraints. | |
bool | TryCorrector (Number alpha_primal_test, Number &alpha_primal, SmartPtr< IteratesVector > &actual_delta) |
Try higher order corrector (for fast local convergence). | |
void | PerformMagicStep () |
Perform magic steps. | |
bool | DetectTinyStep () |
Detect if the search direction is too small. | |
void | StoreAcceptablePoint () |
Store current iterate as acceptable point. | |
bool | RestoreAcceptablePoint () |
Restore acceptable point into the current fields of IpData if found. | |
bool | CurrentIsAcceptable () |
Method for determining if the current iterate is acceptable (in the sense of the acceptable_tol options). | |
Default Compiler Generated Methods | |
(Hidden to avoid implicit creation/calling). These methods are not implemented and we do not want the compiler to implement them for us, so we declare them private and do not define them. This ensures that they will not be implicitly created/called. | |
BacktrackingLineSearch (const BacktrackingLineSearch &) | |
Copy Constructor. | |
void | operator= (const BacktrackingLineSearch &) |
Default Assignment Operator. | |
Private Attributes | |
bool | fallback_activated_ |
Flag indicating whether the algorithm has asked to immediately switch to the fallback mechanism (restoration phase) | |
bool | rigorous_ |
Flag indicating whether the line search is to be performed robust (usually this is true, unless SetRigorousLineSearch is called with false). | |
bool | skipped_line_search_ |
Flag indicating whether no acceptable trial point was found during last line search. | |
bool | in_soft_resto_phase_ |
Flag indicating whether we are currently in the "soft" restoration phase mode, in which steps are accepted if they reduce the optimality error (see soft_resto_pderror_reduction_factor) | |
Index | soft_resto_counter_ |
Counter for iteration performed in soft restoration phase in a row. | |
Index | count_successive_shortened_steps_ |
Counter for the number of successive iterations in which the full step was not accepted. | |
bool | tiny_step_last_iteration_ |
Flag indicating if a tiny step was detected in previous iteration. | |
Information related to watchdog procedure | |
bool | in_watchdog_ |
Flag indicating if the watchdog is active. | |
Index | watchdog_shortened_iter_ |
Counter for shortened iterations. | |
Index | watchdog_trial_iter_ |
Counter for watch dog iterations. | |
Number | watchdog_alpha_primal_test_ |
Step size for Armijo test in watch dog. | |
SmartPtr< const IteratesVector > | watchdog_iterate_ |
Watchdog reference iterate. | |
SmartPtr< const IteratesVector > | watchdog_delta_ |
Watchdog search direction at reference point. | |
Number | last_mu_ |
Barrier parameter value during last line search. | |
Storage for last iterate that satisfies the acceptable | |
level of optimality error. | |
SmartPtr< const IteratesVector > | acceptable_iterate_ |
Index | acceptable_iteration_number_ |
Strategy objective that are used | |
SmartPtr< BacktrackingLSAcceptor > | acceptor_ |
SmartPtr< RestorationPhase > | resto_phase_ |
SmartPtr< ConvergenceCheck > | conv_check_ |
Parameters for the filter algorithm. | |
Names as in the paper. | |
enum | AlphaForYEnum { PRIMAL_ALPHA_FOR_Y = 0 , DUAL_ALPHA_FOR_Y , MIN_ALPHA_FOR_Y , MAX_ALPHA_FOR_Y , FULL_STEP_FOR_Y , MIN_DUAL_INFEAS_ALPHA_FOR_Y , SAFE_MIN_DUAL_INFEAS_ALPHA_FOR_Y , PRIMAL_AND_FULL_ALPHA_FOR_Y , DUAL_AND_FULL_ALPHA_FOR_Y , LSACCEPTOR_ALPHA_FOR_Y } |
enumeration for the different alpha_for_y_ settings More... | |
Number | alpha_red_factor_ |
factor by which search direction is to be shortened if trial point is rejected. | |
AlphaForYEnum | alpha_for_y_ |
Flag indicating whether the dual step size is to be used for the equality constraint multipliers. | |
Number | alpha_for_y_tol_ |
Tolerance for primal step to switch to full equality constraint multiplier steps. | |
Number | soft_resto_pderror_reduction_factor_ |
Reduction factor for the restoration phase that accepts steps reducing the optimality error ("soft restoration phase"). | |
Index | max_soft_resto_iters_ |
Maximal number of iterations that can be done in the soft iteration phase before the algorithm reverts to the regular restoration phase. | |
bool | magic_steps_ |
Flag indicating whether magic steps should be used. | |
bool | accept_every_trial_step_ |
Flag indicating whether the line search should always accept the full (fraction-to-the-boundary) step. | |
Index | accept_after_max_steps_ |
Maximal number of trial steps before we blindly accept trial point. | |
bool | expect_infeasible_problem_ |
Indicates whether problem can be expected to be infeasible. | |
Number | expect_infeasible_problem_ctol_ |
Tolerance on constraint violation for expect_infeasible_problem heuristic. | |
Number | expect_infeasible_problem_ytol_ |
Trigger tolerance on constraint multipliers. | |
Number | tiny_step_tol_ |
Tolerance for detecting tiny steps. | |
Number | tiny_step_y_tol_ |
Tolerance for y variables for the tiny step stopping heuristic. | |
Index | watchdog_trial_iter_max_ |
Number of watch dog trial steps. | |
Index | watchdog_shortened_iter_trigger_ |
Number of shortened iterations that trigger the watchdog. | |
bool | start_with_resto_ |
Indicates whether the algorithm should start directly with the restoration phase. | |
Number | constr_viol_tol_ |
unscaled constraint violation tolerance | |
Additional Inherited Members | |
Protected Member Functions inherited from Ipopt::AlgorithmStrategyObject | |
const Journalist & | Jnlst () const |
IpoptNLP & | IpNLP () const |
IpoptData & | IpData () const |
IpoptCalculatedQuantities & | IpCq () const |
bool | HaveIpData () const |
General implementation of a backtracking line search.
This class can be used to perform the filter line search procedure or other procedures. The BacktrackingLSAcceptor is used to determine whether trial points are acceptable (e.g., based on a filter or other methods).
This backtracking line search knows of a restoration phase (which is called when the trial step size becomes too small or no search direction could be computed). It also has the notion of a "soft restoration phase," which uses the regular steps but decides on the acceptability based on other measures than the regular ones (e.g., reduction of the PD error instead of acceptability to a filter mechanism).
Definition at line 35 of file IpBacktrackingLineSearch.hpp.
enumeration for the different alpha_for_y_ settings
Definition at line 299 of file IpBacktrackingLineSearch.hpp.
Ipopt::BacktrackingLineSearch::BacktrackingLineSearch | ( | const SmartPtr< BacktrackingLSAcceptor > & | acceptor, |
const SmartPtr< RestorationPhase > & | resto_phase, | ||
const SmartPtr< ConvergenceCheck > & | conv_check | ||
) |
Constructor.
The acceptor implements the acceptance test for the line search. The ConvergenceCheck object is used to determine whether the current iterate is acceptable (for example, the restoration phase is not started if the acceptability level has been reached). If conv_check is NULL, we assume that the current iterate is not acceptable (in the sense of the acceptable_tol option).
|
virtual |
Destructor.
|
private |
Copy Constructor.
|
virtual |
InitializeImpl - overloaded from AlgorithmStrategyObject.
Implements Ipopt::AlgorithmStrategyObject.
Perform the line search.
It is assumed that the search direction is computed in the data object.
Implements Ipopt::LineSearch.
Reset the line search.
This function should be called if all previous information should be discarded when the line search is performed the next time. For example, this method should be called if the barrier parameter is changed.
Implements Ipopt::LineSearch.
Set flag indicating whether a very rigorous line search should be performed.
If this flag is set to true, the line search algorithm might decide to abort the line search and not to accept a new iterate. If the line search decided not to accept a new iterate, the return value of CheckSkippedLineSearch() is true at the next call. For example, in the non-monotone barrier parameter update procedure, the filter algorithm should not switch to the restoration phase in the free mode; instead, the algorithm should switch to the fixed mode.
Implements Ipopt::LineSearch.
Definition at line 94 of file IpBacktrackingLineSearch.hpp.
Check if the line search procedure didn't accept a new iterate during the last call of FindAcceptableTrialPoint().
Implements Ipopt::LineSearch.
Definition at line 104 of file IpBacktrackingLineSearch.hpp.
void Ipopt::BacktrackingLineSearch::StopWatchDog | ( | ) |
Stop watch dog if started and restore iterate from before watchdog started.
This method is intended to be called if Ipopt is interrupted during the watchdog pahase.
|
static |
Methods for OptionsList.
|
private |
Default Assignment Operator.
|
private |
Method performing the backtracking line search.
If the watchdog is active, only one trial step is performed (and the trial values are set accordingly)
|
private |
Method for starting the watch dog.
Set all appropriate fields accordingly.
|
private |
Method for stopping the watch dog.
Set all appropriate fields accordingly.
Method for checking if current trial point is acceptable.
It is assumed that the delta information in ip_data is the search direction used in criteria. The primal trial point has to be set before the call.
|
private |
Method for setting the dual variables in the trial fields in IpData, given the search direction.
The step size for the bound multipliers is alpha_dual (the fraction-to-the-boundary step size), and the step size for the equality constraint multipliers depends on the choice of alpha_for_y.
|
private |
Try a step for the soft restoration phase and check if it is acceptable.
The step size is identical for all variables. A point is accepted if it is acceptable for the original acceptability criterion (in which case satisfies_original_criterion = true on return), or if the primal-dual system error was decrease by at least the factor soft_resto_pderror_reduction_factor_. The return value is true, if the trial point was acceptable for the soft restoration phase.
|
private |
Try a second order correction for the constraints.
If the first trial step (with incoming alpha_primal) has been reject, this tries up to max_soc_ second order corrections for the constraints. Here, alpha_primal_test is the step size that has to be used in the filter acceptance tests. On output actual_delta_... has been set to the steps including the second order correction if it has been accepted, otherwise it is unchanged. If the SOC step has been accepted, alpha_primal has the fraction-to-the-boundary value for the SOC step on output. The return value is true, if an SOC step has been accepted.
|
private |
Try higher order corrector (for fast local convergence).
In contrast to a second order correction step, which tries to make an unacceptable point acceptable by improving constraint violation, this corrector step is tried even if the regular primal-dual step is acceptable.
|
private |
Perform magic steps.
Take the current values of the slacks in trial and replace them by better ones that lead to smaller values of the barrier function and less constraint violation.
|
private |
Detect if the search direction is too small.
This should be true if the search direction is so small that if makes numerically no difference.
|
private |
Store current iterate as acceptable point.
|
private |
Restore acceptable point into the current fields of IpData if found.
|
private |
Method for determining if the current iterate is acceptable (in the sense of the acceptable_tol options).
This is a wrapper for same method from ConvergenceCheck.
|
private |
factor by which search direction is to be shortened if trial point is rejected.
Definition at line 296 of file IpBacktrackingLineSearch.hpp.
|
private |
Flag indicating whether the dual step size is to be used for the equality constraint multipliers.
If 0, the primal step size is used, if 1 the dual step size, and if 2, the minimum of both.
Definition at line 318 of file IpBacktrackingLineSearch.hpp.
|
private |
Tolerance for primal step to switch to full equality constraint multiplier steps.
Definition at line 323 of file IpBacktrackingLineSearch.hpp.
|
private |
Reduction factor for the restoration phase that accepts steps reducing the optimality error ("soft restoration phase").
If 0., then this restoration phase is not enabled.
Definition at line 330 of file IpBacktrackingLineSearch.hpp.
|
private |
Maximal number of iterations that can be done in the soft iteration phase before the algorithm reverts to the regular restoration phase.
Definition at line 335 of file IpBacktrackingLineSearch.hpp.
|
private |
Flag indicating whether magic steps should be used.
Definition at line 338 of file IpBacktrackingLineSearch.hpp.
|
private |
Flag indicating whether the line search should always accept the full (fraction-to-the-boundary) step.
Definition at line 342 of file IpBacktrackingLineSearch.hpp.
|
private |
Maximal number of trial steps before we blindly accept trial point.
If set to value other than -1, we accept a trial point even if it is not satisfying acceptance criteria.
Definition at line 349 of file IpBacktrackingLineSearch.hpp.
|
private |
Indicates whether problem can be expected to be infeasible.
This will trigger requesting a tighter reduction in infeasibility the first time the restoration phase is called.
Definition at line 356 of file IpBacktrackingLineSearch.hpp.
|
private |
Tolerance on constraint violation for expect_infeasible_problem heuristic.
If the constraint violation becomes that than this value, the heuristic is disabled for the rest of the optimization run.
Definition at line 364 of file IpBacktrackingLineSearch.hpp.
|
private |
Trigger tolerance on constraint multipliers.
If expect_infeasible_problem is chosen, and the multipliers become larger in max-norm than this value, the restoration phase is triggered.
Definition at line 371 of file IpBacktrackingLineSearch.hpp.
|
private |
Tolerance for detecting tiny steps.
Definition at line 374 of file IpBacktrackingLineSearch.hpp.
|
private |
Tolerance for y variables for the tiny step stopping heuristic.
If repeatedly a tiny step is detected and the step in the y_c and y_d variables is less than this threshold, we algorithm will stop.
Definition at line 383 of file IpBacktrackingLineSearch.hpp.
|
private |
Number of watch dog trial steps.
Definition at line 386 of file IpBacktrackingLineSearch.hpp.
|
private |
Number of shortened iterations that trigger the watchdog.
Definition at line 388 of file IpBacktrackingLineSearch.hpp.
|
private |
Indicates whether the algorithm should start directly with the restoration phase.
Definition at line 393 of file IpBacktrackingLineSearch.hpp.
|
private |
unscaled constraint violation tolerance
Definition at line 396 of file IpBacktrackingLineSearch.hpp.
|
private |
Flag indicating if the watchdog is active.
Definition at line 402 of file IpBacktrackingLineSearch.hpp.
|
private |
Counter for shortened iterations.
Definition at line 404 of file IpBacktrackingLineSearch.hpp.
|
private |
Counter for watch dog iterations.
Definition at line 406 of file IpBacktrackingLineSearch.hpp.
|
private |
Step size for Armijo test in watch dog.
Definition at line 408 of file IpBacktrackingLineSearch.hpp.
|
private |
Watchdog reference iterate.
Definition at line 410 of file IpBacktrackingLineSearch.hpp.
|
private |
Watchdog search direction at reference point.
Definition at line 412 of file IpBacktrackingLineSearch.hpp.
|
private |
Barrier parameter value during last line search.
Definition at line 414 of file IpBacktrackingLineSearch.hpp.
|
private |
Definition at line 420 of file IpBacktrackingLineSearch.hpp.
|
private |
Definition at line 421 of file IpBacktrackingLineSearch.hpp.
|
private |
Flag indicating whether the algorithm has asked to immediately switch to the fallback mechanism (restoration phase)
Definition at line 427 of file IpBacktrackingLineSearch.hpp.
|
private |
Flag indicating whether the line search is to be performed robust (usually this is true, unless SetRigorousLineSearch is called with false).
Definition at line 433 of file IpBacktrackingLineSearch.hpp.
|
private |
Flag indicating whether no acceptable trial point was found during last line search.
Definition at line 438 of file IpBacktrackingLineSearch.hpp.
|
private |
Flag indicating whether we are currently in the "soft" restoration phase mode, in which steps are accepted if they reduce the optimality error (see soft_resto_pderror_reduction_factor)
Definition at line 445 of file IpBacktrackingLineSearch.hpp.
|
private |
Counter for iteration performed in soft restoration phase in a row.
Definition at line 448 of file IpBacktrackingLineSearch.hpp.
|
private |
Counter for the number of successive iterations in which the full step was not accepted.
Definition at line 453 of file IpBacktrackingLineSearch.hpp.
|
private |
Flag indicating if a tiny step was detected in previous iteration.
Definition at line 456 of file IpBacktrackingLineSearch.hpp.
|
private |
Definition at line 460 of file IpBacktrackingLineSearch.hpp.
|
private |
Definition at line 461 of file IpBacktrackingLineSearch.hpp.
|
private |
Definition at line 462 of file IpBacktrackingLineSearch.hpp.