Skip to content

Commit

Permalink
reformat code base
Browse files Browse the repository at this point in the history
  • Loading branch information
rkaminsk committed Dec 11, 2024
1 parent e618403 commit 4a12774
Show file tree
Hide file tree
Showing 365 changed files with 35,764 additions and 35,574 deletions.
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -421,4 +421,3 @@ CheckOptions:
- key: llvm-else-after-return.WarnOnUnfixable
value: 'false'
...

2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@

## gringo/clingo 4.2

* added clingo
* added clingo
* supports very flexible scripting support
* can cover iclingo and oclingo functionality now
* added stack traces to lua error messages
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -324,4 +324,3 @@ if (NOT CLINGO_BUILD_STATIC AND (CLINGO_BUILD_SHARED OR Python_Development_FOUND
set_target_properties(${target} PROPERTIES POSITION_INDEPENDENT_CODE ON)
endforeach()
endif()

15 changes: 7 additions & 8 deletions app/clingo/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,29 @@
// }}}

#ifdef CLINGO_WITH_PYTHON
# include <pyclingo.h>
#include <pyclingo.h>
#endif
#ifdef CLINGO_WITH_LUA
# include <luaclingo.h>
#include <luaclingo.h>
#endif

#include <clingo.h>
#include <iostream>

extern "C" CLINGO_VISIBILITY_DEFAULT int clingo_main_(int argc, char *argv[]);

int main(int argc, char** argv) {
# ifdef CLINGO_WITH_PYTHON
int main(int argc, char **argv) {
#ifdef CLINGO_WITH_PYTHON
if (!clingo_register_python_()) {
std::cerr << clingo_error_message() << std::endl;
return 1;
}
# endif
# ifdef CLINGO_WITH_LUA
#endif
#ifdef CLINGO_WITH_LUA
if (!clingo_register_lua_(nullptr)) {
std::cerr << clingo_error_message() << std::endl;
return 1;
}
# endif
#endif
return clingo_main_(argc, argv);
}

6 changes: 3 additions & 3 deletions app/clingo/tests/lp/aggregates.lp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ asstwo(S,u):-arg(S),ass(S,u),saturate.
sattwo(S):-arg(S),ass(S,u),saturate.
:-not saturate.
#show ass/2.

:-ass(s1, 0),ass(s2, 0),ass(s3, 0).
:-ass(s1, 1),ass(s2, 0),ass(s3, 1).
%unfounded: saturate, asstwo(s1,0), asstwo(s1,0)

%unfounded: saturate, asstwo(s1,0), asstwo(s1,0)
3 changes: 0 additions & 3 deletions app/clingo/tests/lp/elevator.lp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,3 @@ x(A,D,t) :- h(a(A,F),t-1), o(A,G+D,D), p(A,D), i(a(A,G)), D*F < D*G,

#show.
#show h/2.



2 changes: 0 additions & 2 deletions app/clingo/tests/lp/project.lp
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@

1 { p(1..2) } 1.
1 { q(1..2) } 1.


1 change: 0 additions & 1 deletion app/clingo/tests/lp/show.lp
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ q(k+1), k < 3.

{show} :- k == 3.
#show p(1..4) : show, k == 3.

1 change: 0 additions & 1 deletion app/clingo/tests/lua/add_minimize.lp
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@ end

2 { a; b; c }.
2 { b; c; d }.

1 change: 0 additions & 1 deletion app/clingo/tests/lua/add_weight.lp
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ end
#end.

{ a; b; c }.

23 changes: 11 additions & 12 deletions app/clingo/tests/lua/conformant1.lp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#script (lua)
#script (lua)
function main(prg)
local step = 0
local check = false
Expand Down Expand Up @@ -29,7 +29,7 @@ function main(prg)
if ret.satisfiable then
break
end
else
else
break
end
end
Expand Down Expand Up @@ -60,7 +60,7 @@ contradict(F) :- complement(F,L,M), effect(A,L,N1), effect(A,M,N2),
{ holds(F,0) } :- complement(F,L,M), not initially(L), not initially(M).
holds(F,0) :- initially(L), complement(F,L,M).

holds_oneof(N,B) :-
holds_oneof(N,B) :-
initially_oneof(N,_,B);
not holds(F,0) : initially_oneof(N,M,B), complement(F,L,M);
holds(F,0) : initially_oneof(N,L,B), complement(F,L,M).
Expand All @@ -80,7 +80,7 @@ holds(L,t) :- occurs(A,t), effect(A,L,N), holds(C,t-1) : condition(A,C,N).
holds(L,t) :- holds(L,t-1), complement(L,M), not holds(M,t).
:- contradict(F), complement(F,L,M), holds((L),t), holds((M),t).

caused(L,t) :- occurs(A,t), effect(A,L,N),
caused(L,t) :- occurs(A,t), effect(A,L,N),
not holds(F',t-1) : condition(A,M',N), complement(F',L',M');
holds(F',t-1) : condition(A,L',N), complement(F',L',M').
holds(F,t) :- caused(L,t), complement(F,L,M).
Expand Down Expand Up @@ -126,9 +126,9 @@ pos_executable(T,t) :- occurs(A,T), alt_holds(C,T-1,t) : executable(A,C), C !=
pos_goal_or(N,t) :- goal_or(N,L,B), alt_holds(L,t,t), vol(t).
pos_goal_or(N,t) :- goal_or(N,L,B), goal(L), vol(t).

bottom(t) :- pos_goal_or(N,t) : goal_or(N,_,_);
bottom(t) :- pos_goal_or(N,t) : goal_or(N,_,_);
alt_holds(L,t,t) : goal(L);
pos_executable(R,t) : R = 1..t;
pos_executable(R,t) : R = 1..t;
not_contradict(F,S,t) : contradict(F), S = 1..t;
vol(t).

Expand Down Expand Up @@ -159,7 +159,7 @@ fluent(cpa_coin_at(cpa_c0, cpa_f1, cpa_p1)).
fluent(cpa_coin_at(cpa_c1, cpa_f1, cpa_p0)).
fluent(cpa_coin_at(cpa_c1, cpa_f1, cpa_p1)).

%% actions ------
%% actions ------

action(cpa_collect(cpa_c0, cpa_f0, cpa_p0)).
action(cpa_collect(cpa_c0, cpa_f0, cpa_p1)).
Expand All @@ -186,7 +186,7 @@ action(cpa_step_out(cpa_e0, cpa_f1, cpa_p0)).
action(cpa_step_out(cpa_e1, cpa_f0, cpa_p1)).
action(cpa_step_out(cpa_e1, cpa_f1, cpa_p1)).

%% executable ------
%% executable ------

executable(cpa_collect(cpa_c0, cpa_f0, cpa_p0),cpa_at(cpa_f0, cpa_p0)).
executable(cpa_collect(cpa_c0, cpa_f0, cpa_p1),cpa_at(cpa_f0, cpa_p1)).
Expand All @@ -209,7 +209,7 @@ executable(cpa_step_out(cpa_e0, cpa_f1, cpa_p0),cpa_inside(cpa_e0)).
executable(cpa_step_out(cpa_e1, cpa_f0, cpa_p1),cpa_inside(cpa_e1)).
executable(cpa_step_out(cpa_e1, cpa_f1, cpa_p1),cpa_inside(cpa_e1)).

%% effects ------
%% effects ------

effect(cpa_collect(cpa_c0, cpa_f1, cpa_p0),cpa_have(cpa_c0),1).
effect(cpa_collect(cpa_c0, cpa_f1, cpa_p0),neg(cpa_coin_at(cpa_c0, cpa_f1, cpa_p0)),1).
Expand Down Expand Up @@ -268,7 +268,7 @@ effect(cpa_step_out(cpa_e1, cpa_f1, cpa_p1),cpa_at(cpa_f1, cpa_p1),1).
effect(cpa_step_out(cpa_e1, cpa_f1, cpa_p1),neg(cpa_inside(cpa_e1)),1).
condition(cpa_step_out(cpa_e1, cpa_f1, cpa_p1),cpa_in(cpa_e1, cpa_f1),1).

%% initial state ------
%% initial state ------

initially(cpa_at(cpa_f0, cpa_p0)).
initially(neg(cpa_at(cpa_f0, cpa_p1))).
Expand All @@ -287,8 +287,7 @@ initially_oneof(3,cpa_coin_at(cpa_c1, cpa_f1, cpa_p0),1).
initially_oneof(3,cpa_coin_at(cpa_c0, cpa_f1, cpa_p1),2).
initially_oneof(3,cpa_coin_at(cpa_c1, cpa_f1, cpa_p1),2).

%% goal state ----------
%% goal state ----------

goal(cpa_have(cpa_c0)).
goal(cpa_have(cpa_c1)).

23 changes: 11 additions & 12 deletions app/clingo/tests/lua/conformant2.lp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#script (lua)
#script (lua)
function main(prg)
local step = 0
local check = false
Expand Down Expand Up @@ -29,7 +29,7 @@ function main(prg)
if ret.satisfiable then
break
end
else
else
break
end
end
Expand Down Expand Up @@ -60,7 +60,7 @@ contradict(F) :- complement(F,L,M), effect(A,L,N1), effect(A,M,N2),
{ holds(F,0) } :- complement(F,L,M), not initially(L), not initially(M).
holds(F,0) :- initially(L), complement(F,L,M).

holds_oneof(N,B) :-
holds_oneof(N,B) :-
initially_oneof(N,_,B);
not holds(F,0) : initially_oneof(N,M,B), complement(F,L,M);
holds(F,0) : initially_oneof(N,L,B), complement(F,L,M).
Expand All @@ -80,7 +80,7 @@ holds(L,t) :- occurs(A,t), effect(A,L,N), holds(C,t-1) : condition(A,C,N).
holds(L,t) :- holds(L,t-1), complement(L,M), not holds(M,t).
:- contradict(F), complement(F,L,M), holds((L),t), holds((M),t).

caused(L,t) :- occurs(A,t), effect(A,L,N),
caused(L,t) :- occurs(A,t), effect(A,L,N),
not holds(F',t-1) : condition(A,M',N), complement(F',L',M');
holds(F',t-1) : condition(A,L',N), complement(F',L',M').
holds(F,t) :- caused(L,t), complement(F,L,M).
Expand Down Expand Up @@ -126,9 +126,9 @@ pos_executable(T,t) :- occurs(A,T), alt_holds(C,T-1,t) : executable(A,C), C !=
pos_goal_or(N,t) :- goal_or(N,L,B), alt_holds(L,t,t), vol(t).
pos_goal_or(N,t) :- goal_or(N,L,B), goal(L), vol(t).

bottom(t) :- pos_goal_or(N,t) : goal_or(N,_,_);
bottom(t) :- pos_goal_or(N,t) : goal_or(N,_,_);
alt_holds(L,t,t) : goal(L);
pos_executable(R,t) : R = 1..t;
pos_executable(R,t) : R = 1..t;
not_contradict(F,S,t) : contradict(F), S = 1..t;
vol(t).

Expand All @@ -148,7 +148,7 @@ fluent(cpa_visited(cpa_n2)).
fluent(cpa_at(cpa_n1)).
fluent(cpa_at(cpa_n2)).

%% actions ------
%% actions ------

action(cpa_start(cpa_n1)).
action(cpa_start(cpa_n2)).
Expand All @@ -157,7 +157,7 @@ action(cpa_travel(cpa_n1, cpa_n2)).
action(cpa_travel(cpa_n2, cpa_n1)).
action(cpa_travel(cpa_n2, cpa_n2)).

%% executable ------
%% executable ------

executable(cpa_start(cpa_n1),true).
executable(cpa_start(cpa_n2),true).
Expand All @@ -166,7 +166,7 @@ executable(cpa_travel(cpa_n1, cpa_n2),cpa_started).
executable(cpa_travel(cpa_n2, cpa_n1),cpa_started).
executable(cpa_travel(cpa_n2, cpa_n2),cpa_started).

%% effects ------
%% effects ------

effect(cpa_start(cpa_n1),cpa_started,1).
effect(cpa_start(cpa_n1),cpa_visited(cpa_n1),1).
Expand All @@ -183,16 +183,15 @@ effect(cpa_travel(cpa_n2, cpa_n1),cpa_at(cpa_n1),1).
effect(cpa_travel(cpa_n2, cpa_n1),neg(cpa_at(cpa_n2)),1).
condition(cpa_travel(cpa_n2, cpa_n1),cpa_at(cpa_n2),1).

%% initial state ------
%% initial state ------

initially(neg(cpa_visited(cpa_n1))).
initially(neg(cpa_visited(cpa_n2))).
initially(neg(cpa_started)).
initially_oneof(1,cpa_at(cpa_n1),1).
initially_oneof(1,cpa_at(cpa_n2),2).

%% goal state ----------
%% goal state ----------

goal(cpa_visited(cpa_n1)).
goal(cpa_visited(cpa_n2)).

23 changes: 11 additions & 12 deletions app/clingo/tests/lua/conformant3.lp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#script (lua)
#script (lua)
function main(prg)
local step = 0
local check = false
Expand Down Expand Up @@ -29,7 +29,7 @@ function main(prg)
if ret.satisfiable then
break
end
else
else
break
end
end
Expand Down Expand Up @@ -60,7 +60,7 @@ contradict(F) :- complement(F,L,M), effect(A,L,N1), effect(A,M,N2),
{ holds(F,0) } :- complement(F,L,M), not initially(L), not initially(M).
holds(F,0) :- initially(L), complement(F,L,M).

holds_oneof(N,B) :-
holds_oneof(N,B) :-
initially_oneof(N,_,B);
not holds(F,0) : initially_oneof(N,M,B), complement(F,L,M);
holds(F,0) : initially_oneof(N,L,B), complement(F,L,M).
Expand All @@ -80,7 +80,7 @@ holds(L,t) :- occurs(A,t), effect(A,L,N), holds(C,t-1) : condition(A,C,N).
holds(L,t) :- holds(L,t-1), complement(L,M), not holds(M,t).
:- contradict(F), complement(F,L,M), holds((L),t), holds((M),t).

caused(L,t) :- occurs(A,t), effect(A,L,N),
caused(L,t) :- occurs(A,t), effect(A,L,N),
not holds(F',t-1) : condition(A,M',N), complement(F',L',M');
holds(F',t-1) : condition(A,L',N), complement(F',L',M').
holds(F,t) :- caused(L,t), complement(F,L,M).
Expand Down Expand Up @@ -126,9 +126,9 @@ pos_executable(T,t) :- occurs(A,T), alt_holds(C,T-1,t) : executable(A,C), C !=
pos_goal_or(N,t) :- goal_or(N,L,B), alt_holds(L,t,t), vol(t).
pos_goal_or(N,t) :- goal_or(N,L,B), goal(L), vol(t).

bottom(t) :- pos_goal_or(N,t) : goal_or(N,_,_);
bottom(t) :- pos_goal_or(N,t) : goal_or(N,_,_);
alt_holds(L,t,t) : goal(L);
pos_executable(R,t) : R = 1..t;
pos_executable(R,t) : R = 1..t;
not_contradict(F,S,t) : contradict(F), S = 1..t;
vol(t).

Expand Down Expand Up @@ -164,7 +164,7 @@ fluent(cpa_noisy(cpa_p0)).
fluent(cpa_noisy(cpa_p1)).
fluent(cpa_noisy(cpa_p2)).

%% actions ------
%% actions ------

action(cpa_certify(cpa_p0)).
action(cpa_certify(cpa_p1)).
Expand Down Expand Up @@ -201,7 +201,7 @@ action(cpa_request_copy(cpa_p2, cpa_s3)).
action(cpa_request_copy(cpa_p2, cpa_s4)).
action(cpa_request_copy(cpa_p2, cpa_s5)).

%% executable ------
%% executable ------

executable(cpa_certify(cpa_p0),cpa_read(cpa_p0)).
executable(cpa_certify(cpa_p1),cpa_read(cpa_p1)).
Expand Down Expand Up @@ -238,7 +238,7 @@ executable(cpa_request_copy(cpa_p2, cpa_s3),cpa_current_stage(cpa_s3)).
executable(cpa_request_copy(cpa_p2, cpa_s4),cpa_current_stage(cpa_s4)).
executable(cpa_request_copy(cpa_p2, cpa_s5),cpa_current_stage(cpa_s5)).

%% effects ------
%% effects ------

effect(cpa_certify(cpa_p0),cpa_bad(cpa_p0),1).
condition(cpa_certify(cpa_p0),cpa_noisy(cpa_p0),1).
Expand Down Expand Up @@ -297,7 +297,7 @@ effect(cpa_request_copy(cpa_p2, cpa_s2),neg(cpa_noisy(cpa_p2)),1).
effect(cpa_request_copy(cpa_p2, cpa_s2),neg(cpa_bad(cpa_p2)),1).
condition(cpa_request_copy(cpa_p2, cpa_s2),cpa_bad(cpa_p2),1).

%% initial state ------
%% initial state ------

initially(cpa_current_stage(cpa_s0)).
initially(cpa_in_channel(cpa_p0)).
Expand All @@ -324,9 +324,8 @@ initially_oneof(1,neg(cpa_noisy(cpa_p0)),2).
initially_oneof(1,neg(cpa_noisy(cpa_p2)),2).
initially_oneof(1,neg(cpa_noisy(cpa_p1)),2).

%% goal state ----------
%% goal state ----------

goal(cpa_ok(cpa_p0)).
goal(cpa_ok(cpa_p1)).
goal(cpa_ok(cpa_p2)).

2 changes: 1 addition & 1 deletion app/clingo/tests/lua/cover-lua.lp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ State = { }
State.__index = State

function State.new()
local x = {
local x = {
leaves = {},
last = nil
}
Expand Down
4 changes: 2 additions & 2 deletions app/clingo/tests/lua/domain.lp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
p(1).
{ p(3) }.
{ p(3) }.
#external p(1..3).

q(X) :- p(X).
Expand Down Expand Up @@ -30,4 +30,4 @@ function main(prg)
io.flush()
end

#end.
#end.
Loading

0 comments on commit 4a12774

Please sign in to comment.