Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Soft Computing Laboratory Manual for Final Year Students, Schemes and Mind Maps of Software Engineering

A laboratory manual for final year computer science and engineering students studying soft computing at tpct's college of engineering, osmanabad. The manual includes matlab programs for implementing andnot, xor, and and functions using mcculloch-pitts neural net and perceptron. It also covers pattern storage using discrete hopfield network.

Typology: Schemes and Mind Maps

2023/2024

Uploaded on 04/24/2024

krangler
krangler 🇮🇳

1 / 36

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
TPCT’s
College of Engineering, Osmanabad
Department of Computer Science and Engineering
Laboratory Manual
Soft Computing
For
Final Year Students
Manual Prepared by
Mr.R.A.Sarwade
Author COE, Osmanabad
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24

Partial preview of the text

Download Soft Computing Laboratory Manual for Final Year Students and more Schemes and Mind Maps Software Engineering in PDF only on Docsity!

TPCT’s

College of Engineering, Osmanabad

Department of Computer Science and Engineering

Laboratory Manual

Soft Computing

For

Final Year Students

Manual Prepared by

Mr.R.A.Sarwade

Author COE, Osmanabad

TPCT’s

College of Engineering

Solapur Road, Osmanabad

Department of Computer Science and Engineering

1) Vision of the Department:

To achieve and evolve as a center of academic excellence and research center in the field of Computer Science and Engineering. To develop computer engineers with necessary analytical ability and human values who can creatively design, implement a wide spectrum of computer systems for welfare of the society.

2) Mission of the Department:

The department strives to continuously engage in providing the students with in-depth understanding of fundamentals and practical training related to professional skills and their applications through effective Teaching- Learning Process and state of the art laboratories pertaining to CSE and inter disciplinary areas. Preparing students in developing research, design, entrepreneurial skills and employability capabilities.

FOREWORD

It is my great pleasure to present this laboratory manual for Final year Engineering students for the subject – “ Soft Computing”.

As a student, many of you may be wondering with some of the questions in your mind regarding the subject and exactly what has been tried is to answer through this manual

Faculty members are also advised that covering these aspects in initial stage itself will greatly relieve them in future as much of the load will be taken care by the enthusiasm energies of the students once they are conceptually clear

H.O.D.

CSE Dept.

LABORATORY MANUAL CONTENTS

This manual is intended for the final year students of Computer Science and Engineering in the subject of Soft Computing. This manual typically contains practical/Lab Sessions related to the subject on the MATLAB/Scilab platform covering various aspects of the subject to enhance understanding.

Students' are advised to thoroughly go through this manual rather than only topics mentioned in the syllabus as practical aspects are the key to understanding and conceptual visualization of theoretical aspects covered in the books.

Mr. R.A.Sarwade.

1.Do’s and Don’ts in the laboratory

1. Make entry in the Log Book as soon as you enter the Laboratory.

2. All the students should sit according to their roll numbers starting from their left

to right.

3. All the students are supposed to enter the terminal number in the log book.

4. Do not change the terminal on which you are working.

5. All the students are expected to get at least the algorithm of the program/concept

to be implemented.

6. Strictly observe the instructions given by the teacher/Lab Instructor

Instruction for Laboratory Teachers::

1. Submission related to whatever lab work has been completed should be done

during the next lab session. The immediate arrangements for printouts related to

submission on the day of practical assignments.

2. Students should be taught for taking the printouts under the observation of lab

teacher

Pre-lab (Introduction to MATLAB)

Questions:

1] What do you mean by MATLAB? 2] Describe all MATLAB windows in detail.(command window, Graphics window , Editor window, Workspace, command history, current directory) 3] Describe all basic MATLAB command with example

else

disp('Net is not learning Enter another set of weights and threshold value');

w1=input('Weight w1=');

w2=input('Weight w2=');

theta=input('theta=');

end

end

disp('McCulloch Pitts Net for ANDNOT function');

disp('Weights of neuron');

disp(w1);

disp(w2);

disp('Threshold value=');

disp(theta);

Output :-

Enter the weights

Weight w1=

Weight w2=

Enter threshold value

theta=

Output of net= 1 0 0 0

McCulloch Pitts Net for AND function

Weights of neuron

Threshold value=

EXPERIMENT NO. 2

Title: Generate ANDNOT function using McCulloch-Pitts neural net by MATLAB Program.

Objectives:

  • To implement ANDNOT logic gate

Instructions: 1.Study MP Model 2.Study logic gates: AND,OR,NOT,Exclusive-OR 3.Write a program to implement ANDNOT gate without using neural network toolbox.

Program to implement ANDNOT gate:

