I am trying to make a schedule out of facts, facts are in form of course_meetings(subject,type,group,description),
I decided to use the brute-force approach
I will generate all possible schedules and see which one will pass all the constraints, however the the facts I have generate 2.6, how can I optimize that, and is there a better approach. for ex. course_meetings(subject,type,group,instructor,description). solve:-
findall([A,B,C,D,E],course_meetings(A,B,C,D,E),L),
permutation(L,L1),
%and apply constrains on it.
i have 32 facts of this format and for permutation its 32!~= 2.6*10^32
Constraints over finite domains have been designed in Prolog to fit exactly this need. No need to use assert/rectract for that. See e.g. library(clpfd). To get you acquainted, you might look at this example, a "Simplistic School Time-Tabler" and the CLP Primer