//#####################################################################
// Copyright 2009.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
// Class LINE_SEARCH
//##################################################################### 
#ifndef __LINE_SEARCH__
#define __LINE_SEARCH__
#include <cfloat>
#include <functional>
namespace PhysBAM{

// note: always has df=0
template<class T> bool
Line_Search_Quadratic_Golden_Section(const std::function<T(T x,T* df)>& F,
    T a,T b,T& x,int max_iterations,T interval_tolerance,T quadratic_tolerance);

// note: always has df=0
template<class T> bool
Line_Search_Golden_Section(const std::function<T(T x,T* df)>& F,
    T a,T b,T& x,int max_iterations,T interval_tolerance);

// note: always has df!=0
// Treat f(x) as only accurate to +-/ objective_error.
template<class T> bool
Line_Search_Backtracking(const std::function<T(T x,T* df)>& F,
    T a,T b,T& x,T c,T objective_error);

// note: always has df!=0
// Treat f(x) as only accurate to +-/ objective_error.
template<class T> bool
Line_Search_Wolfe_Conditions(const std::function<T(T x,T* df)>& F,
    T a,T b,T& x,T c1,T c2,T objective_error,T x_max);

// note: always has df!=0
template<class T> void
Line_Search_Derivative_Bisection(const std::function<T(T x,T* df)>& F,
    T a,T b,T& x,T allowed_relative_increase,T x_max);

}
#endif