%ANDNOT function using McCulloch-Pitts neuron clear; clc; % Getting weights and threshold value disp('Enter the weights'); w1=input('Weight w1='); w2=input('Weight w2='); disp('Enter threshold value'); theta=input('theta='); y=[0 0 0 0]; x1=[0 0 1 1]; x2=[0 1 0 1]; z=[0 0 1 0]; con=1; while con zin = x1w1+x2w2; for i=1: if zin(i)>=theta y(i)=1; else y(i)=0; end end disp('Output of net='); disp(y); if y==z con=0; else

EXPERIMENT NO. 3

Title: Generate XOR function using McCulloch-Pitts neural net by MATLAB program.

Objectives:

  • To implement XOR logic gate

Instructions: 1.Study MP Model 2.Study logic gates: AND,OR,NOT,Exclusive-OR 3.Write a program to implement XOR gate without using neural network toolbox.

Program to implement XOR gate:

% XOR function using McCulloch-Pitts neuron clear; clc; % Getting weights and threshold value disp('Enter the weights'); w11=input('Weight w11='); w12=input('Weight w12='); w21=input('Weight w21='); w22=input('Weight w22='); v1=input('Weight v1='); v2=input('Weight v2='); disp('Enter threshold value'); theta=input('theta='); x1=[0 0 1 1]; x2=[0 1 0 1]; z=[0 1 1 0]; con=1; while con zin1 = x1w11+x2w21; zin2 = x1w21+x2w22; for i=1: if zin1(i)>=theta y1(i)=1; else y1(i)=0; end if zin2(i)>=theta y2(i)=1; else y2(i)=0; end end

yin=y1v1+y2v2; for i=1: if yin(i)>=theta; y(i)=1; else y(i)=0; end end disp('Output of net='); disp(y); if y==z con=0; else disp('Net is not learning Enter another set of weights and threshold value'); w11=input('Weight w11='); w12=input('Weight w12='); w21=input('Weight w21='); w22=input('Weight w22='); v1=input('Weight v1='); v2=input('Weight v2='); theta=input('theta='); end end disp('McCulloch Pitts Net for XOR function'); disp('Weights of neuron Z1'); disp(w11); disp(w21); disp('Weights of neuron Z2'); disp(w12); disp(w22); disp('Weights of neuron Y'); disp(v1); disp(v2); disp('Threshold value='); disp(theta);

EXPERIMENT NO. 4

Title: Write a program for solving linearly separable problem using Perceptron Model.

Objectives:To implement AND function using Perceptron

Instructions:

  1. Study Perceptron Model
  2. Write a program to implement AND function
  3. Draw the diagram of AND using Perceptron used below

Program to implement AND function:

%Perceptron for AND funtion

clear;

clc;

x=[1 1 -1 -1;1 -1 1 -1];

t=[1 -1 -1 -1];

w=[0 0];

b=0;

alpha=input('Enter Learning rate=');

theta=input('Enter Threshold value=');

con=1;

epoch=0;

while con

con=0;

for i=1:

yin=b+x(1,i)w(1)+x(2,i)w(2);

if yin>theta

y=1;

end

if yin <=theta & yin>=-theta

y=0;

end

if yin<-theta

y=-1;

end

if y-t(i)

con=1;

for j=1:

w(j)=w(j)+alphat(i)x(j,i);

end

b=b+alpha*t(i);

end

end

epoch=epoch+1;

end

disp('Perceptron for AND function');

disp(' Final Weight matrix');

disp(w);

disp('Final Bias');

disp(b);

Output

Enter Learning rate=

Enter Threshold value=0.

Perceptron for AND function

Final Weight matrix

Final Bias

end epoch=epoch+1; end

disp('Perceptron for AND Function'); disp('Final Weight Matrix'); disp(w); disp('Final Bias'); disp(b);

Output :-

Enter Learning rate= Enter Threshold Value=0. Perceptron for AND Function Final Weight Matrix 1 1 Final Bias

EXPERIMENT NO. 6

Title: Write a program to store a pattern (1 1 1 0). Test the network using Discrete Hopfield Net by giving the input with mistakes in First and Second position.

Objectives:  To understand the concept of Pattern storage  To implement Discrete Hopfield Net

Training Algorithm:  Describe about Pattern Storage networks  Write theory for Hopfield Net.

MATLAB Source Code:

%Discrete hopfield net clc; clear; x=[1 1 1 0]; tx=[0 0 1 0]; w=(2x'-1)(2x-1); for i=1: w(i,i)=0; end con=1; y=[0 0 1 0]; while con up=[4 2 1 3]; for i=1: yin(up(i))=tx(up(i))+yw(1:4,up(i)); if yin(up(i))> y(up(i))=1; end end if y==x disp('convergence has been obtained'); disp('the converged output'); disp(y); con=0; end end

Output:

%convergence has been obtained %the converged output % 1 1 1