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: 693
Function: getPaste
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]) :- 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)), 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), shortest(A,B,Path,Length,Cost) :- 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)), 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 % ... activates(Source, Target, []) :- activates(Source, Target, []) :- time(Currexp, Currtime), time(Furtherexp, Furthertime), Spvalue2 > Spvalue1, Tpvalue2 < Tpvalue1, activates(Source, Target, [Currexp|Experiments]) :- Source \== Target, time(Currexp, Currtime), time(Furtherexp, Furthertime), \+member(Currexp, Experiments), Spvalue2 >= Spvalue1, Tpvalue2 >= Tpvalue1, !, activates(Source, Target, Experiments). /*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), ! ), % length(Exps, L), % write(['length is ', L]), sort(Gs, Genes), 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)).% :- !. get_nodes(Graph, GeneFrom, GeneTo, Nodes) :- node(GeneFrom, GeneTo, B, C), member(node(GeneFrom, GeneTo, B, C), Graph), Nodes). pre_check_exps_length(Exps) :- post_check_network_length(Network) :- length(Network, NetworkLength), ( NetworkLength < 1, make_exps(0, _, []) :- !, format('rien a faire pour MaxTime=~w', [0]), !. make_exps(MaxTime, Exps, Network) :- A \== B, Step1 =< MaxTime, Step2 =< MaxTime, % ValueA1 #>= minValue % ValueB1 #>= minValue Diff2 \== 0, 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) :- sort(As, Ss), length(Ss, 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_in(node(A,B,Weight,Weight), Exps, % Step2 is Step1 + 1, %A \= B, A \= B, ValueA2 \= ValueA1, ValueB2 \= ValueB1, Diff2 \= Diff1, %Diff2 #\= 0, 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, 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), make_exps2(MaxTime, Exps, SubLength, Ns), ! . getfuture(Genes, Network, FutureExps, Time) :- ( member(G, Genes), member(node(X, G, _), Network), X \== G, ), 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, Nodes = [node(a,b,2,2)], make_experiments(MaxTime, Exps, Nodes, Network). test2 :- MaxTime = 3, Nodes = [node(a,b,2,2)], make_exps2_super(MaxTime, Exps, Nodes). test3(Exps, Nodes) :- MaxTime = 3, % Nodes = [node(a,b,2,2)], make_exps2(MaxTime, Exps, 1, Nodes). experiences( ]). 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), 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), testlabellazy2(MaxLength, Exps, A, Rest). testsudoku2(Rows, Nodes) :- experiences(Exps), 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, 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) , checkcurrenttargets(FromId, NextTargetId, Exps, Targets/*TargetIds*/, MaxLength, Ns), append(CurrentNodes, Ns, Nodes). testlabel3(A) :- experiences(Exps), 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), 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,*/