Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Интеллектуальные информационные системы (ИИС) / РГР ИИС Создание экспертной системы по подбору оптимального тарифного плана.docx
Скачиваний:
43
Добавлен:
04.01.2020
Размер:
999.49 Кб
Скачать

МИНИСТЕРСТВО ОБРАЗОВАНИЯ И НАУКИ РОССИЙСКОЙ ФЕДЕРАЦИИ

ФЕДЕРАЛЬНОЕ ГОСУДАРСТВЕННОЕ БЮДЖЕТНОЕ ОБРАЗОВАТЕЛЬНОЕ УЧРЕЖДЕНИЕ

ВЫСШЕГО ОБРАЗОВАНИЯ

«НОВОСИБИРСКИЙ ГОСУДАРСТВЕННЫЙ ТЕХНИЧЕСКИЙ УНИВЕРСИТЕТ»

Кафедра экономической информатики

Расчетно-графическая работа

по дисциплине «Интеллектуальные информационные системы»

на тему «Создание экспертной системы по подбору оптимального тарифного плана»

Факультет: бизнеса

Группа: ФБИ-22

Проверила: Авдеенко Т.В.

Новосибирск 2015

ОГЛАВЛЕНИЕ

ВВЕДЕНИЕ 3

1 Реализация экспертной системы 4

2 Тестирование системы 11

ЗАКЛЮЧЕНИЕ 14

СПИСОК ИСПОЛЬЗОВАННЫХ ИСТОЧНИКОВ 15

Введение

Задание расчетно-графической работы: разработать экспертную систему, чтобы она отвечала на вопросы темы РГР, выбранной студентом самостоятельно.

Назначение экспертной системы: подбор оптимального тарифного плана.

Описание экспертной системы: программа посредством диалога определяет наиболее подходящий тарифный план исходя из предпочтений пользователя, если такой тариф существует в заданном списке.

1 Реализация экспертной системы

% Идентификация тарифного плана

database

db_positive ( symbol, symbol )

db_negative ( symbol, symbol )

predicates

do_expert % выполнить экспертную работу

do_consulting % выполнить консультацию

nondeterm

tarif_is ( symbol ) % тариф есть

it_is ( symbol ) % это есть

positive ( symbol, symbol ) % позитивный факт

negative ( symbol, symbol ) % негативный факт

remember ( symbol, symbol, symbol ) % запомнить факт в ДБД

ask ( symbol, symbol ) % вопрос пользователю

clear_facts % очистка ДБД

goal

do_expert.

clauses

% Система пользовательского интерфейса

do_expert :-

nl, write ("* * * * * * * * * * * * * * * * * * * * * * * * * * * *" ),

nl, write ("Welcome to expert system " ),

nl, write ("determination of the plan" ),

nl, write ("Creator is student from FBI-22" ),

nl, write ("Teplova Anna" ),

nl, write ("* * * * * * * * * * * * * * * * * * * * * * * * * * * *" ),

nl, write ("Please, give answers about preferred"),

nl, write ( " tariff plans 'y' (yes), or 'n' (no). " ),

nl, nl, nl,

do_consulting,

write ( " press the button Esc..." ), nl,

readchar ( _ ),

exit.

do_consulting :-

tarif_is ( X ), !,

nl, nl,

write ( "Preferred tariff plans - ", X ),

nl, nl,

clear_facts.

do_consulting :-

nl, nl,

write ( "Sorry, I can’t help you!" ),

nl, nl,

clear_facts.

ask ( X, Y ) :-

write ( "Question: ", X, " ", Y, "? " ),

readln ( Reply ),

remember ( X, Y, Reply ).

% Механизм вывода

positive ( X, Y ) :-

db_positive ( X, Y ), !.

positive ( X, Y ) :-

not ( db_negative ( X, Y ) ), !,

ask ( X, Y ).

negative ( X, Y ) :-

db_negative ( X, Y ), !.

remember ( X, Y, y ) :-

asserta ( db_positive ( X, Y ) ).

remember ( X, Y, n ) :-

asserta ( db_negative ( X, Y ) ),

fail.

clear_facts :-

retract ( db_positive ( _, _ ) ), fail.

clear_facts :-

retract ( db_negative ( _, _ ) ), fail.

clear_facts.

% Продукционные правила

tarif_is ( "BLACK" ) :-

%it_is ( " operator is tele2" ),

positive ("Do you want to connect", "tele2’s plan" ),

positive ("Do you want to have", "monthly fee" ),

positive ("Do you want to call and use internet", "and don’t write SMS" ),

positive ("calls to tele2 are"," free" ),

positive ("calls to other operators are"," 1,10 rub."),

positive ("internet is"," 1 GB" ),

positive ("SMS is"," 0,5 rub" ),

positive ("MMS is"," 4 rub" ),

positive ("Monthly fee"," is 99 rub" ).

tarif_is ( "ORANGE" ) :-

%it_is (" operator is tele2" ),

positive ("Do you want to connect", "tele2’s plan" ),

negative ("Do you want to have", "monthly fee" ),

positive ("Do you want to call", "and write SMS and don’t use internet" ),

positive ("calls to tele2 are"," 0,6 rub." ),

positive ("calls to other operators are"," 0,6 rub."),

positive (" internet is "," 6,5 rub/MB" ),

positive ("SMS is"," 0,6 rub" ),

positive ("MMS is"," 4 rub" ),

positive ("Monthly fee"," is free" ).

tarif_is ("Super BLACK" ) :-

%it_is (" operator is tele2" ),

positive ("Do you want to connect", "tele2’s plan" ),

positive ( "Do you want to have", "monthly fee" ),

positive ("Do you want to call", "and write SMS and use internet" ),

positive ("calls to tele2 are"," 850 minutes" ),

positive ("calls to other operators are"," 850 minutes "),

positive (" internet is"," 6 GB" ),

positive ("SMS are"," 850 messages" ),

positive ("MMS is"," 4 rub" ),

positive ("Monthly fee"," is 399 rub" ).

tarif_is ( "YELLOW" ) :-

%it_is ( " operator is tele2" ),

positive ("Do you want to connect", "tele2’s plan" ),

negative ("Do you want to have", "monthly fee" ),

positive ("Do you want only call", "and don’t use SMS and internet" ),

positive ("calls to tele2 are"," 1 rub/first minute, and other minutes are free" ),

positive ("calls to other operators are"," 1,2 rub "),

positive (" internet is "," 6,5 rub/MB" ),

positive ("SMS are"," 1,2 rub" ),

positive ("MMS is"," 4 rub" ),

positive ("Monthly fee", "is free" ).

tarif_is ( "WHITE" ) :-

%it_is ( " operator is tele2" ),

positive ("Do you want to connect", "tele2’s plan" ),

positive ("Do you want to have", "monthly fee" ),

positive ("Do you want to call", "and write SMS and don’t use internet" ),

positive ("calls to tele2 are"," free" ),

positive ("calls to other operators are"," 0,5 rub "),

positive (" internet is "," 2,5 rub/MB" ),

positive ("SMS are"," 0,4 rub" ),

positive ("MMS is"," 2 rub" ),

positive ("Monthly fee"," is 50 rub" ).

tarif_is ("Really BLACK" ) :-

%it_is (" operator is tele2" ),

positive ("Do you want to connect", "tele2’s plan" ),

positive ("Do you want to have", "monthly fee" ),

positive ("Do you want to call", "and write SMS and use internet" ),

positive ("calls to tele2 are"," 500 minutes" ),

positive ("calls to other operators are"," 500 minutes "),

positive (" internet is "," 5 GB" ),

positive ("SMS are "," 350 messages" ),

positive ("MMS is "," 4 rub" ),

positive ("Monthly fee"," is 299 rub" ).

tarif_is ( "GREEN" ) :-

%it_is ( " operator is tele2" ),

positive ("Do you want to connect", "tele2’s plan" ),

negative ("Do you want to have", "monthly fee" ),

positive ("Do you want to call", "and write SMS and don’t use internet" ),

positive ("calls to tele2 are"," 0,5rub" ),

positive ("calls to other operators are "," 0,5 rub "),

positive (" internet is "," 5 rub/MB" ),

positive ("SMS are "," 0,05 rub" ),

positive ("MMS is "," 3 rub" ),

positive ("Monthly fee"," is free" ).

tarif_is ( "PINK" ) :-

%it_is ( " operator is tele2" ),

positive ("Do you want to connect", "tele2’s plan" ),

positive ("Do you want to have", "monthly fee" ),

positive ("Do you want to use", "only internet" ),

positive ("calls to tele2 are"," 1 rub" ),

positive ("calls to other operators are"," 1,10 rub."),

positive ("internet is"," 10 GB" ),

positive ("SMS is"," 1 rub" ),

positive ("Monthly fee"," is 99 rub" ).

tarif_is ( "PINK" ) :-

%it_is ( " operator is tele2" ),

positive ("Do you want to connect", "tele2’s plan" ),

negative ("Do you want to have", "monthly fee" ),

positive ("Do you want to use", "only internet" ),

positive ("calls to tele2 are"," 2 rub" ),

positive ("calls to other operators are"," 1,10 rub."),

positive ("internet is"," 0,8 rub/MB" ),

positive ("SMS is"," 1 rub" ).

tarif_is ( "BROWN" ) :-

%it_is ( " operator is tele2" ),

positive ("Do you want to connect", "tele2’s plan" ),

negative ("Do you want to have", "monthly fee" ),

negative ("Do you want to use", "only internet" ),

positive ("calls to tele2 are"," 0,6 rub" ),

positive ("calls to other operators are"," 0,8 rub."),

positive ("internet is"," 3 rub/MB" ),

positive ("SMS is"," 0,1 rub" ).

tarif_is ( "RAD" ) :-

%it_is ( " operator is tele2" ),

positive ("Do you want to connect", "tele2’s plan" ),

negative ("Do you want to have", "monthly fee" ),

positive ("Do you want to call", "and write SMS and use internet" ),

positive ("calls to tele2 are"," 0,5 rub" ),

positive ("calls to other operators are"," 0,5 rub."),

positive ("internet is"," 5 rub/MB" ),

positive ("SMS is"," 0,5 rub" ).

it_is ( " operator is tele2" ) :-

positive ( " Preferred operator", "is tele2" ), !.