A PHP Error was encountered
Severity: 8192
Message: Function create_function() is deprecated
Filename: geshi/geshi.php
Line Number: 4698
Backtrace:
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 624
Function: getPaste
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/system/core/Exceptions.php:271)
Filename: view/download.php
Line Number: 2
Backtrace:
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/themes/geocities/views/view/download.php
Line: 2
Function: header
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/core/MY_Loader.php
Line: 173
Function: include
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/core/MY_Loader.php
Line: 43
Function: _ci_load
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 625
Function: view
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/system/core/Exceptions.php:271)
Filename: view/download.php
Line Number: 3
Backtrace:
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/themes/geocities/views/view/download.php
Line: 3
Function: header
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/core/MY_Loader.php
Line: 173
Function: include
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/core/MY_Loader.php
Line: 43
Function: _ci_load
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 625
Function: view
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once
use_module(library(http/json)).
use_module(library(http/json_convert)).
use_module(library(clpfd)).
/*edge(node(From), node(Dest)).*/
/*activator(node(A)) :- activates(node(A), node(D)), A \== D.*/
inhibitor(node(I)) :- inhibates(node(I), node(D)), I \== D.
printlist(l).
printlist([]).
printlist([X|List]) :-
write(X), nl,
printlist(List).
%haspath(X, Y) :- path(X, Y, _).
%table path(+,+,-,min,min).
% 3
/*path(X, Y, Path) :- path(X, Y, _, _, Path).
%5 simple
path(X, Y, 1, Cost, [X,Y]) :- edge(X, Y, Cost).
% 5 extended
path(X, Y, Length, TotalCost, [X|[Z|Path]]):-
%X \== Y, X \== Z,
edge(X, Z, Cost),
%not(member(X, Rest)),
path(Z, Y, SubLength, SubCost, [Z|Path]),
not(member(X, Path)),
Length is SubLength + 1,
TotalCost is Cost + SubCost.*/
%path(X, Y, Path) :- path(X, Y, _, _, Path).
%path(X, Y, Length, Cost, Path):- path(X, Y, [], Length, Cost, Path).
%
path(X, Y, Visited, 1, Cost, [X|Visited]):- edge(X, Y, Cost).
path(X, Y, Visited, Length, TotalCost, [X|[Z|Rest]]):-
edge(X, Z, Cost),
Y\==Z,
\+member(Z, Visited),
path(Z, Y, [Z|Visited], SubLength, SubCost, [Z|Rest]),
%not(member(X, Rest)),
Length is SubLength + 1,
TotalCost is Cost + SubCost.
path2(A,B,Path,Len,Cost) :-
travel(A,B,[A],Q,Len,Cost),
reverse(Q,Path).
travel(A,B,P,[B|P],1,Cost) :-
edge(A,B,Cost).
travel(A,B,Visited,Path,Length,TotalCost) :-
edge(A,C,Cost),
C \== B,
\+member(C,Visited),
travel(C,B,[C|Visited],Path,L1,C1),
Length is 1+L1,
TotalCost is Cost + C1.
shortest(A,B,Path,Length,Cost) :-
setof([C,P,L],path2(A,B,P,L,C),Set),
Set = [_|_], % fail if empty
minimal(Set,[Cost,Path,Length]).
minimal([F|R],M) :- min(R,F,M).
% minimal path
min([],M,M).
min([[Path,Length]|R],[_,M],Min) :- Length < M, !, min(R,[Path, Length],Min).
min([_|R],M,Min) :- min(R,M,Min).
%table sp(+,+,-,min).
sp(X,Y,[(X,Y)],(W,1)) :-
edge(X,Y,W).
sp(X,Y,[(X,Y)],(W,1)) :-
edge(X,Y,W).
sp(X,Y,[(X,Z)|Path],(W,Len)) :-
edge(X,Z,W1),
sp(Z,Y,Path,(W2,Len1)),
% not(member(X, Path)),
Len is Len1+1,
W is W1+W2.
node(protein01).
node(protein02).
node(protein03).
node(protein04).
node(protein05).
edge(protein01, protein02, 1).
edge(protein01, protein03, 1).
edge(protein02, protein03, 2).
edge(protein02, protein05, 1).
edge(protein03, protein04, 3).
edge(protein04, protein05, 1).
edge(protein05, protein01, 3).
edge(a,e,1).
edge(e,d,1).
edge(d,c,1).
edge(c,b,3).
edge(b,a,3).
edge(d,a,8).
edge(e,c,1).
edge(f,b,6).
time(exp01, 1). % 00h
time(exp02, 2). % 12h
time(exp03, 3). % 24h
time(exp04, 4). % 36h
% ...
exp(gene01, exp01, 8.1).
exp(gene02, exp01, 7.0).
exp(gene03, exp01, 1.0).
exp(gene01, exp02, 2.0).
exp(gene02, exp02, 2.4).
exp(gene03, exp02, 3.0).
exp(gene01, exp03, 3.0).
exp(gene02, exp03, 2.8).
exp(gene03, exp03, 2.7).
exp(gene01, exp04, 1.0).
exp(gene02, exp04, 0.1).
exp(gene03, exp04, 10.0).
activates(Source, Target, []) :-
exp(Source, Currexp, 0),
exp(Target, Currexp, Tpvalue),
Tpvalue > 0, !, fail.
activates(Source, Target, []) :-
exp(Source, Currexp, Spvalue1),
exp(Target, Currexp, Tpvalue1),
time(Currexp, Currtime),
time(Furtherexp, Furthertime),
Furthertime is Currtime + 1,
exp(Source, Furtherexp, Spvalue2),
exp(Target, Furtherexp, Tpvalue2),
Spvalue2 > Spvalue1,
Tpvalue2 < Tpvalue1,
!, fail.
activates(Source, Target, [Currexp|Experiments]) :-
Source \== Target,
exp(Source, Currexp, Spvalue1),
exp(Target, Currexp, Tpvalue1),
time(Currexp, Currtime),
time(Furtherexp, Furthertime),
Furthertime is Currtime + 1,
exp(Source, Furtherexp, Spvalue2),
exp(Target, Furtherexp, Tpvalue2),
\+member(Currexp, Experiments),
Spvalue2 >= Spvalue1,
Tpvalue2 >= Tpvalue1,
!,
activates(Source, Target, Experiments).
activators(Set) :- setof([G1, G2, Diff1, Diff2, W], (E1 \== E2, exp(G1,E1,V1), exp(G2, E1, V2), G1 \== G2, time(E1,T1), time(E2,T2), T2 is T1 + 1, exp(G1, E2, V3), exp(G2, E2, V4), V3 >= V1, V4 >= V2, Diff1 is V3 - V1, Diff2 is V4 - V2, W is Diff1 / Diff2), Set).
inhibitors(Set) :- setof([G1, G2, Diff1, Diff2, W], (E1 \== E2, exp(G1,E1,V1), exp(G2, E1, V2), G1 \== G2, time(E1,T1), time(E2,T2), T2 is T1 + 1, exp(G1, E2, V3), exp(G2, E2, V4), V3 > V1, V4 < V2, Diff1 is V3 - V1, Diff2 is V4 - V2, W is Diff1 / -Diff2), Set).
/*relation :- activates(node(Source)), (node(Destination)), (Source), Source \== Destination.
relation :- inhibates(node(Source)), (node(Destination)), inhibitor(Source), Source \== Destination.
*/
/* map(M, K, V). */
map(Assoc, Keys, Values) :-
group_pairs_by_key([a-2,a-8, a-3,b-4], Assoc),
pairs_keys(Assoc, Keys),
pairs_values(Assoc, Values).
test2(Name, ListAssoc, X) :-
Name = 'LIGT',
ListAssoc = [v(1,5,5), v(3,3,6), v(7,12,12)],
X = [sample(Name, ListAssoc)].
test3(X, L, N, Assoc) :- test2(X, L, N), list_to_assoc(L, Assoc).
test4(v(Time,VFrom,VTo), LAssoc) :-
group_pairs_by_key([Time-VFrom, Time-VTo],LAssoc).
solve(MaxTime, Samples, LAssoc) :-
%make_samples(MaxTime, Samples, LAssoc),
make_graph(MaxTime, Samples, Graph),
make_labelling(LAssoc).
make_samples(_, [], []).
make_samples(MaxTime,
[sample(Name, Exps)|Samples], LAssoc) :-
%order_experiments(Exps, OrderedExps),
%make_experiments(MaxTime, OrderedExps, LAssoc),
make_samples(MaxTime, Samples, LAssoc).
%make_graph(_, [], []).
%make_graph(MaxTime, [sample(Name, Exps)|samples], Graph) :-.
make_experiments(_, [], _, []) :- !.
make_experiments(MaxTime, Exps, SuggestedNodes, Graph) :-
pre_check_exps_length(Exps), !,
make_exps(MaxTime, Exps, GeneratedGraph), !,
(make_graph(SuggestedNodes, GeneratedGraph, Graph), !
;write('Cannot do anything with the suggested nodes'), !, fail
),
% length(Exps, L),
% write(['length is ', L]),
findall(G, member(exp(G,_,_), Exps), Gs),
sort(Gs, Genes),
findall(N, member(node(N, _, _, _), Graph), Ns),
sort(Ns, Nodes).
make_graph(SuggestedNodes, Generated, Graph) :-
append(SuggestedNodes, Generated, Union),
sort(Union, Sorted),
merge_nodes(Sorted, [], Graph), !.
% TODO get_nodes() recursively... merge each node
make_graph([], A, Sorted) :- sort(A, Sorted).
/*merge_network([],[], _).
merge_network([node(A,B,C,D)|T], /*Acc, */Merged) :-
member(node(A,B,_,_), Acc),
merge_nodes(T, Acc, Merged)
;
merge_nodes([node(A, B, C, D)|T], [], Merged),
append(DistinctNodes, Acc, Merged),
merge_nodes(T, Acc, Merged)*/
merge_nodes(Nodes, Acc, Merged) :-
% find nodes with same orgin/destination than current
nth1(1, Nodes, node(From,To,_,_)),
get_nodes(Nodes, From, To, TreatedNodes),
% generate a node that matches as best as possible the targeted values in his range
gen_interval(TreatedNodes, BestInterval),
% add it to
subtract(Nodes, TreatedNodes, RemainedNodes),
append([BestInterval], Acc, TempMerged),
%append(, , Merged),
% merge_nodes(T, Acc, Merged),
merge_nodes(RemainedNodes, TempMerged, Merged), !
.
merge_nodes([], N, N).%[node(A, B, C, D)], [node(A, B, C, D)]).
min_value(A, B, A) :- A =< B, !.
min_value(B, A, A) :- A =< B, !.
max_value(A, B, A) :- A >= B, !.
max_value(B, A, A) :- A >= B, !.
%best_interval(N,N,N).
gen_interval([node(From, To, WeightMin, WeightMax)|T], node(From, To, BestMin, BestMax)) :-
gen_interval(T, node(From, To, SubMin, SubMax)),
% node(From, To, Min, Max),
min_value(WeightMin, SubMin, BestMin),
max_value(WeightMax, SubMax, BestMax).
gen_interval([node(From,To,Min,Max)], node(From,To,Min,Max)).% :- !.
gen_interval([], _) :- fail.
get_nodes(Graph, GeneFrom, GeneTo, Nodes) :-
findall(
node(GeneFrom, GeneTo, B, C),
member(node(GeneFrom, GeneTo, B, C), Graph),
Nodes).
pre_check_exps_length(Exps) :-
length(Exps, L), (L < 4, write('Not enough experiments'),!, fail; L >= 4).
post_check_network_length(Network) :-
length(Network, NetworkLength), (
NetworkLength < 1,
write('Your experiments cannot generate a valid network! The generated network is empty'),
fail; !).
make_exps(_, [], []) :- !, write('rien a faire pour Exps=[]'), !.
make_exps(0, _, []) :- !, format('rien a faire pour MaxTime=~w', [0]), !.
make_exps(MaxTime, Exps, Network) :-
findall(node(A,B,Weight,Weight), (
member(exp(A,Step1,ValueA1), Exps),
member(exp(B,Step1,ValueB1), Exps),
member(exp(A,Step2,ValueA2), Exps),
member(exp(B,Step2,ValueB2), Exps),
A \== B,
Step1 =< MaxTime, Step2 =< MaxTime,
% ValueA1 #>= minValue
% ValueB1 #>= minValue
Diff1 is ValueA2 - ValueA1,
Diff2 is ValueB2 - ValueB1,
Diff2 \== 0,
Weight is abs(round(100* Diff1 / Diff2)),
Weight >= 1
% Weight ins [0..1000],
% Values = [ValueA1, ValueB1, ValueA2, ValueB2],
% Values ins [0..1000],
% Steps = [Step1, Step2],
% Steps ins [0..MaxTime],
% diff blabla #\= weight
% diff1 et diff2 #>= minDiff
), Network),
post_check_network_length(Network)
%,getfuture(Genes, FutureExps, MaxTime + 1)
.
max_network_length(Exps, MaxLength) :-
findall(A, member(exp(A,_,_),Exps), As),
sort(As, Ss),
length(Ss, L),
MaxLength is L * L.
make_exps2_super(MaxTime, Exps, Nodes) :-
max_network_length(Exps, MaxLength),
make_exps2(MaxTime, Exps, MaxLength, Nodes),
length(Nodes, Nb),
format('Nodes size : ~w',[Nb]),
check_ins(Nodes, Exps).
check_ins([node(A,B,Min,Max)|Ns],Exps) :-
check_in(node(A,B,Min,Max), Exps, _),
check_ins(Ns, Exps).
check_ins(N, _) :- length(N,L), L < 1, !, fail.
check_in(node(A,B,Weight,Weight), Exps,
[exp(A,Step1,ValueA1),
exp(B,Step1,ValueB1),
exp(A,Step2,ValueA2),
exp(B,Step2,ValueB2)]) :-
% Step2 is Step1 + 1,
%A \= B,
member(exp(A,Step1,ValueA1), Exps),
member(exp(B,Step1,ValueB1), Exps),
Step2 is Step1 + 1,
A \= B,
member(exp(A,Step2,ValueA2), Exps),
member(exp(B,Step2,ValueB2), Exps),
ValueA2 \= ValueA1,
ValueB2 \= ValueB1,
Diff1 is ValueA2 - ValueA1,
Diff2 is ValueB2 - ValueB1,
Diff2 \= Diff1,
%Diff2 #\= 0,
Weight is Diff2 - Diff1,
Weight > 0, !.
/*Weight is abs(round(100* Diff1 / Diff2)),
Weight >= 1,!.*/
%make_exps2(_, _, L, Nodes) :- length(Nodes, L).
make_exps2(_, _, 0, []) :- !.
make_exps2(MaxTime, Exps, MaxLength,[node(A,B,MinWeight,MaxWeight)|Ns]) :-
Times = [Step1, Step2],
Weights = [MinWeight, MaxWeight],
Genes = [A, B],
Genes ins 1..2,
Times ins 0..MaxTime,
Weights ins 1..3,%0..MaxTime,
Step2 #> Step1,
MinWeight #=< MaxWeight,
A #\= B,
length(Ns, L), L is MaxLength - 1,
check_in(node(A,B,MinWeight,MaxWeight), Exps, MatchedExps),
/* A \== B,
Diff1 is ValueA2 - ValueA1,
Diff2 is ValueB2 - ValueB1,
Diff2 \== 0,
Weight is abs(round(100* Diff1 / Diff2)),
Weight >= 1,*/
% subtract(Exps, MatchedExps,RestExps),
%
%not(member(node(A,B,_,_), No)),
%append(node(A,B,MinWeight,MaxWeight), No),
SubLength is MaxLength -1,
make_exps2(MaxTime, Exps, SubLength, Ns), !
.
getfuture(Genes, Network, FutureExps, Time) :-
findall(exp(G, Step, ExprValue),
(
member(G, Genes),
member(node(X, G, _), Network), X \== G,
member(exp(G, FutureTime - 1, _), Exps),
Step is FutureTime - 1,
\+member(exp(G, Time, ExprValue), Exps)
),
FutureExps
).
makejobs([],[],_).
makejobs([task(N,D,_,_)|Ts],
[job(N,D,TS)|Js],End) :-
TS ins 0..1000, TS + D =< End,
makejobs(Ts, Js, End).
sudoku(Rows) :-
length(Rows, 9), maplist(length_list(9), Rows),
append(Rows, Vs), Vs ins 1..9,
maplist(all_distinct, Rows),
transpose(Rows, Columns),
maplist(all_distinct, Columns),
Rows = [A,B,C,D,E,F,G,H,I],
blocks(A, B, C), blocks(D, E, F), blocks(G, H, I).
length_list(L, Ls) :- length(Ls, L).
blocks([], [], []).
blocks([A,B,C|Bs1], [D,E,F|Bs2], [G,H,I|Bs3]) :-
all_distinct([A,B,C,D,E,F,G,H,I]),
blocks(Bs1, Bs2, Bs3).
problem(1, [[_,_,_,_,_,_,_,_,_],
[_,_,_,_,_,3,_,8,5],
[_,_,1,_,2,_,_,_,_],
[_,_,_,5,_,7,_,_,_],
[_,_,4,_,_,_,1,_,_],
[_,9,_,_,_,_,_,_,_],
[5,_,_,_,_,_,_,7,3],
[_,_,2,_,1,_,_,_,_],
[_,_,_,_,4,_,_,_,9]]).
/** MANUAL */
/* 1/ Get a generated network according to some experiments and constraints : */
% make_experiments(3, [exp(a,1,1),exp(a,2,2),exp(b,1,2),exp(b,2,4)], Network, [node(a,b,2)]).
test(Network) :-
MaxTime = 3,
Exps = [exp(a,1,1),exp(a,2,2),exp(b,1,2),exp(b,2,4),exp(b,3,1),exp(c,1,2),exp(c,2,3),exp(c,3,2)],
Nodes = [node(a,b,2,2)],
make_experiments(MaxTime, Exps, Nodes, Network).
test2 :-
MaxTime = 3,
Exps = [exp(a,1,1),exp(a,2,2),exp(b,1,2),exp(b,2,4)],
Nodes = [node(a,b,2,2)],
make_exps2_super(MaxTime, Exps, Nodes).
test3(Exps, Nodes) :-
MaxTime = 3,
Exps = [exp(1,1,1),exp(1,2,2),exp(2,1,2),exp(2,2,4)],
% Nodes = [node(a,b,2,2)],
make_exps2(MaxTime, Exps, 1, Nodes).
testlabel(A) :- max_network_length([exp(1,1,2),exp(2,1,1)],MaxLength), length(A, MaxLength), A ins 1..MaxLength, all_different(A), label(A).
experiences(
[exp(1,1,1),exp(1,2,3),
exp(2,1,1),exp(2,2,2),
exp(3,1,2),exp(3,2,1)
]).
testlabellazy(A, MatchedExps) :-
experiences(Exps),
max_network_length(Exps,MaxLength),
length(A, MaxLength),
%A=[B,C,D,E], % optional
A ins 0..MaxLength,
nth1(1,A,W),
check_in(node(2,1,W,W), Exps, MatchedExps), label(A).
testlabel2(A) :-
experiences(Exps),
findall(A, member(exp(A,_,_),Exps), As),
sort(As, Ss),
length(Ss, MaxLength),
MaxLength > 0,
testlabellazy2(MaxLength, Exps, A, Ss),
!,
label(A).
testlabellazy2(_, _, _, []).
testlabellazy2(MaxLength, Exps, A, [Current|Rest]) :-
%experiences(Exps),
%max_network_length(Exps,MaxLength),
length(A, MaxLength),
%A=[B,C,D,E], % optional
A ins 0..MaxLength,
(nth1(Current,A,W),
check_in(node(Current,_,W,W), Exps, _));true,
testlabellazy2(MaxLength, Exps, A, Rest).
testsudoku2(Rows, Nodes) :-
experiences(Exps),
findall(A, member(exp(A,_,_),Exps), As),
sort(As, Ss),
length(Ss, MaxLength),
MaxLength > 0,
sudoku2(Exps, MaxLength, Rows, Nodes),
% label(Rows),
maplist(writeln, Rows),
labelRows(Rows),
/*,makeNodesList(Rows, Nodes), */
!.
labelRows([]).
labelRows([Row|Rows]) :-
label(Row),
labelRows(Rows).
sudoku2(Exps, MaxLength, Rows, Nodes) :-
length(Rows, MaxLength), maplist(length_list(MaxLength), Rows),
append(Rows, Vs), Vs ins 0..MaxLength,
%maplist(all_distinct, Rows),
%transpose(Rows, Columns),
% maplist(all_distinct, Columns),
%Rows = [A,B,C,D,E,F,G,H,I],
columns(1, Exps, Rows, MaxLength, Nodes).
columns(_, _, [], _, []).
% current = [_,_,_,_,_...] where _ ... are targets
% and this is source ?
columns(FromId, Exps, [CurrentTargets|RestTargets],MaxLength, Nodes) :-
CurrentTargets ins 0..MaxLength,
% RowId ins 0..MaxLength,
NextFromId is FromId + 1,%RowId #< NextRowId,
format('columns : Will check values for fromId ~w ~n', [FromId]),
StartTarget = 1,
checkcurrenttargets(FromId, StartTarget, Exps, CurrentTargets, MaxLength, TargetNodes),
columns(NextFromId, Exps, RestTargets,MaxLength, Ns),
append(TargetNodes, Ns, Nodes).
checkcurrenttargets(_,_,_,[],_, []).
checkcurrenttargets(FromId, TargetId, Exps, [Target|Targets]/*TargetIds*/, MaxLength, Nodes) :-
format('checktargets : Will check values for fromId ~w targetId ~w ~n', [FromId, TargetId]),
%TargetsIds = [Target|Targets],
%length(TargetIds, MaxLength),
%TargetsIds ins 0..MaxLength,
(
( nth1(TargetId, [Target|Targets]/*TargetIds*/, Weight),
check_in(
node(FromId, TargetId,Weight,Weight),
Exps, _),
append([node(FromId, TargetId, Weight, Weight)], [], CurrentNodes)
); true)
,
NextTargetId is TargetId + 1,
checkcurrenttargets(FromId, NextTargetId, Exps, Targets/*TargetIds*/, MaxLength, Ns),
append(CurrentNodes, Ns, Nodes).
testlabel3(A) :-
experiences(Exps),
findall(Origin, member(exp(Origin,_,_),Exps), As),
sort(As, Ss),
length(Ss, MaxLength),
MaxLength > 0,
testlabellazy3(MaxLength, Exps, A, Ss),
!,
label(A).
testlabellazy3(_, _, _, []).
testlabellazy3(MaxLength, Exps, A, [Current|Rest]) :-
%experiences(Exps),
%max_network_length(Exps,MaxLength),
length(A, MaxLength),
%A=[B,C,D,E], % optional
A ins 0..MaxLength,
(nth1(Current,A,W),
check_in(node(Current,_,W,W), Exps, _));true,
testlabellazy3(MaxLength, Exps, A, Rest).
schedule(TSDs, Vars, End) :-
tasks(TDs), maplist(td_tsd, TDs, TSDs),
precedence_constr(TSDs, 0, End, Vars, []).
td_tsd(T/D, task(T,_S,D)).
precedence_constr([], End, End) --> [].
precedence_constr([task(T,S,D)|TSDs], End0, End) --> [S],
{ S #>= 0, S + D #=< End, End1 #= max(End0, S + D),
maplist(precedence(T,S,D), TSDs) },
precedence_constr(TSDs, End1, End).
precedence(T0,S0,D0, task(T,S,D)) :-
( prec(T0 =< T) -> S0 + D0 #=< S
; prec(T =< T0) -> S + D #=< S0
; true
).
tasks([t1/5, t2/7, t3/10, t4/2, t5/9]).
prec(t1 =< t2). prec(t1 =< t4). prec(t2 =< t3). prec(t4 =< t5).
testschedule(Ts, Vars, End) :- schedule(Ts, Vars, End), End #=< 33, labeling([min(End)], Vars).
testsudoku(Rows) :- problem(1, Rows), sudoku(Rows), maplist(writeln, Rows).
make_labelling(LAssoc) :- label(LAssoc).
/* Experiments :- [
truc('LIGT', [v(1, 2, 3), v(2, 3, 4)]),
truc('TUV', [v(1, 2, 3), v(2, 3, 4)])].*/
/*group_pairs_by_key([Time-VFrom, Time-VTo],LAssoc).*/
/*solve(20, []
solve(Time, Experiments, Graph, Laws) :-
DomTime ins 1..20,
DomExp ins 1..5,*/