pricing.krb |
|
---|---|
Weekly packageWe use the 'weekly' package when a weekly price exists and duration is greater than a week. |
|
Daily packageWe use the 'daily' package when a daily price exists an duration is lower than a week, and greater than a day. |
|
Daily package for weekWe use the 'daily' package when a daily price exists and duration is greater than a week, only if no weekly price exists. |
|
knowledge.py |
|
---|---|
|
|
Importing Pyke knowledge engine |
|
Finding out which package apply for the duration |
|
Given existings packages and duration, prints which package applies or if no package applies. |
|
We are loading Pyke rules base we have defined in pricing.krb |
|
Creating the facts base from the package list. |
|
Now, we have our rules and our facts, let's just prove that a package applies. |
|
We cannot prove that any package applies therefore no package applies. |
|
Resetting the engine is needed to be able to apply a new fact base. |
|
Let's try with a few examples |
|
Defining a bunch of durations |
|
This should print 'daily' |
|
This should print 'weekly' |
|
This should print 'daily' |
|
This should print 'weekly' |
|
This should print 'daily' |
|
This should print 'No package applies' |
|