Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-tectonic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
podlesny
dune-tectonic
Commits
aae2defb
Commit
aae2defb
authored
11 years ago
by
Elias Pipping
Browse files
Options
Downloads
Patches
Plain Diff
[Algorit] Make minimisation terminate
parent
c8774a97
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/tectonic/minimisation.hh
+22
-0
22 additions, 0 deletions
dune/tectonic/minimisation.hh
with
22 additions
and
0 deletions
dune/tectonic/minimisation.hh
+
22
−
0
View file @
aae2defb
...
@@ -28,6 +28,14 @@ template <class Functional>
...
@@ -28,6 +28,14 @@ template <class Functional>
void
minimise
(
Functional
const
&
J
,
typename
Functional
::
LocalVector
&
x
,
void
minimise
(
Functional
const
&
J
,
typename
Functional
::
LocalVector
&
x
,
size_t
steps
,
Bisection
const
&
bisection
)
{
size_t
steps
,
Bisection
const
&
bisection
)
{
using
LocalVector
=
typename
Functional
::
LocalVector
;
using
LocalVector
=
typename
Functional
::
LocalVector
;
auto
const
diff
=
[](
LocalVector
const
&
a
,
LocalVector
const
&
b
)
{
LocalVector
tmp
=
a
;
tmp
-=
b
;
return
tmp
.
two_norm
();
};
LocalVector
x_initial
=
x
;
LocalVector
x_o
=
x
;
for
(
size_t
step
=
0
;
step
<
steps
;
++
step
)
{
for
(
size_t
step
=
0
;
step
<
steps
;
++
step
)
{
LocalVector
v
;
LocalVector
v
;
...
@@ -40,6 +48,20 @@ void minimise(Functional const &J, typename Functional::LocalVector &x,
...
@@ -40,6 +48,20 @@ void minimise(Functional const &J, typename Functional::LocalVector &x,
double
const
alpha
=
lineSearch
(
J
,
x
,
v
,
bisection
);
double
const
alpha
=
lineSearch
(
J
,
x
,
v
,
bisection
);
Arithmetic
::
addProduct
(
x
,
alpha
,
v
);
Arithmetic
::
addProduct
(
x
,
alpha
,
v
);
if
(
alpha
<
1e-14
)
// TODO
break
;
double
const
correction
=
diff
(
x
,
x_o
);
double
const
overallCorrection
=
diff
(
x
,
x_initial
);
if
(
overallCorrection
<=
0.0
)
return
;
double
const
correctionQuotient
=
correction
/
overallCorrection
;
if
(
correctionQuotient
<
0.1
)
// enough descent; TODO
break
;
x_o
=
x
;
}
}
}
}
#endif
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment