Нечеткое ранжирование. Реализация методов отношения предпочтений., страница 2

slist_rlist(SLIST,RLIST)

nondeterm cj(REAL,REAL,REAL,REAL,REAL)

nondeterm dj(REAL,REAL,REAL,REAL,REAL)

nondeterm f(REAL,REAL,REAL)

nondeterm c(RLIST,RLIST,RLIST,REAL,REAL,REAL,REAL)

nondeterm d(RLIST,RLIST,REAL,REAL,REAL,REAL,REAL)

nondeterm compare(REAL,REAL,STRING)

constants

%BEGIN Task Window, CreateParms, 09:34:32-18.12.2006, Code automatically updated!

task_win_Flags = [wsf_SizeBorder,wsf_TitleBar,wsf_Close,wsf_Maximize,wsf_Minimize,wsf_ClipSiblings]

task_win_Menu  = res_menu(idr_task_menu)

task_win_Title = "TVP_5"

task_win_Help  = idh_contents

%END Task Window, CreateParms

clauses

slist_rlist([],[]).

            slist_rlist([X|L1],[Y|L2]):-

                                   str_real(X,Y),

                                   slist_rlist(L1,L2).

cj(Rlj,Rkj,Ti,_,C):-

                        Temp=Rkj+Ti,

                        Temp>=Rlj,

                        C=1.

cj(Rlj,Rkj,Ti,Tp,C):-

                        Temp=Rkj+Tp,

                        Temp>=Rlj,

                        C=(Rlj-(Rkj+Tp))/(Ti-Tp).

            cj(_,_,_,_,C):-

                        C=0.

            dj(Rlj,Rkj,Tp,_,D):-

                        Temp=Rkj+Tp,

                        Temp>=Rlj,

                        D=1.

            dj(Rlj,Rkj,Tp,Tv,D):-

                        Temp=Rkj+Tv,

                        Temp>=Rlj,

                        D=(Rlj-(Rkj+Tp))/(Tp-Tv).

            dj(_,_,_,_,D):-

                        D=0.

            f(Dj,C,F):-

                        Dj<C,

                        F=1.

            f(Dj,C,F):-

                        C<>1,

                        F=(1-Dj)/(1-C).

            f(_,_,F):-

                        F=-100,

                        dlg_note("Ошибка предиката f").

            c([],[],[],_,_,Sum,Sum).

            c([Rlj|LRlj],[Rkj|LRkj],[W|LW],Ti,Tp,Sum,S):-

                        cj(Rlj,Rkj,Ti,Tp,Cj),

                        Temp=Cj*W,

                        Sum1=Sum+Temp,

                        c(LRlj,LRkj,LW,Ti,Tp,Sum1,S).

            d([],[],_,_,_,Sum,Sum).

            d([Rlj|LRlj],[Rkj|LRkj],Tp,Tv,C,Sum,S):-

                        dj(Rlj,Rkj,Tp,Tv,Dj),

                        f(Dj,C,F),

                        F<>-100,

                        Sum1=Sum+F,

                        d(LRlj,LRkj,Tp,Tv,C,Sum1,S).

            d(_,_,_,_,_,_,D):-

                        D=-200,

                        dlg_note("Ошибка предиката d").

compare(Sd1,Sd2,Ans):-

                        Sd1>Sd2,

                        Ans="Первая альтернатива предпочтительнее второй".

compare(Sd1,Sd2,Ans):-

                        Sd1<Sd2,

                        Ans="Вторая альтернатива предпочтительнее первой".    

            compare(_,_,Ans):-

                        Ans="Обе альтернативы равнозначны".        

%BEGIN Task Window, e_Create

task_win_eh(_Win,e_Create(_),0):-!,

%BEGIN Task Window, InitControls, 09:34:32-18.12.2006, Code automatically updated!

win_CreateControl(wc_LBox,rct(7,49,70,161),"",_Win,[wsf_Group,wsf_TabStop,wsf_VScroll,wsf_NoIntegralHeight],vesa),

win_CreateControl(wc_Edit,rct(7,161,70,182),"",_Win,[wsf_Group,wsf_TabStop,wsf_AutoHScroll,wsf_AlignLeft],ins_ves),

win_CreateControl(wc_PushButton,rct(7,189,70,210),"Добавить",_Win,[wsf_Group,wsf_TabStop],insert_ves),

win_CreateControl(wc_Edit,rct(91,161,154,182),"",_Win,[wsf_Group,wsf_TabStop,wsf_AutoHScroll,wsf_AlignLeft],ins_alter_1),