generated from potassco/python-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adjusted fclingo encodings and tests
- Loading branch information
Showing
12 changed files
with
83 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
% Always include root instance | ||
include("root"). | ||
|
||
% Attribute variables are always included when its parents are included | ||
include(X) :- type(X,T), parent(X,P), include(P), attribute(T,_). | ||
|
||
range(X,Min,Max) :- type(X,T), attribute(T,"numeric"), Min = #min{ V : domain(T,V) }, | ||
Max = #max{ V : domain(T,V) }. | ||
|
||
% Generate exactly one value for each attribute if it is included | ||
{ value(X,V) : domain(T,V) } = 1 :- include(X), type(X,T), attribute(T,"discrete"). | ||
&in{Min..Max} =: X :- include(X), type(X,T), attribute(T,"numeric"), range(X,Min,Max). | ||
|
||
|
||
|
||
% Show statements | ||
#show . | ||
#show value(X,V) : value(X,V), type(X,T), attribute(T,_). | ||
|
||
&show { X : type(X,T), attribute(T,"numeric") }. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#include "boolean.lp". | ||
|
||
% Auxiliary val/2 atoms for constants and numbers. | ||
val(Path,Path) :- constant(Path). | ||
&in{N..N} =: Path :- number(Path,N). | ||
% Auxiliary values for constants and numbers. | ||
value(Path,Path) :- constant(Path). | ||
&in{N..N} =: Path :- number(Path,N). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#include "boolean.lp". | ||
|
||
% Auxiliary value/2 atoms for constants and numbers. | ||
% Auxiliary values for constants and numbers. | ||
value(P,P) :- constant(P). | ||
value(P,N) :- number(P,N). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
#include "constraints.lp". | ||
|
||
% Satisfaction of binary relations for numeric values in fclingo | ||
def(F) :- binary(F,X1,_,X2), &df{X1}, &df{X2}. | ||
defined(F) :- binary(F,X1,_,X2), &df{X1}, &df{X2}. | ||
|
||
sat(F) :- binary(F,X1,"=", X2), &sum{X1} = X2. | ||
sat(F) :- binary(F,X1,"!=",X2), &sum{X1} != X2. | ||
sat(F) :- binary(F,X1,">", X2), &sum{X1} > X2. | ||
sat(F) :- binary(F,X1,">=",X2), &sum{X1} >= X2. | ||
sat(F) :- binary(F,X1,"<", X2), &sum{X1} < X2. | ||
sat(F) :- binary(F,X1,"<=",X2), &sum{X1} <= X2. | ||
satisfied(F) :- binary(F,X1,"=", X2), &sum{X1} = X2. | ||
satisfied(F) :- binary(F,X1,"!=",X2), &sum{X1} != X2. | ||
satisfied(F) :- binary(F,X1,">", X2), &sum{X1} > X2. | ||
satisfied(F) :- binary(F,X1,">=",X2), &sum{X1} >= X2. | ||
satisfied(F) :- binary(F,X1,"<", X2), &sum{X1} < X2. | ||
satisfied(F) :- binary(F,X1,"<=",X2), &sum{X1} <= X2. | ||
|
||
|
||
% Satisfaction of combinations tables for numeric values in fclingo | ||
hit_cell(C,ID,(Col,Row)) :- allow(I,(Col,Row),V), combinations(C,ID,Col,X), &sum{X} = V, C=(I,_). | ||
hit_cell(C,ID,(Col,Row)) :- allow(I,(Col,Row),V), column(C,ID,Col,X), &sum{X} = V, C=(I,_). | ||
|
||
def(C,ID,Col) :- combinations(C,ID,Col,X), &df{X}. | ||
defined(C,ID,Col) :- column(C,ID,Col,X), &df{X}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#include "base/defined.lp". | ||
#include "base/auxiliary-fclingo.lp". | ||
#include "base/enumeration.lp". | ||
#include "base/attribute-fclingo.lp". | ||
#include "base/attributes-fclingo.lp". | ||
#include "base/constraints-fclingo.lp". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters