Logo 
Search:

Artificial Intelligence Articles

Submit Article
Home » Articles » Artificial Intelligence » ProLogRSS Feeds

ProLog Program to run marriage burro

Posted By: Milind Mishra     Category: Artificial Intelligence     Views: 2823

Program for running a marriage burro. Enter details about all the candidates in the database. With each candidate store information about their age, qualification, preferences and physical attributes like height, weight, color etc. Given a set of preferences, help a candidate finding out matching partners from the database. Also provide an option of listing probable pairs from the database looking at preferences of both the partners.

Code for ProLog Program to run marriage burro in Artificial Intelligence

%trace
domains
    file = input
    personName,gender=string
    age=integer
    attributList=string*
database
    personData(personName,gender,age,attributList,attributList)
predicates
    repeat
    showMenu
    selection(integer)
    getCandidateDetail
    getAttribute(attributList)
    genderValidation(gender)
    ageValidation(age)
    searchCandidate(gender,age,personName,attributList)
    probalePairs
    readline
goal
    clearwindow,
    showMenu.
clauses
    repeat.
    repeat:-
        repeat.
            
    getCandidateDetail:-
        write("\nEnter candidate details...."),
        write("\nEnter name of person : "),
        readln(Name),
        write("\nEnter the gender of a person(male/female) : "),
        readln(Gender),
        genderValidation(Gender),
        write("\nEnter the age of a person : "),
        readint(Age),
        not(ageValidation(Age)),
        write("\nEnter the attributes..."),
        getAttribute(AttributList),
        write("\nEnter the preferences..."),
        getAttribute(PreferenceList),
        assert(personData(Name,Gender,Age,AttributList,PreferenceList)).
        
    getAttribute(Attr):-
        write("\nEnter the qualification : "),
        readln(Qual),
        write("\nEnter the hieght : "),
        readln(Height),
        write("\nEnter the weight : "),
        readln(Weight),
        write("\nEnter the color : "),
        readln(Color),
        Attr=[Qual,Height,Weight,Color].
        
    %validation
    
    genderValidation(Gender):-
        Gender=male;Gender=female.
    ageValidation(Age):-
        Age<18,
        write("\nEnter valid age...").
        
    %search for male candidate
    
    searchCandidate(Gender,Age,Name,PreferenceList):-
        Gender="female",
        personData(Name,"male",TAge,AttributList,_),
        TAge >= Age,
        AttributList=PreferenceList.        
    
    %search for female candidate
    
    searchCandidate(Gender,Age,Name,PreferenceList):-
        Gender="male",
        personData(Name,"female",TAge,AttributList,_),
        TAge <= Age,
        AttributList=PreferenceList.
    
    %find probale pairs
    
    probalePairs:-
        personData(Fname,"female",Fage,FattributList,FpreferenceList),
        personData(Mname,"male",Mage,MattributList,MpreferenceList),
        Fage <= Mage,
        FattributList=MpreferenceList,
        MattributList=FpreferenceList,
        write("\n",Mname,"-------->",Fname).
        
    %main menu
    
    showMenu:-
        repeat,
        write("\n*************Marriege burro**************"),
        write("\n1.Enter candidate detail into database"),
        write("\n2.Search for candidate"),
        write("\n3.Probeble pairs of matching parteners"),
        write("\n4.Show all candidate details"),
        write("\n0.Exit"),
        write("\n******************************************"),
        write("\nEnter your choice::"),
        readint(Choice),
        selection(Choice),
        Choice=0.
readline:-
    not(eof(input)),
    readln(LineL),
    write(LineL),nl,
    readline.
    
    selection(0).    
    selection(1):-
    %    getCandidateDetail,
        openread(input,"marriage.txt"),
        readdevice(input),
        readline.
        
    selection(2):-
        write("\nEnter the details of candidate..."),
        write("\nEnter gender : "),
        readln(Gender),
        gendervalidation(Gender),
        write("\nEnter age : "),
        readint(Age),
        not(ageValidation(Age)),
        write("\nEnter the detail of Patners..."),
        getAttribute(AttributList),
        write("\nMatching Partners are..."),
        searchCandidate(Gender,Age,Name,AttributList),
        write("\n",Name),
        fail.
    selection(3):-
        probalePairs,
        fail.
    selection(4):-
        personData(Name,Gender,Age,AttributList,PreferenceList),
        write("\n-------------------------------------------------------------------------"),
        write("\nName : ",Name),
        write("\nGender : ",Gender),
        write("\nAge : ",Age),
        write("\nAttribute[Qualification,Height,Weight,Color] : ",AttributList),
        write("\nPreferece[Qualification,Height,Weight,Color] : ",PreferenceList),
        write("\n--------------------------------------------------------------------------").
        
        
Output

    
+--------------------------------Marriage Burro--------------------------------+
¦                                                                              ¦
¦*************Marriege burro**************                                     ¦
¦1.Enter candidate detail into database                                        ¦
¦2.Search for candidate                                                        ¦
¦3.Probeble pairs of matching parteners                                        ¦
¦4.Show all candidate details                                                  ¦
¦0.Exit                                                                        ¦
¦******************************************                                    ¦
¦Enter your choice::1                                                          ¦
¦                                                                              ¦
¦Enter candidate details....                                                   ¦
¦Enter name of person : hiral                                                  ¦
¦                                                                              ¦
¦Enter the gender of a person(male/female) : female                            ¦
¦                                                                              ¦
¦Enter the age of a person : 22                                                ¦
¦                                                                              ¦
¦Enter the attributes...                                                       ¦
¦Enter the qualification : MCA                                                 ¦
¦                                                                              ¦
¦Enter the hieght : 5.4                                                        ¦
¦                                                                              ¦
¦Enter the weight : 56                                                         ¦
¦                                                                              ¦
¦Enter the color : whitish                                                     ¦
¦                                                                              ¦
¦Enter the preferences...                                                      ¦
¦Enter the qualification : MBA                                                 ¦
¦                                                                              ¦
¦Enter the hieght : 5.9                                                        ¦
¦                                                                              ¦
¦Enter the weight : 65                                                         ¦
¦                                                                              ¦
¦Enter the color : whitish                                                     ¦
¦                                                                              ¦

