Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
APACHES.Prolog_CSDVP
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
M3TAL
APACHES.Prolog_CSDVP
Commits
1230125a
Commit
1230125a
authored
Dec 19, 2019
by
Alexis Lebis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug with multiple course duee to bad allDiff predicat (here more stronger & opti)
parent
3ca1ad6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
prologCSDVP.pl
prologCSDVP.pl
+13
-5
No files found.
prologCSDVP.pl
View file @
1230125a
...
@@ -98,7 +98,7 @@ courses([
...
@@ -98,7 +98,7 @@ courses([
minECTS
(
8
).
minECTS
(
8
).
nbSemester
(
4
).
nbSemester
(
4
).
nbCourses
(
5
).
nbCourses
(
5
).
nbCourseBySemester
(
1
).
nbCourseBySemester
(
2
).
/*
=== GETTER AND UTILITY ===
*/
/*
=== GETTER AND UTILITY ===
*/
getIDCourse
([
I
|
_
],
I
).
getIDCourse
([
I
|
_
],
I
).
...
@@ -126,13 +126,21 @@ isDiffTwo(-1,_).%If empty course, it's always ok, whatever X
...
@@ -126,13 +126,21 @@ isDiffTwo(-1,_).%If empty course, it's always ok, whatever X
isDiffTwo
(
X
,
Y
):-
getIDCourse
(
X
,
XID
),
getIDCourse
(
Y
,
YID
),
XID
\
=
YID
.
isDiffTwo
(
X
,
Y
):-
getIDCourse
(
X
,
XID
),
getIDCourse
(
Y
,
YID
),
XID
\
=
YID
.
%EXCEPT EMPTY !!!!! @TODO COURSE
%EXCEPT EMPTY !!!!! @TODO COURSE
allDiff
([
_
]):-!.
% allDiff([_]):-!.
allDiff
([
X
,
Y
]):-
!,
isDiffTwo
(
X
,
Y
).
% allDiff([X,Y]):- !, isDiffTwo(X,Y).
allDiff
([
X
,
Y
|
Z
]):-
isDiffTwo
(
X
,
Y
),
allDiff
([
X
|
Z
]),
allDiff
([
Y
|
Z
]).
% allDiff([X,Y|Z]):- isDiffTwo(X,Y), allDiff([X|Z]), allDiff([Y|Z]).
buildIDCoursesList
([
X
],[
I
]):-
getIDCourse
(
X
,
I
),!.
buildIDCoursesList
([
X
|
Y
],[
I
|
L
]):-
buildIDCoursesList
(
Y
,
L
),
getIDCourse
(
X
,
I
).
allDiff
(
S
):-
buildIDCoursesList
(
S
,
L
),
subtract
(
L
,
[
-
1
],
C
),
allUniqueExceptEmpty
(
C
).
allUniqueExceptEmpty
([]).
allUniqueExceptEmpty
([
X
|
Y
]):-
\
+
member
(
X
,
Y
),
allUniqueExceptEmpty
(
Y
).
/*
=== TIME CONSTRAINTS
*/
/*
=== TIME CONSTRAINTS
*/
timeConstraintsSolver
(
Course
,
PositionInSol
):-
nbCourseBySemester
(
C
),
X
is
PositionInSol
/
C
,
nth0
(
3
,
Course
,
TimeFrame
),
member
(
X
,
TimeFrame
).
timeConstraintsSolver
(
Course
,
PositionInSol
):-
nbCourseBySemester
(
C
),
X
is
div
(
PositionInSol
,
C
)
,
nth0
(
3
,
Course
,
TimeFrame
),
member
(
X
,
TimeFrame
).
timeConstraintsCaller
(
Course
,
PositionInSol
):-
timeConstraintsSolver
(
Course
,
PositionInSol
).
timeConstraintsCaller
(
Course
,
PositionInSol
):-
timeConstraintsSolver
(
Course
,
PositionInSol
).
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment