Download JSR-331 User Manual

Transcript
JSR-331: Constraint Programming API
Table of Contents
Introduction .................................................................................................................................... 4
Document Conventions .................................................................................................................. 4
Installation ..................................................................................................................................... 4
Using a Standalone Version ...................................................................................................... 5
Working under Eclipse IDE ....................................................................................................... 6
Current JSR-331 Implementations ........................................................................................... 6
Implementation Structure ......................................................................................................... 8
Application Deployment Model.................................................................................................. 9
Constraint Satisfaction Problem (CSP) ...................................................................................... 10
Formal Definition ..................................................................................................................... 10
Major JSR-331 Concepts .......................................................................................................... 10
Introductory Example .............................................................................................................. 11
Problem Definition Concepts ....................................................................................................... 13
Interface “Problem” .................................................................................................................. 13
Creating Variables ................................................................................................................ 13
Creating and Posting Constraints ....................................................................................... 14
Common Methods ................................................................................................................. 15
Common Interface “ConstrainedVariable” ............................................................................. 16
Constrained Integer Variables “Var” ...................................................................................... 17
Creating Integer Variables................................................................................................... 17
Manipulating Integer Variables .......................................................................................... 20
Arithmetic Operations with Integer Variables ................................................................... 20
Constrained Boolean Variables ............................................................................................ 22
Constrained Real Variables ................................................................................................. 22
Constrained Set Variables ................................................................................................... 22
Defining Constraints ................................................................................................................ 22
2