¦*************Marriege burro**************                                     ¦
¦1.Enter candidate detail into database                                        ¦
¦2.Search for candidate                                                        ¦
¦3.Probeble pairs of matching parteners                                        ¦
¦4.Show all candidate details                                                  ¦
¦0.Exit                                                                        ¦
¦******************************************                                    ¦
¦Enter your choice:: 4      
¦--------------------------------------------------------------------------    ¦
¦-------------------------------------------------------------------------     ¦
¦Name : hiral                                                                 ¦
¦Gender : female                                                                 ¦
¦Age : 22                                                                      ¦
¦Attribute[Qualification,Height,Weight,Color] : ["MCA","5.4","56","whitish"]   ¦
¦Preferece[Qualification,Height,Weight,Color] : ["MBA","5.9","65","whitish"]   ¦                    ¦--------------------------------------------------------------------------    ¦
¦-------------------------------------------------------------------------     ¦
¦Name : bright                                                                 ¦
¦Gender : male                                                                 ¦
¦Age : 25                                                                      ¦
¦Attribute[Qualification,Height,Weight,Color] : ["MBA","5.9","65","whitish"]   ¦
¦Preferece[Qualification,Height,Weight,Color] : ["MCA","5.4","56","whitish"]   ¦
¦--------------------------------------------------------------------------    ¦
¦-------------------------------------------------------------------------     ¦
¦Name : dipesh                                                                 ¦
¦Gender : male                                                                 ¦
¦Age : 24                                                                      ¦
¦Attribute[Qualification,Height,Weight,Color] : ["MBA","5.9","65","whitish"]   ¦
¦Preferece[Qualification,Height,Weight,Color] : ["MCA","5.4","56","whitish"]   ¦
¦--------------------------------------------------------------------------    ¦
¦-------------------------------------------------------------------------     ¦
¦Name : dipali                                                                 ¦
¦Gender : female                                                               ¦
¦Age : 22                                                                      ¦
¦Attribute[Qualification,Height,Weight,Color] : ["BE","5","50","white"]        ¦
¦Preferece[Qualification,Height,Weight,Color] : ["BE","5.7","70","white"]      ¦
¦--------------------------------------------------------------------------    ¦
¦-------------------------------------------------------------------------     ¦
¦Name : rajiv                                                                  ¦
¦Gender : male                                                                 ¦
¦Age : 23                                                                      ¦
¦Attribute[Qualification,Height,Weight,Color] : ["BE","5.7","70","white"]      ¦
¦Preferece[Qualification,Height,Weight,Color] : ["BE","5","50","white"]        ¦
¦--------------------------------------------------------------------------    ¦

¦*************Marriege burro**************                                     ¦
¦1.Enter candidate detail into database                                        ¦
¦2.Search for candidate                                                        ¦
¦3.Probeble pairs of matching parteners                                        ¦
¦4.Show all candidate details                                                  ¦
¦0.Exit                                                                        ¦
¦******************************************                                    ¦
¦Enter your choice::2   

¦Enter the details of candidate...  
                                           ¦
¦Enter gender : female                                                         ¦
¦                                                                              ¦
¦Enter age : 22  
¦                                                                              ¦
¦Enter the detail of Patners...                                                ¦
¦Enter the qualification : MBA                                                 ¦
¦                                                                              ¦
¦Enter the hieght : 5.9                                                        ¦
¦                                                                              ¦
¦Enter the weight : 65                                                         ¦
¦                                                                              ¦
¦Enter the color : whitish                                                     ¦
¦                                                                              ¦
¦Matching Partners are...   
                                                   ¦
¦bright                                                                        ¦
¦dipesh                                                                                           ¦
                                    ¦
                                                       ¦
¦*************Marriege burro**************                                     ¦
¦1.Enter candidate detail into database                                        ¦
¦2.Search for candidate                                                        ¦
¦3.Probeble pairs of matching parteners                                        ¦
¦4.Show all candidate details                                                  ¦
¦0.Exit                                                                        ¦
¦******************************************                                    ¦
¦Enter your choice::3                                                          ¦
¦                                                                              ¦
¦bright-------->hiral                                                          ¦
¦dipesh-------->hiral                                                          ¦
¦rajiv-------->dipali                                                          ¦
¦*************Marriege burro**************                                     ¦
¦1.Enter candidate detail into database                                        ¦
¦2.Search for candidate                                                        ¦
¦3.Probeble pairs of matching parteners                                        ¦
¦4.Show all candidate details                                                  ¦
¦0.Exit                                                                        ¦
¦******************************************                                    ¦
¦Enter your choice:: 0                          
  
Share: 


Didn't find what you were looking for? Find more on ProLog Program to run marriage burro Or get search suggestion and latest updates.

Milind Mishra
Milind Mishra author of ProLog Program to run marriage burro is from India.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
Strikerman Man from Russian Federation Comment on: Jun 30
i cant run this program. If someone can, please reply me!!
Thanks!

View All Comments