I'm working on a constraint logic program, which represents the interaction of 4 agents (hybrid automata) (disturbance, decay, cargo, truck), they interacts in terms of events (synchronized or interleaved) the purpose of interaction is to share their knowledge when there is a synchronized event, each agents has a continuous and discrete behavior during the continuous behavior (at the same state) the knowledge remains the same, during the discrete steps (agent moves from state to another when an event is fired). they update knowledge by adding the shared knowledge (because of the synchronized event) to the previous knowledge of the agent. the implementation is: drive((S1,Y0,Know),(S2,D0,Know1),(S3,X0,Know2),(S4,Z0,Know3), Starttime,Steps,[(S1,S2,S3,S4,Time,Event,D)|R]):- disturbance(S1,[Y0],[Y],Starttime,Ty,Know), decay(S2,[D0],[D],Starttime,Td,Know1), cargo(S3,[X0],[X],Starttime,Tx,Know2), truck(S4, [Z0],[Z],Starttime,Tz,Know3), Ty $=Td, Ty $=Tx, Ty $=Tz,Time $=Ty, % % S1,2,3,4 represents the state of each agent %% D,Y,X,Z is the values at the end and start of state %% starttime is the start time at state, Td,Tx,Tz the end time at each %state % Know is the knowledge at each state. * check((Event,Shared1,Know),(Event,Shared2,Know1),(Event,Shared3,Know2),(Event,Shared4,Know3)), * evolve(disturbance,(S1,Y0,Know),(NextS1,YY0,Knowa),Shared1,Starttime,Ty,Event), evolve(decay,(S2,D0,Know1),(NextS2,DD0,Knowb),Shared2,Starttime,Td,Event), evolve(cargo,(S3,X0,Know2),(NextS3,XX0,Knowc),Shared3,Starttime,TX,Event), evolve(truck,(S4,Z0,Know3),(NextS4,ZZ0,Knowd),Shared4,Starttime,Tz,Event), %evolve represents the continuous and discrete behavior %Event is the fired event, only one event happens at a time get_bounds(Time,_,Newstarttime), write("time interval"),writeln(Time), write(S1),write(" : "),write(S2),write(" : "), write(S3),write(" : "), writeln(S4), write(Y),write(" : "),write(D),write(" : "),write(X),write(" : "), writeln(Z), write(Know),write(" : "),write(Know1),write(" : "),write(Know2),write(" : "), writeln(Know3), write("Event :"),writeln(Event), write("Timex = "), writeln(Tx), writeln("-----------"), Steps > 0,Steps1 is Steps -1, drive((NextS1,YY0,Knowa),(NextS2,DD0,Knowb),(NextS3,XX0,Knowc),(NextS4,ZZ0,Knowd),Newstarttime,Steps1,R) . i have a problem with the * check((Event,Shared1,Know),(Event,Shared2,Know1),(Event,Shared3,Know2),(Event,Shared4,Know3)), * i was trying to say if events are the same then share the knowledge but eclipse always gave me abort * and when i remove "check" the program works correctly but without sharing the knowledgecheck((Event1,Shared1,KY),(Event2,Shared2,KD),(Event3,Shared3,KX),(Event4,Shared4,KZ)):-Event1 =:= Event2,Event2 =:= Event3,Shared1 &= Shared2, Shared1 &= Shared3, conc(KY,KD,N1),conc(N1,KX,N2),Shared1 &=N2.check((Event1,Shared1,KY),(Event2,Shared2,KD),(Event3,Shared3,KX),(Event4,Shared4,KZ)):-Event1 =:= Event2,Event2 =:= Event4,Shared1 &= Shared2, Shared1 &= Shared3,conc(KY,KD,N1),conc(N1,KZ,N2),Shared1&=N2.check((Event1,Shared1,KY),(Event2,Shared2,KD),(Event3,Shared3,KX),(Event4,Shared4,KZ)):-Event2 =:= Event3,Event2 =:= Event4,Shared2 &= Shared3, Shared2 &= Shared4,conc(KD,KX,N1),conc(N1,KZ,N2),Shared2 &=N2.* *any help please*Received on Tue Oct 13 2015 - 08:20:32 CEST
This archive was generated by hypermail 2.3.0 : Tue Jun 04 2024 - 18:13:21 CEST