Artificial Intelligent: Intelligent Bot With Microsoft Bot Framework & Azure
JAVA in Artificial intelligent
-
Upload
virat-andodariya -
Category
Engineering
-
view
30 -
download
8
Transcript of JAVA in Artificial intelligent
![Page 1: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/1.jpg)
1
AI Programming with JAVA
By:Virat Andodariya M.S.University
![Page 2: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/2.jpg)
2
How Artificial Intelligence Programmed?
Java Basics
Graph coloring Problem
Uniform Cost Search
Contents
![Page 3: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/3.jpg)
3
How Artificial Intelligence Programmed?
C++
C#
Java
Lisp
Python
![Page 4: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/4.jpg)
4
• The Java Virtual Machine• Applications & Applets• Classes & Objects• Start up Java• Variables & Assignments• Strings & Characters• Arithmetic Operators & Expressions• Comments• Keywords• Creating and Compiling Programs• Modifiers
![Page 5: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/5.jpg)
5
Bytecodes and the Java Virtual Machine
![Page 6: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/6.jpg)
6
Java Program
• Java Application Program– Application• Program written in general programming language
– Applet• Program running in Web Browser Environment• Can be viewed by appletviewer or Web browser with
JVM
![Page 7: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/7.jpg)
7
Classes and Objects
• Object– Memory Space to Define State and Operation– Instance of Class
• Class– A class is a template or blueprint for objects. To program in
Java, you must understand classes and be able to write and use them.
– Template of Creating Object
![Page 8: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/8.jpg)
8
The Java Class Libraries
• java.applet : Applet related• java.awt : Abstract Window Toolkit• java.awt.event : Event process from awt component• java.awt.image : Image processing• java.beans : JavaBeans Component• java.io : File or Network I/O Support• java.lang : Java Language Support• java.net : Network related functions• java.util : Utility function
![Page 9: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/9.jpg)
9
Start a Java Application
![Page 10: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/10.jpg)
10
Variables and Assignments
• Types– char 16bits Unicode character data– boolean Boolean Variable– byte 8 bits signed integer– short 16 bits signed integer– int 32 bits signed integer– long 64 bits signed integer– float 32 bits signed floating point number– double 64 bits signed floating point number
![Page 11: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/11.jpg)
11
Variables and Assignments
• String : sequence of characterString s = “Enter an integer value: ” ;
• Concatenation Operator ‘+’String s = “Lincoln said: ” + “\” Four score and seven years
ago\”” ;Result : Lincoln said: “Four score and seven years ago”
![Page 12: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/12.jpg)
12
Comments
• Single Line Comment– int i = 10 ; // i is counter
• Multiple Line Comment/* Some comments*/
• Documentation Comment/** Documentation Comment*/
![Page 13: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/13.jpg)
13
Java Keywords
• 50 Java Keywordsabstract double int superboolean else interface s witchbreak extends long synchronizedbyte final native thiscase finally new throwcatch float package throwschar for private transient*class goto* protected tryconst* if public voidcontinue implements return volatiledefault import short whiledo instanceof static strictfp
assert (New in 1.5) enum (New in 1.5)
![Page 14: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/14.jpg)
14
Control Statement
• A statement represents an action or a sequence of actions. To change the execution order of program • As the method of controlling the execution order – Conditional Statement : if St., switch St.– Repeat Statement : for St., while St., do-while St.– Branch Statement : break St., continue St., return St.
![Page 15: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/15.jpg)
15
For Statement
Repeat the sequence of statement as many as defined. Form of for statement
for ( <expr. 1> ; < expr. 2> ; < expr. 3>) <statement>
<expr. 1> : initialize the control variable <expr. 2> : check the control variable <expr. 3> : modify the control variable
s = 0; for (i=1; i<=N; ++i) // sum from 1 to N : i increment s += i;
![Page 16: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/16.jpg)
16
Break Statement
• To move control to the out of the block• From of break statement
break [label] ;
![Page 17: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/17.jpg)
17
Creating and Compiling Programs
Source Code
Create/Modify Source Code
Compile Source Code i.e. javac Welcome.java
Bytecode
Run Byteode i.e. java Welcome
Result
If compilation errors
If runtime errors or incorrect result
![Page 18: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/18.jpg)
18
Modifiers
Java uses certain reserved words called modifiers that specify the properties of the data, methods, and classes and how they can be used.
Examples of modifiers are public and static. Other modifiers are private, final, abstract, and protected. A public datum, method, or class can be accessed by other programs. A private datum or method cannot be accessed by other programs.
![Page 19: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/19.jpg)
19
Graph coloring Problem
Graph In Matrix
![Page 20: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/20.jpg)
20
Graph Coloring
![Page 21: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/21.jpg)
21
![Page 22: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/22.jpg)
22
![Page 23: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/23.jpg)
23
![Page 24: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/24.jpg)
24
![Page 25: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/25.jpg)
25
Result
![Page 26: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/26.jpg)
26
UniformCostSearch
![Page 27: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/27.jpg)
27
![Page 28: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/28.jpg)
28
![Page 29: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/29.jpg)
29
![Page 30: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/30.jpg)
30
![Page 31: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/31.jpg)
31
![Page 32: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/32.jpg)
32
![Page 33: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/33.jpg)
33
![Page 34: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/34.jpg)
34
![Page 35: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/35.jpg)
35
![Page 36: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/36.jpg)
36
![Page 37: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/37.jpg)
37
![Page 38: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/38.jpg)
38
![Page 39: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/39.jpg)
39
References
• Java™ 2:The Complete Reference,Fifth Edition Herbert Schildt• JDK Developer Kit• JGRASP (CSD) Compiler
![Page 40: JAVA in Artificial intelligent](https://reader033.fdocuments.in/reader033/viewer/2022052700/55cdbc88bb61eb005e8b4598/html5/thumbnails/40.jpg)
40
Thank you