Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
CoMISo
CoMISo
Commits
519345c8
Commit
519345c8
authored
Jun 29, 2017
by
Patrick Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added max_linesearch_iters option to NewtonSolver.
parent
9edeb026
Pipeline
#6994
failed with stages
in 7 minutes and 3 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
NSolver/NewtonSolver.cc
NSolver/NewtonSolver.cc
+2
-2
NSolver/NewtonSolver.hh
NSolver/NewtonSolver.hh
+3
-2
No files found.
NSolver/NewtonSolver.cc
View file @
519345c8
...
...
@@ -174,7 +174,7 @@ int NewtonSolver::solve(NProblemInterface* _problem, const SMatrixD& _A,
double
t
=
t_max
;
bool
x_ok
=
false
;
for
(
int
i
=
0
;
i
<
10
;
++
i
<
3
?
t
*=
0.95
:
t
/=
2
)
for
(
int
i
=
0
;
i
<
max_linesearch_iters_
;
++
i
<
3
?
t
*=
0.95
:
t
/=
2
)
{
// clamp back t very mildly the first 3 steps and then aggressively (/ 2)
x
=
x0
+
dx
.
head
(
n
)
*
t
;
fx
=
_problem
->
eval_f
(
x
.
data
());
...
...
@@ -324,7 +324,7 @@ double NewtonSolver::backtracking_line_search(NProblemInterface* _problem,
double
t
=
_t_start
;
// backtracking (stable in case of NAN and with max 100 iterations)
for
(
int
i
=
0
;
i
<
100
;
++
i
)
for
(
int
i
=
0
;
i
<
max_linesearch_iters_
;
++
i
)
{
// current update
x_ls_
=
_x
+
_dx
.
head
(
n
)
*
t
;
...
...
NSolver/NewtonSolver.hh
View file @
519345c8
...
...
@@ -57,8 +57,8 @@ public:
typedef
Eigen
::
Triplet
<
double
>
Triplet
;
/// Default constructor
NewtonSolver
(
const
double
_eps
=
1e-6
,
const
double
_eps_line_search
=
1e-9
,
const
int
_max_iters
=
200
,
const
double
_alpha_ls
=
0.2
,
const
double
_beta_ls
=
0.6
)
:
eps_
(
_eps
),
eps_ls_
(
_eps_line_search
),
max_iters_
(
_max_iters
),
alpha_ls_
(
_alpha_ls
),
beta_ls_
(
_beta_ls
),
solver_type_
(
LS_EigenLU
),
constant_hessian_structure_
(
false
)
NewtonSolver
(
const
double
_eps
=
1e-6
,
const
double
_eps_line_search
=
1e-9
,
const
int
_max_iters
=
200
,
const
int
_max_linesearch_iters
=
100
,
const
double
_alpha_ls
=
0.2
,
const
double
_beta_ls
=
0.6
)
:
eps_
(
_eps
),
eps_ls_
(
_eps_line_search
),
max_iters_
(
_max_iters
),
max_linesearch_iters_
(
_max_linesearch_iters
),
alpha_ls_
(
_alpha_ls
),
beta_ls_
(
_beta_ls
),
solver_type_
(
LS_EigenLU
),
constant_hessian_structure_
(
false
)
{
//#if COMISO_SUITESPARSE_AVAILABLE
// solver_type_ = LS_Umfpack;
...
...
@@ -133,6 +133,7 @@ private:
double
eps_
;
double
eps_ls_
;
int
max_iters_
;
int
max_linesearch_iters_
;
// double accelerate_;
double
alpha_ls_
;
double
beta_ls_
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment