From: Torsten S. <to...@cs...> - 2011-12-12 13:14:51
|
Hi Zahra, it seems to be that you accumulate the external information in ext_destination/3 in the solver, while you would like it to expire..? Hence I'd guess that a #volatile declaration in the stream would be what you want. However, to get a firm answer it'd be better to have a self-contained toy example. Best wishes, -torsten Zahra Vaseqi <zah...@gm...> writes: > --001517447ce81e050104b3e445fa > Content-Type: multipart/alternative; boundary=001517447ce81e04ee04b3e445f8 > > --001517447ce81e04ee04b3e445f8 > Content-Type: text/plain; charset=ISO-8859-1 > > Hi, > > I'm trying to model a ship traffic system using oClingo. Here is a > simplified version of the problem that I'm struggling with. > > The predicates in my domain are ships, locations and ship's destinations. I > need to keep track of ships' destinations at different time steps. > A ship's destination gets set to a destination whenever some information > about its destination in the online file becomes available and gets copied > to the following time steps if it does not change in the following time > steps. If some new information regarding the destination becomes available, > we would want to override the past destination with the new one. > > I'm having trouble encoding rules in a way that new information regarding * > change* in destination can properly reflect in the answer sets. > > > * destination(X,L,t) :- ext_destination(X,L,t), ship(X), location(L).* > This rule sets the predicate "destination" based on the external > information about the ship's destination. > > * destination(X,L1,t) :- destination(X,L1,t-1), not > ext_destination(X,L2,t), location(L1;L2), ship(X), L1!=L2.* > This second rule attempts to copy destination of the ship from the last > time step, unless a change in the destination of the ship has happened. > > Lets assume the following external input in which the destination of ship1 > changes from terminal1 to terminal2 in the second time step: > > #step 1. > > ext_destination(*ship1*,*terminal1*,1). > > #endstep. > > #step 2. > > ext_destination(*ship1*,*terminal2*,2). > > #endstep. > > The problem is that the answer sets in the second time step keep both new > destination and the old one, i.e.* destination(ship1,terminal2,2) > destination(ship1,terminal1,2)* > However, the old one should be ignored according to the second rule > mentioned above. I expect the answer sets from the second time step to only > include: *destination(ship1,terminal2,2)* > > note: the program works fine when having only "location(terminal1) > location(terminal2)" in the base part, but encounters the mentioned problem > when having more location predicates defined. > Attached are online.lp and program.lp > > I would appreciate if you could tell me how should I define my rules to get > around this problem. > > Best Regards, > Zahra > > --001517447ce81e04ee04b3e445f8 > Content-Type: text/html; charset=ISO-8859-1 > Content-Transfer-Encoding: quoted-printable > > Hi,<div><br></div><div>I'm trying to model a ship traffic system using = > oClingo. Here is a simplified version of the problem that I'm strugglin= > g with.</div><div><br></div><div>The predicates in my domain are ships, loc= > ations and ship's destinations. I need to keep track of ships' dest= > inations at different time steps.</div> > > <div>A ship's destination gets set to a destination whenever some infor= > mation about its destination in the online file becomes available and gets = > copied to the following time steps if it does not change in the following t= > ime steps. If some new information regarding the destination becomes availa= > ble, we would want to override the past destination with the new one.</div> > > <div><br></div><div>I'm having trouble encoding rules in a way that new= > information regarding <b>change</b> in destination can properly reflect in= > the answer sets.</div><div><br></div><div><br></div><div><div><b> > destination(X,L,t) :- ext_destination(X,L,t), ship(X), location(L).</b></di= > v><div>This rule sets the predicate "destination" based on the ex= > ternal information about the ship's destination.</div><div><br></div> > <div><b> > destination(X,L1,t) :- destination(X,L1,t-1), not ext_destination(X,L2,t), = > location(L1;L2), ship(X), L1!=3DL2.</b></div></div><div>This second rule at= > tempts to copy destination of the ship from the last time step, unless a ch= > ange in the destination of the ship has happened.</div> > > <div><br></div><div>Lets assume the following external input in which the d= > estination of ship1 changes from terminal1 to terminal2 in the second time = > step:</div><div><div><br></div><div>#step 1.</div><div><br></div><div> > ext_destination(<b>ship1</b>,<b>terminal1</b>,1).</div> > <div><br></div><div>#endstep.</div><div><br></div><div>#step 2.</div><div><= > br></div><div>ext_destination(<b>ship1</b>,<b>terminal2</b>,2).</div><div><= > br></div><div>#endstep.</div><div><br></div> > <div>The problem is that the answer sets in the second time step keep both = > new destination and the old one, i.e.<b>=A0destination(ship1,terminal2,2) = > =A0 =A0 destination(ship1,terminal1,2)</b></div><div>However, the old one s= > hould be ignored according to the second rule mentioned above. I expect the= > answer sets from the second time step to only include:=A0<b>destination(sh= > ip1,terminal2,2)</b>=A0</div> > </div><div><br></div><div> > note: the program works fine when having only =A0"location(terminal1) = > location(terminal2)" in the base part, but encounters the mentioned pr= > oblem when having more location predicates defined.</div><div>Attached are = > online.lp and program.lp</div> > > <div><br></div><div>I would appreciate if you could tell me how should I de= > fine my rules to get around this problem.</div><div><br></div><div>Best Reg= > ards,</div><div>Zahra</div> > > --001517447ce81e04ee04b3e445f8-- > --001517447ce81e050104b3e445fa > Content-Type: application/octet-stream; name="online.lp" > Content-Disposition: attachment; filename="online.lp" > Content-Transfer-Encoding: base64 > X-Attachment-Id: f_gw3gjhw32 > > CiNzdGVwIDEuCgpleHRfZGVzdGluYXRpb24oc2hpcDEsdGVybWluYWwxLDEpLgoKI2VuZHN0ZXAu > CiUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUKI3N0ZXAgMi4KCmV4dF9kZXN0aW5h > dGlvbihzaGlwMSx0ZXJtaW5hbDIsMikuCgojZW5kc3RlcC4KJSUlJSUlJSUlJSUlJSUlJSUlJSUl > JSUlJSUlJSUlJSUlJQojc3RvcC4= > --001517447ce81e050104b3e445fa > Content-Type: application/octet-stream; name="program.lp" > Content-Disposition: attachment; filename="program.lp" > Content-Transfer-Encoding: base64 > X-Attachment-Id: f_gw3gjhw83 > > CiNiYXNlLgoKc2hpcChzaGlwMSkuCgpsb2NhdGlvbih0ZXJtaW5hbDEpLgpsb2NhdGlvbih0ZXJt > aW5hbDIpLgpsb2NhdGlvbih0ZXJtaW5hbDMpLgoKJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUl > JSUlJSUlJQojY3VtdWxhdGl2ZSB0LgoKI2V4dGVybmFsIGV4dF9kZXN0aW5hdGlvbi8zLgoKZGVz > dGluYXRpb24oWCxMLHQpIDotIGV4dF9kZXN0aW5hdGlvbihYLEwsdCksIHNoaXAoWCksIGxvY2F0 > aW9uKEwpLgpkZXN0aW5hdGlvbihYLEwxLHQpIDotIGRlc3RpbmF0aW9uKFgsTDEsdC0xKSwgbm90 > IGV4dF9kZXN0aW5hdGlvbihYLEwyLHQpLCBsb2NhdGlvbihMMTtMMiksIHNoaXAoWCksIEwxIT1M > Mi4KCiNoaWRlLgojc2hvdyBkZXN0aW5hdGlvbi8zLgoKCgo= > --001517447ce81e050104b3e445fa > Content-Type: text/plain; charset="us-ascii" > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > Content-Disposition: inline > > ------------------------------------------------------------------------------ > Learn Windows Azure Live! Tuesday, Dec 13, 2011 > Microsoft is holding a special Learn Windows Azure training event for > developers. It will provide a great way to learn Windows Azure and what it > provides. You can attend the event by watching it streamed LIVE online. > Learn more at http://p.sf.net/sfu/ms-windowsazure > --001517447ce81e050104b3e445fa > Content-Type: text/plain; charset="us-ascii" > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > Content-Disposition: inline > > _______________________________________________ > Potassco-users mailing list > Pot...@li... > https://lists.sourceforge.net/lists/listinfo/potassco-users > > --001517447ce81e050104b3e445fa-- |