mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Made the optimization functions not return the value of the objective
function. --HG-- extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402271
This commit is contained in:
parent
7deee75572
commit
9717c6ca8b
@ -209,7 +209,9 @@ namespace dlib
|
|||||||
double alpha = mu*poly_min_extrap(f0, d0, f1, d1);
|
double alpha = mu*poly_min_extrap(f0, d0, f1, d1);
|
||||||
alpha = put_in_range(0.1*mu, 0.9*mu, alpha);
|
alpha = put_in_range(0.1*mu, 0.9*mu, alpha);
|
||||||
|
|
||||||
DLIB_CASSERT(alpha < std::numeric_limits<double>::infinity(), alpha);
|
DLIB_CASSERT(alpha < std::numeric_limits<double>::infinity(),
|
||||||
|
"alpha: " << alpha << " mu: " << mu << " f0: " << f0 << " d0: " << d0 << " f1: " << f1 << " d1: " << d1
|
||||||
|
);
|
||||||
|
|
||||||
double last_alpha = 0;
|
double last_alpha = 0;
|
||||||
double last_val = f0;
|
double last_val = f0;
|
||||||
@ -302,12 +304,16 @@ namespace dlib
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DLIB_CASSERT(alpha < std::numeric_limits<double>::infinity(), alpha);
|
DLIB_CASSERT(alpha < std::numeric_limits<double>::infinity(),
|
||||||
|
"alpha: " << alpha << " mu: " << mu << " f0: " << f0 << " d0: " << d0 << " f1: " << f1 << " d1: " << d1
|
||||||
|
);
|
||||||
|
|
||||||
// Now do the sectioning phase from 2.6.4
|
// Now do the sectioning phase from 2.6.4
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
DLIB_CASSERT(alpha < std::numeric_limits<double>::infinity(), alpha);
|
DLIB_CASSERT(alpha < std::numeric_limits<double>::infinity(),
|
||||||
|
"alpha: " << alpha << " mu: " << mu << " f0: " << f0 << " d0: " << d0 << " f1: " << f1 << " d1: " << d1
|
||||||
|
);
|
||||||
double first = a + tau2*(b-a);
|
double first = a + tau2*(b-a);
|
||||||
double last = b - tau3*(b-a);
|
double last = b - tau3*(b-a);
|
||||||
|
|
||||||
@ -358,7 +364,7 @@ namespace dlib
|
|||||||
typename funct_der,
|
typename funct_der,
|
||||||
typename T
|
typename T
|
||||||
>
|
>
|
||||||
double find_min_quasi_newton (
|
void find_min_quasi_newton (
|
||||||
const funct& f,
|
const funct& f,
|
||||||
const funct_der& der,
|
const funct_der& der,
|
||||||
T& x,
|
T& x,
|
||||||
@ -423,7 +429,6 @@ namespace dlib
|
|||||||
g.swap(g2);
|
g.swap(g2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return f_value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
@ -433,7 +438,7 @@ namespace dlib
|
|||||||
typename funct_der,
|
typename funct_der,
|
||||||
typename T
|
typename T
|
||||||
>
|
>
|
||||||
double find_min_conjugate_gradient (
|
void find_min_conjugate_gradient (
|
||||||
const funct& f,
|
const funct& f,
|
||||||
const funct_der& der,
|
const funct_der& der,
|
||||||
T& x,
|
T& x,
|
||||||
@ -477,7 +482,6 @@ namespace dlib
|
|||||||
g.swap(g2);
|
g.swap(g2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return f_value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
@ -149,7 +149,7 @@ namespace dlib
|
|||||||
typename funct_der,
|
typename funct_der,
|
||||||
typename T
|
typename T
|
||||||
>
|
>
|
||||||
double find_min_quasi_newton (
|
void find_min_quasi_newton (
|
||||||
const funct& f,
|
const funct& f,
|
||||||
const funct_der& der,
|
const funct_der& der,
|
||||||
T& x,
|
T& x,
|
||||||
@ -171,7 +171,6 @@ namespace dlib
|
|||||||
- the change in f() from one iteration to the next is less than min_delta
|
- the change in f() from one iteration to the next is less than min_delta
|
||||||
- f(#x) <= min_f
|
- f(#x) <= min_f
|
||||||
- #x == the value of x that was found to minimize f()
|
- #x == the value of x that was found to minimize f()
|
||||||
- returns f(#x)
|
|
||||||
!*/
|
!*/
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
@ -181,7 +180,7 @@ namespace dlib
|
|||||||
typename funct_der,
|
typename funct_der,
|
||||||
typename T
|
typename T
|
||||||
>
|
>
|
||||||
double find_min_conjugate_gradient (
|
void find_min_conjugate_gradient (
|
||||||
const funct& f,
|
const funct& f,
|
||||||
const funct_der& der,
|
const funct_der& der,
|
||||||
T& x,
|
T& x,
|
||||||
@ -203,7 +202,6 @@ namespace dlib
|
|||||||
- the change in f() from one iteration to the next is less than min_delta
|
- the change in f() from one iteration to the next is less than min_delta
|
||||||
- f(#x) <= min_f
|
- f(#x) <= min_f
|
||||||
- #x == the value of x that was found to minimize f()
|
- #x == the value of x that was found to minimize f()
|
||||||
- returns f(#x)
|
|
||||||
!*/
|
!*/
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user