Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
a37c5e7c
Commit
a37c5e7c
authored
Feb 19, 2018
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the example program contents as a test as well.
parent
9691c194
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
test_global_optimization.py
tools/python/test/test_global_optimization.py
+14
-0
No files found.
tools/python/test/test_global_optimization.py
View file @
a37c5e7c
...
@@ -21,3 +21,17 @@ def test_global_optimization_nargs():
...
@@ -21,3 +21,17 @@ def test_global_optimization_nargs():
find_max_global
(
lambda
a
,
b
,
c
,
d
,
*
args
:
0
,
[
0
,
0
,
0
],
[
1
,
1
,
1
],
10
)
find_max_global
(
lambda
a
,
b
,
c
,
d
,
*
args
:
0
,
[
0
,
0
,
0
],
[
1
,
1
,
1
],
10
)
with
raises
(
Exception
):
with
raises
(
Exception
):
find_min_global
(
lambda
a
,
b
,
c
,
d
,
*
args
:
0
,
[
0
,
0
,
0
],
[
1
,
1
,
1
],
10
)
find_min_global
(
lambda
a
,
b
,
c
,
d
,
*
args
:
0
,
[
0
,
0
,
0
],
[
1
,
1
,
1
],
10
)
from
math
import
sin
,
cos
,
pi
,
exp
,
sqrt
def
holder_table
(
x0
,
x1
):
return
-
abs
(
sin
(
x0
)
*
cos
(
x1
)
*
exp
(
abs
(
1
-
sqrt
(
x0
*
x0
+
x1
*
x1
)
/
pi
)))
def
test_on_holder_table
():
x
,
y
=
find_min_global
(
holder_table
,
[
-
10
,
-
10
],
[
10
,
10
],
200
)
assert
(
y
-
-
19.2085025679
)
<
1e-7
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