Download SCAN-2012 slides

Document related concepts
no text concepts found
Transcript
SCAN’2012
15’th GAMM-IMACS International Symposium on Scientific Computing,
Computer Arithmetic and Verified Numerical Computations
Novosibirsk, September 23–29, 2012
JInterval Library: Principles, Development,
and Perspectives
Dmitry Ju. Nadezhin
Sergei I. Zhilin
Oracle Labs
Zelenograd, Russia
[email protected]
Altai State University
Barnaul, Russia
[email protected]
Outline
Why Interval Computations in Java Virtual Machine (JVM)?
 JInterval Evolution
 Architecture
 Functionality and Examples
 Applications
 Perspectives

Novosibirsk, 26 Sep 2012
SCAN 2012
2 / 60
JInterval Library: Principles, Development, and Perspectives
WHY INTERVAL COMPUTATIONS IN JVM?
Novosibirsk, 26 Sep 2012
SCAN 2012
3 / 60
Java Is Popular

TIOBE Programming Community Index for September 2012
– Calculated by counting hits of the most popular search engines
Novosibirsk, 26 Sep 2012
SCAN 2012
4 / 60
Java Is Popular
RedMonk’s language ranking for September 2012
Popularity Rank on StackOverflow.com (by # of tags)

Popularity Rank on Github.com (by # of projects)
Novosibirsk, 26 Sep 2012
SCAN 2012
5 / 60
Java Is Popular

Bookscan's reports on the top 3,000 titles sold
Novosibirsk, 26 Sep 2012
SCAN 2012
6 / 60
Gap between Interval and Applied Software

Java is an attractive and widely adopted technology for applied
software development
–
–
–
–
–



Cross-platform portability of applications
General purpose object-oriented language
Almost any language can generate Java bytecodes
Advanced tools for distributed systems development
Huge amount of applied libraries
Interval analysis and interval computations have proved to be useful
in numerous real-world applications
Interval software in Java is of fragmentary character
Creation of systematic full-featured high-level interval library for
Java brings interval tools closer to developers of applied software
Novosibirsk, 26 Sep 2012
SCAN 2012
7 / 60
Interval Computations in Java

Is Java suitable for scientific computing?
Pro:
Con:
• Portability of Java Virtual Machine (JVM)
• Safe memory management
(no memory leaks and pointer errors)
• Network-aware environment
• Parallel and distributed computing
(threads, RMI)
• Strict model of security
• Standard API for GUI, graphics, DBMS, …
• Widely adopted
– Embedded systems, browsers, …
– Development, teaching, …
• Low performance
– Virtual machine
– Interpretation is slow
– Overhead cost of safe memory management
• Language restrictions
–
–
–
–
No primitive structure type
No operator overloading
No traditional multidimesional arrays
No full compliance with IEEE 754*
• Relatively small number of scientific
libraries on Java
• Scientific computing traditions:
Fortran, С/С++
*Kahan W., Darcy J.D. How Java’s Floating-Point Hurts Everyone Everywhere//ACM 1998 Workshop on Java for
High–Performance Network Computing, Stanford University, March 1998, http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf
Novosibirsk, 26 Sep 2012
SCAN 2012
8 / 60
Interval Java Libraries

IA_math, 1997
–
–
–
–

Classic IA, classic interval elementary functions
Timothy J. Hickey,
Brandeis University, Boston, USA
interval.sourceforge.net/interval/
Java-XSC, 1999
– Classic IA, rectangular complex IA, classic interval elementary functions,
classic and complex interval vectors and matrices
– Benjamin R.C. Bedregal, Jose E.M. Dutra
– Universidade Federal do Rio Grande do Norte, Natal, Brazil
– www.dimap.ufrn.br/~java-xsc/jxsc2007.html
Novosibirsk, 26 Sep 2012
SCAN 2012
9 / 60
JInterval Library: Principles, Development, and Perspectives
JINTERVAL EVOLUTION
Novosibirsk, 26 Sep 2012
SCAN 2012
10 / 60
Stages of JInterval Evolution

Sep 2008
JInterval is started as undergraduate student project
”Childhood” at Altai State University (Barnaul, Russia)
http://code.google.com/p/javaintervalmathasu/

Aug 2009
“Boyhood”
Dmitry Nadezhin (Sun Labs, Zelenograd, Russia)
joins the project
http://kenai.com/projects/jinterval

Jan 2012
“Youth”
Developing reference implementation and
test suite for P1788 becomes Priority #1
http://java.net/projects/jinterval or
http://jinterval.java.net
Novosibirsk, 26 Sep 2012
SCAN 2012
11 / 60
JInterval (Boyhood): A Priori Requirements
The library
1. Must be clear and easy to use
2. Should provide flexibility in the choice of interval algebra for
computations
4. Should provide flexibility in choosing precision of interval
boundaries and associated rounding policies
5. Must be portable
Priority
3. Should provide flexibility to extend its functionality
6. Should provide high performance
7. Must be open source
Novosibirsk, 26 Sep 2012
SCAN 2012
12 / 60
JInterval (Boyhood): Architecture

“Fast” branch:
– Interval bounds: double, nearest rounding
– IA: set-based, Kaucher, complex rectangular, complex circular, complex ring,
complex polar
– Interval elementary functions, vectors, matrices
– ILS: Gauss, Gauss-Seidel, subdifferential Newton, NonNeg, Shaidurov

“Rational bounds” branch:
– Interval bounds: smart rational/double, arbitrary precision, rounding
policies, contexts
– IA: set-based
– Interval elementary functions, vectors, matrices

Generic interfaces on top of branches
Novosibirsk, 26 Sep 2012
SCAN 2012
13 / 60
JInterval (Boyhood): Type Hierarchy
Interval
ClassicRealInterval
ComplexInterval
RealInterval
DoubleInterval
ComplexIntervalCircle
RationalInterval
ComplexIntervalRectangle
ComplexIntervalPolar
ComplexIntervalRing
Novosibirsk, 26 Sep 2012
SCAN 2012
14 / 60
JInterval (Boyhood): Lessons Learned
Problem
Possible Solution
Java syntax is not expressive enough Developing Scala API for a new
for calculations
JInterval implementation
Java
Scala
r = x.add(y.multiply(z));
r = x + y*z
JInterval is not compliant with the
project of interval standard IEEE
P1788
Redesign the library according to
IEEE P1788
Low performance
Using optional plugins for native code
of high precision arithmetic and
interval linear algebra algorithms
through JNA
Novosibirsk, 26 Sep 2012
SCAN 2012
15 / 60
JInterval Library: Principles, Development, and Perspectives
ARCHITECTURE
Novosibirsk, 26 Sep 2012
SCAN 2012
16 / 60
Class Diagram (package net.java.jinterval.interval)
Novosibirsk, 26 Sep 2012
SCAN 2012
17 / 60
Key-role Interfaces


Types graph follows the flavor
structure of P1788
Java interfaces:
– Interval
Common methods for all flavors
– SetInterval
Extends Interval with methods for
flavor ‘Set Interval’
– KaucherInterval
Extends Interval with methods for
flavor ‘Kaucher interval’
– ClassicInterval
Extends all flavors, because can be
mapped to related flavor intervals
Novosibirsk, 26 Sep 2012
SCAN 2012
18 / 60
Interface Interval: common methods of all flavors


Interval defines common
methods of all interval flavors
Defines numerical and boolean
operations only
Novosibirsk, 26 Sep 2012
SCAN 2012
19 / 60
IntervalContext: interval operations interface

Generic interface
IntervalContext
defines signature for
interval-valued methods
Novosibirsk, 26 Sep 2012
SCAN 2012
20 / 60
KaucherIntervalContext: interval flavor interface

KaucherIntervalContext
extends IntervalContext
and binds type variable I
to Kaucher interval flavor
Novosibirsk, 26 Sep 2012
SCAN 2012
21 / 60
Implementation of interval contexts

There may be several implementations for flavor contexts
– SetIntervalContextInfSupBase and SetIntervalContextInfSup
are two tightest implementations of set interval operations and functions
(P1788 Level 2, InfSup_F).
Novosibirsk, 26 Sep 2012
SCAN 2012
22 / 60
Factory classes for interval contexts

Factory classes create particular instances of interval contexts
– SetIntervalContexts
– KaucherIntervalContexts
Novosibirsk, 26 Sep 2012
SCAN 2012
23 / 60
Exact context


Static method getExact() creates the exact context
All operations in the exact context return intervals with rational
bounds – P1788 Level 1 results or throw IrrationalException
Novosibirsk, 26 Sep 2012
SCAN 2012
24 / 60
InfSup_F contexts

Static method getInfSup(BinaryValueSet numberFormat) creates the
InfsSup_F contexts with binary floating-point interval representations
(BINARY32, BINARY64, BINARY128, …, BINARY1024)
Novosibirsk, 26 Sep 2012
SCAN 2012
25 / 60
Core Module Dependencies Graph
JInterval packages
External dependencies
jinterval
jinterval-rational-java
boehm-creals
Aggregator of JInterval
Rational numbers
Boehm’s constructive reals
jinterval-interval-java
fortress-rounding
Intervals, IAs, interval elem. functions
Rounding class from Fortress
jinterval-ils
commons-math3
Interval linear equation system solver
Apache Commons Math 3.0
jinterval-ir
lpsolve
Interval regression solver
Java port of lp_solve
mpfr-adapter
jna
JNA adapter for native GNU MPFR
Java access to native libraries
large-test-java
commons-compress
JInterval tests
Apache Commons Compress 1.4
Novosibirsk, 26 Sep 2012
SCAN 2012
26 / 60
JInterval Library: Principles, Development, and Perspectives
FUNCTIONALITY AND EXAMPLES
Novosibirsk, 26 Sep 2012
SCAN 2012
27 / 60
Functionality of JInterval (Youth)

Rational arithmetic
–
–

–
–

ILS Solvers
•
Rational + {-∞ , +∞}
•
–
Set-based
Kaucher
According to P1788
Novosibirsk, 26 Sep 2012
SCAN 2012
Hansen-Bliek-Rohn-NingKearfott enclosure +
Gauss-Seidel
Subdifferential Newton
Interval linear regression solver
•
•
•
•
Elementary Functions
–
Rational, extended rational
Interval
Solvers
–
Interval Arithmetic
–
–

Dense Vectors and Matrices
Extended Rational arithmetic
–

flexible inner representation
(rational, binary32, binary64,
binary128,…)
exact and approximate
operations

Data consistency check
Outlier detection
Object status detection
Interval prediction
28 / 60
Example 1.1. Contexts and Simple Expressions
,
,
,
.
x+y = [3.0,5.0]
x/y = [0.333251953125,1.0]
Novosibirsk, 26 Sep 2012
SCAN 2012
29 / 60
Example 1.2. Contexts and Simple Expressions
,
,
,
.
x+y = [3.0,5.0]
x/y = [0.3333333134651184,1.0]
Novosibirsk, 26 Sep 2012
SCAN 2012
30 / 60
Example 1.3. Contexts and Simple Expressions
,
,
,
.
x+y = [3.0,5.0]
x/y = [+0x15555555555555555555555555555p-114,+0x1p0]
([0.3333333333333333,1.0])
Novosibirsk, 26 Sep 2012
SCAN 2012
31 / 60
Example 1.4. Contexts and Simple Expressions
,
,
,
.
x+y = [3.0,5.0]
x/y = [+0x1/0x3*2^0,+0x1p0]([0.3333333333333333,1.0])
Novosibirsk, 26 Sep 2012
SCAN 2012
32 / 60
Example 2.1. Decorations
sqrt([0.0,1.0]) = [0.0,1.0] COM
sqrt([-1.0,1.0]) = [0.0,1.0] CON
sqrt([-2.0,-1.0]) = [EMPTY] NDF
sqrt([EMPTY]) = [EMPTY] SAF
Novosibirsk, 26 Sep 2012
SCAN 2012
33 / 60
Example 2.2. Decorations
1/[0.0,0.0] = [EMPTY] NDF
1/[0.0,1.0] = [1.0,Infinity] CON
1/[4.9E-324,1.0] = [1.0,Infinity] SAF
x = [0.0,Infinity] SAF
Novosibirsk, 26 Sep 2012
y = 1/x = [0.0,Infinity] CON
SCAN 2012
34 / 60
Example 3. (Rump)
Compute
Novosibirsk, 26 Sep 2012
for
,
SCAN 2012
and
35 / 60
Example 3. (Rump) using ExtendedRational
Novosibirsk, 26 Sep 2012
SCAN 2012
36 / 60
Example 3. (Rump) using ExtendedRational
=== BINARY16 ===
r=NaN
=== BINARY32 ===
r=1.172603964805603 +0x9617e3p-23
=== BINARY64 ===
r=-1.1805916207174113E21 -0x1p70
=== BINARY128 ===
r=1.1726039400531787 +0x12c2fc595b06beb74a518f018c093p-112
=== BINARY256 ===
r=-0.8273960599468214
-0x69e81d3527ca0a45ad7387f39fb6bbbee6d0899f57af4ec62443141c771p-235
=== Exact ===
r=-0.8273960599468214 -0xd5ef/0x1029*2^-4
Novosibirsk, 26 Sep 2012
SCAN 2012
37 / 60
Example 3. (Rump) using SetInterval
Novosibirsk, 26 Sep 2012
SCAN 2012
38 / 60
Example 3. (Rump) using SetInterval
===
i =
===
i =
===
i =
===
i =
===
i =
===
i =
BINARY16 ===
[-Infinity,Infinity]
BINARY32 ===
[-6.972078301255262E30,6.972078905718172E30]
BINARY64 ===
[-8.264141345021879E21,5.902958103587058E21]
BINARY128 ===
[-0xffb4f40e9a93e50522d6b9c3f9dp-98,+0x12c2fc595b06beb74a518f018c093p-112]
([-1022.8273960599469,1.1726039400531787])
BINARY256 ===
[-0x69e81d3527ca0a45ad7387f39fb6bbbee6d0899f57af4ec62443141c771p-235,
-0xd3d03a6a4f94148b5ae70fe73f6d777dcda1133eaf5e9d8c48862838ee1p-236]
([-0.8273960599468214,-0.8273960599468213])
Exact ===
[-0xd5ef/0x1029*2^-4,-0xd5ef/0x1029*2^-4]
([-0.8273960599468214,-0.8273960599468213])
Novosibirsk, 26 Sep 2012
SCAN 2012
39 / 60
Example 4. HBRNK enclosure
Novosibirsk, 26 Sep 2012
SCAN 2012
40 / 60
Example 4. HBRNK enclosure using MatlabOps
Novosibirsk, 26 Sep 2012
SCAN 2012
41 / 60
Example 5. Gauss-Seidel Solver
A:
/
| [2.0,4.0] [-2.0,0.0] |
| [-1.0,0.0] [2.0,4.0] |
\
b:
/
| [1.0,2.0] |
| [-2.0,2.0] |
\
x:
/
| [-1.0,4.0] |
| [-1.5,3.0] |
\
Novosibirsk, 26 Sep 2012
SCAN 2012
42 / 60
JInterval Library: Principles, Development, and Perspectives
APPLICATIONS
Novosibirsk, 26 Sep 2012
SCAN 2012
43 / 60
P1788 Test framework
TestSet3.dat
Interval
Libraries
Adapters
Boost
testBoost
CXSC
testCXSC
Filib
testFilib
MPFI
testMPFI
PROFIL
testPROFIL
<NONAME>
test<NONAME>
Novosibirsk, 26 Sep 2012
TestSet2.dat
TestSet1.dat
Launcher
SCAN 2012
Report
44 / 60
P1788 Test framework
Interval
Libraries
Adapters
Boost
testBoost
CXSC
testCXSC
Filib
testFilib
MPFI
testMPFI
PROFIL
testPROFIL
<NONAME>
test<NONAME>
Novosibirsk, 26 Sep 2012
TestSet3.dat
TestSet2.dat
Launcher
Report
TestSet1.dat
SCAN 2012
45 / 60
P1788 Test framework
Interval
Libraries
Adapters
Boost
testBoost
CXSC
testCXSC
Filib
testFilib
MPFI
testMPFI
PROFIL
testPROFIL
TestSet2.dat
<NONAME>
test<NONAME>
TestSet1.dat
Novosibirsk, 26 Sep 2012
TestSet3.dat
Report
Launcher
SCAN 2012
46 / 60
P1788 Test framework. Sample Run
testDemo.dat
* div
[1,2] [0,1]
[1,2] [0,0]
* sqrt
[-Infinity,0]
[-Infinity,Infinity]
* pown
[0,0] 0
Report
== Filib 3.0.2
div [1.0,2.0] [0.0,1.0] = [1.0,Infinity] : [1.0,Infinity] Ok
div [1.0,2.0] [0.0,0.0] = [EMPTY] : [1.7976931348623157E308,Infinity] NOT TIGHT!
sqrt [-Infinity,0.0] = [0.0,0.0] : [0.0,0.0] Ok
sqrt [-Infinity,Infinity] = [0.0,Infinity] : [-4.9E-324,Infinity] NOT TIGHT!
pown [0.0,0.0] 0 = [1.0,1.0] : [1.0,1.0] Ok
==
== Boost 1.48.0
div [1.0,2.0] [0.0,1.0] = [1.0,Infinity] : [1.0,Infinity] Ok
div [1.0,2.0] [0.0,0.0] = [EMPTY] : [EMPTY] Ok
sqrt [-Infinity,0.0] = [0.0,0.0] : [0.0,0.0] Ok
sqrt [-Infinity,Infinity] = [0.0,Infinity] : [0.0,Infinity] Ok
pown [0.0,0.0] 0 = [1.0,1.0] : [EMPTY] CONTAINMENT FAILURE!!!
==
== MPFI 1.5.1
div [1.0,2.0] [0.0,1.0] = [1.0,Infinity] : [1.0,Infinity] Ok
div [1.0,2.0] [0.0,0.0] = [EMPTY] : [-Infinity,Infinity] NOT TIGHT!
sqrt [-Infinity,0.0] = [0.0,0.0] : [EMPTY] CONTAINMENT FAILURE!!!
sqrt [-Infinity,Infinity] = [0.0,Infinity] : [EMPTY] CONTAINMENT FAILURE!!!
Library has no Operation "pown" in line 7 : * pown
==
Novosibirsk, 26 Sep 2012
SCAN 2012
47 / 60
KNIME

KNIME— open source data mining platform
Novosibirsk, 26 Sep 2012
SCAN 2012
48 / 60
KNIME Interval Tools

KNIME— open source data mining platform
Novosibirsk, 26 Sep 2012
SCAN 2012
49 / 60
KNIME Nodes for Interval Regression
Interval Regression
( Learner)
Interval Regression
( Predictor)
Builds linear interval
regression model Y = f(X, A)
Calculates interval prediction Y*
for X* using model Y = F(X, A)
IR Outlier Detector
IR Consistency
Detects outliers (observations
with underestimated error bound)
Checks consistency of input data
and sets flow control variable
for IF switch
Novosibirsk, 26 Sep 2012
SCAN 2012
50 / 60
KNIME Nodes for ILS Solving

In previous version of “Interval Tools”:
ILS Solver
Computes inner/outer estimate of united/tolerable
solution set and visualizes* 2D/3D united solution set
*Kraemer W. Computing and visualizing solutions sets of interval linear systems, Serdica J. Computing 1(4) 2007, 455-468.
Novosibirsk, 26 Sep 2012
SCAN 2012
51 / 60
KNIME Nodes for ILS Solving
Under construction
ILS Solver
ILS United Solution Set View
Computes outer and inner estimates
for united solution set of ILS Ax=b
Visualizes 2D or 3D
united solution set
Methods for united solution set
estimation:
– Outer:
Hansen-Bliek-Rohn-NingKearfott enclosure + GaussSeidel
Method:
– I. A. Sharaya’s
algorithm for
visualization of AEsolution sets
– Inner:
Subdifferential Newton
Novosibirsk, 26 Sep 2012
SCAN 2012
52 / 60
KNIME Workflow for Image Recognition
Get A1, b
Solve A1*x=b
Metrics values
Read reference
images
Join
Convert to matrices
Join
Build interval
matrices
Get A2, b
Solve A2*x=b
Join
Calc metrics
Read image
to recognize
Convert to matrices
Solve non-interval ILS
Metrics histogram
Prolubnikov A.V., Silitskiy S.A. On solving the problem of numeric matrices recognition using estimates of solution sets of interval
systems of equations // Comp. Math. Proceedings of XIV Baikal International School-Seminar “Methods of optimization and its
applications” Irkutsk-Baikal, July 2-8 июля 2008. Vol. 3. – Irkutsk: ISEM SB RAS, 2008. – pp. 152-157. (in Russian)
Novosibirsk, 26 Sep 2012
SCAN 2012
53 / 60
KNIME Workflow for Image Recognition
Get A1, b
Solve A1*x=b
Metrics values
Read reference
images
Join
Convert to matrices
Join
Build interval
matrices
Get A2, b
Solve A2*x=b
Join
Calc metrics
Read image
to recognize
Convert to matrices
Solve non-interval ILS
Metrics histogram
Prolubnikov A.V., Silitskiy S.A. On solving the problem of numeric matrices recognition using estimates of solution sets of interval
systems of equations // Comp. Math. Proceedings of XIV Baikal International School-Seminar “Methods of optimization and its
applications” Irkutsk-Baikal, July 2-8 июля 2008. Vol. 3. – Irkutsk: ISEM SB RAS, 2008. – pp. 152-157. (in Russian)
Novosibirsk, 26 Sep 2012
SCAN 2012
54 / 60
Mobile Application “Affiche”

Modeling positional
uncertainties for
GPS+GSM navigation
using circular complex
arithmetic
Novosibirsk, 26 Sep 2012
SCAN 2012
55 / 60
JInterval Library: Principles, Development, and Perspectives
PERSPECTIVES
Novosibirsk, 26 Sep 2012
SCAN 2012
56 / 60
Future Directions
Holding P1788 compliance of JInterval
 Developing optional plugins for platform-dependent effective
implementations of inner layers through JNI

– MPFR for fast multiple precision floating-point arithmetic
– BLAS for fast linear algebra operations

Developing API for access to JInterval from other programming
languages
– Scala
– …

High-level functionality replenishment
Novosibirsk, 26 Sep 2012
SCAN 2012
57 / 60
High-Level Functionality Replenishment
Enhancing MatlabOps
 ILS tolerable solution set estimators
 ILS AE-solution set visualization (I. Sharaya)
 Global Optimization Solver (N. Panov – S. Shary)

–
–
–
–

Randomized Branch & Bound
Interval simulating annealing
Interval Genetic algorithm
Multi-method algorithm
ODE Solver (D. Nadezhin)
Novosibirsk, 26 Sep 2012
SCAN 2012
58 / 60
How to Get and Contribute to JInterval?
java.net/projects/jinterval
Source codes (SVN)
 JavaDoc
 Wiki
 Tutorial
 Developers’ forum
 Mail lists

Novosibirsk, 26 Sep 2012
SCAN 2012
59 / 60
Acknowledgements
Maksim V. Danilov
 Kirill S. Dronov
 Walter Krämer
 Nikita V. Panov
 Gregor Paw
 Anton E. Sartakov
 Andrey S. Samoilov
 Sergey P. Shary
 Irina A. Sharaya
 Egor N. Tepikin
 Leo N. Tolstoy
 IEEE Interval Standard Working Group – P1788

Novosibirsk, 26 Sep 2012
SCAN 2012
60 / 60
Related documents