How to enter all results of this rule as facts in the program or how can I process these results as facts?

StackOverflow https://stackoverflow.com/questions/10192239

  •  01-06-2021
  •  | 
  •  

سؤال

%Examples
%course_meetings(maths4,tutorial,t07,khaled_mohamed,'tutorial for t07')
%days([sat,sun...])
%tutorialrooms([c6301,b4108,c2201,c2301,c2202,c2203])
%slots([1,2,3,4,5])



day_tut(Day,Slot,Place,Course,Group,Instr,Descr):-
    days(X),member(Day,X),
    tutorialrooms(X1),member(Place,X1),
    course_meetings(Course,tutorial,Group,Instr,Descr),
    slots(X2),member(Slot,X2).

I thought of using Assert but I am new to prolog not sure how it works the idea is that eventually I would like to create a schedule for all groups according to certain rules example each group should have a day off and lectures should preceed tutorials ...

هل كانت مفيدة؟

المحلول

My suggestions are coming from SWI-Prolog.

You can insert data to a dynamic database using assert/1; you can put the tuple on the Linda table with out/1 or use even more advanced features such as db_assert.

The question is, however, not HOW to record this data but rather WHY do you want to do it. Depending on how do you intend to address the scheduling problem you might need this recording strategy or that, or may be even none.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top