Browse Source

Importation du code depuis GitHub

gasc 2 years ago
commit
8cf7b2f506

+ 674
- 0
LICENSE View File

1
+                    GNU GENERAL PUBLIC LICENSE
2
+                       Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+                            Preamble
9
+
10
+  The GNU General Public License is a free, copyleft license for
11
+software and other kinds of works.
12
+
13
+  The licenses for most software and other practical works are designed
14
+to take away your freedom to share and change the works.  By contrast,
15
+the GNU General Public License is intended to guarantee your freedom to
16
+share and change all versions of a program--to make sure it remains free
17
+software for all its users.  We, the Free Software Foundation, use the
18
+GNU General Public License for most of our software; it applies also to
19
+any other work released this way by its authors.  You can apply it to
20
+your programs, too.
21
+
22
+  When we speak of free software, we are referring to freedom, not
23
+price.  Our General Public Licenses are designed to make sure that you
24
+have the freedom to distribute copies of free software (and charge for
25
+them if you wish), that you receive source code or can get it if you
26
+want it, that you can change the software or use pieces of it in new
27
+free programs, and that you know you can do these things.
28
+
29
+  To protect your rights, we need to prevent others from denying you
30
+these rights or asking you to surrender the rights.  Therefore, you have
31
+certain responsibilities if you distribute copies of the software, or if
32
+you modify it: responsibilities to respect the freedom of others.
33
+
34
+  For example, if you distribute copies of such a program, whether
35
+gratis or for a fee, you must pass on to the recipients the same
36
+freedoms that you received.  You must make sure that they, too, receive
37
+or can get the source code.  And you must show them these terms so they
38
+know their rights.
39
+
40
+  Developers that use the GNU GPL protect your rights with two steps:
41
+(1) assert copyright on the software, and (2) offer you this License
42
+giving you legal permission to copy, distribute and/or modify it.
43
+
44
+  For the developers' and authors' protection, the GPL clearly explains
45
+that there is no warranty for this free software.  For both users' and
46
+authors' sake, the GPL requires that modified versions be marked as
47
+changed, so that their problems will not be attributed erroneously to
48
+authors of previous versions.
49
+
50
+  Some devices are designed to deny users access to install or run
51
+modified versions of the software inside them, although the manufacturer
52
+can do so.  This is fundamentally incompatible with the aim of
53
+protecting users' freedom to change the software.  The systematic
54
+pattern of such abuse occurs in the area of products for individuals to
55
+use, which is precisely where it is most unacceptable.  Therefore, we
56
+have designed this version of the GPL to prohibit the practice for those
57
+products.  If such problems arise substantially in other domains, we
58
+stand ready to extend this provision to those domains in future versions
59
+of the GPL, as needed to protect the freedom of users.
60
+
61
+  Finally, every program is threatened constantly by software patents.
62
+States should not allow patents to restrict development and use of
63
+software on general-purpose computers, but in those that do, we wish to
64
+avoid the special danger that patents applied to a free program could
65
+make it effectively proprietary.  To prevent this, the GPL assures that
66
+patents cannot be used to render the program non-free.
67
+
68
+  The precise terms and conditions for copying, distribution and
69
+modification follow.
70
+
71
+                       TERMS AND CONDITIONS
72
+
73
+  0. Definitions.
74
+
75
+  "This License" refers to version 3 of the GNU General Public License.
76
+
77
+  "Copyright" also means copyright-like laws that apply to other kinds of
78
+works, such as semiconductor masks.
79
+
80
+  "The Program" refers to any copyrightable work licensed under this
81
+License.  Each licensee is addressed as "you".  "Licensees" and
82
+"recipients" may be individuals or organizations.
83
+
84
+  To "modify" a work means to copy from or adapt all or part of the work
85
+in a fashion requiring copyright permission, other than the making of an
86
+exact copy.  The resulting work is called a "modified version" of the
87
+earlier work or a work "based on" the earlier work.
88
+
89
+  A "covered work" means either the unmodified Program or a work based
90
+on the Program.
91
+
92
+  To "propagate" a work means to do anything with it that, without
93
+permission, would make you directly or secondarily liable for
94
+infringement under applicable copyright law, except executing it on a
95
+computer or modifying a private copy.  Propagation includes copying,
96
+distribution (with or without modification), making available to the
97
+public, and in some countries other activities as well.
98
+
99
+  To "convey" a work means any kind of propagation that enables other
100
+parties to make or receive copies.  Mere interaction with a user through
101
+a computer network, with no transfer of a copy, is not conveying.
102
+
103
+  An interactive user interface displays "Appropriate Legal Notices"
104
+to the extent that it includes a convenient and prominently visible
105
+feature that (1) displays an appropriate copyright notice, and (2)
106
+tells the user that there is no warranty for the work (except to the
107
+extent that warranties are provided), that licensees may convey the
108
+work under this License, and how to view a copy of this License.  If
109
+the interface presents a list of user commands or options, such as a
110
+menu, a prominent item in the list meets this criterion.
111
+
112
+  1. Source Code.
113
+
114
+  The "source code" for a work means the preferred form of the work
115
+for making modifications to it.  "Object code" means any non-source
116
+form of a work.
117
+
118
+  A "Standard Interface" means an interface that either is an official
119
+standard defined by a recognized standards body, or, in the case of
120
+interfaces specified for a particular programming language, one that
121
+is widely used among developers working in that language.
122
+
123
+  The "System Libraries" of an executable work include anything, other
124
+than the work as a whole, that (a) is included in the normal form of
125
+packaging a Major Component, but which is not part of that Major
126
+Component, and (b) serves only to enable use of the work with that
127
+Major Component, or to implement a Standard Interface for which an
128
+implementation is available to the public in source code form.  A
129
+"Major Component", in this context, means a major essential component
130
+(kernel, window system, and so on) of the specific operating system
131
+(if any) on which the executable work runs, or a compiler used to
132
+produce the work, or an object code interpreter used to run it.
133
+
134
+  The "Corresponding Source" for a work in object code form means all
135
+the source code needed to generate, install, and (for an executable
136
+work) run the object code and to modify the work, including scripts to
137
+control those activities.  However, it does not include the work's
138
+System Libraries, or general-purpose tools or generally available free
139
+programs which are used unmodified in performing those activities but
140
+which are not part of the work.  For example, Corresponding Source
141
+includes interface definition files associated with source files for
142
+the work, and the source code for shared libraries and dynamically
143
+linked subprograms that the work is specifically designed to require,
144
+such as by intimate data communication or control flow between those
145
+subprograms and other parts of the work.
146
+
147
+  The Corresponding Source need not include anything that users
148
+can regenerate automatically from other parts of the Corresponding
149
+Source.
150
+
151
+  The Corresponding Source for a work in source code form is that
152
+same work.
153
+
154
+  2. Basic Permissions.
155
+
156
+  All rights granted under this License are granted for the term of
157
+copyright on the Program, and are irrevocable provided the stated
158
+conditions are met.  This License explicitly affirms your unlimited
159
+permission to run the unmodified Program.  The output from running a
160
+covered work is covered by this License only if the output, given its
161
+content, constitutes a covered work.  This License acknowledges your
162
+rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+  You may make, run and propagate covered works that you do not
165
+convey, without conditions so long as your license otherwise remains
166
+in force.  You may convey covered works to others for the sole purpose
167
+of having them make modifications exclusively for you, or provide you
168
+with facilities for running those works, provided that you comply with
169
+the terms of this License in conveying all material for which you do
170
+not control copyright.  Those thus making or running the covered works
171
+for you must do so exclusively on your behalf, under your direction
172
+and control, on terms that prohibit them from making any copies of
173
+your copyrighted material outside their relationship with you.
174
+
175
+  Conveying under any other circumstances is permitted solely under
176
+the conditions stated below.  Sublicensing is not allowed; section 10
177
+makes it unnecessary.
178
+
179
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+  No covered work shall be deemed part of an effective technological
182
+measure under any applicable law fulfilling obligations under article
183
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+similar laws prohibiting or restricting circumvention of such
185
+measures.
186
+
187
+  When you convey a covered work, you waive any legal power to forbid
188
+circumvention of technological measures to the extent such circumvention
189
+is effected by exercising rights under this License with respect to
190
+the covered work, and you disclaim any intention to limit operation or
191
+modification of the work as a means of enforcing, against the work's
192
+users, your or third parties' legal rights to forbid circumvention of
193
+technological measures.
194
+
195
+  4. Conveying Verbatim Copies.
196
+
197
+  You may convey verbatim copies of the Program's source code as you
198
+receive it, in any medium, provided that you conspicuously and
199
+appropriately publish on each copy an appropriate copyright notice;
200
+keep intact all notices stating that this License and any
201
+non-permissive terms added in accord with section 7 apply to the code;
202
+keep intact all notices of the absence of any warranty; and give all
203
+recipients a copy of this License along with the Program.
204
+
205
+  You may charge any price or no price for each copy that you convey,
206
+and you may offer support or warranty protection for a fee.
207
+
208
+  5. Conveying Modified Source Versions.
209
+
210
+  You may convey a work based on the Program, or the modifications to
211
+produce it from the Program, in the form of source code under the
212
+terms of section 4, provided that you also meet all of these conditions:
213
+
214
+    a) The work must carry prominent notices stating that you modified
215
+    it, and giving a relevant date.
216
+
217
+    b) The work must carry prominent notices stating that it is
218
+    released under this License and any conditions added under section
219
+    7.  This requirement modifies the requirement in section 4 to
220
+    "keep intact all notices".
221
+
222
+    c) You must license the entire work, as a whole, under this
223
+    License to anyone who comes into possession of a copy.  This
224
+    License will therefore apply, along with any applicable section 7
225
+    additional terms, to the whole of the work, and all its parts,
226
+    regardless of how they are packaged.  This License gives no
227
+    permission to license the work in any other way, but it does not
228
+    invalidate such permission if you have separately received it.
229
+
230
+    d) If the work has interactive user interfaces, each must display
231
+    Appropriate Legal Notices; however, if the Program has interactive
232
+    interfaces that do not display Appropriate Legal Notices, your
233
+    work need not make them do so.
234
+
235
+  A compilation of a covered work with other separate and independent
236
+works, which are not by their nature extensions of the covered work,
237
+and which are not combined with it such as to form a larger program,
238
+in or on a volume of a storage or distribution medium, is called an
239
+"aggregate" if the compilation and its resulting copyright are not
240
+used to limit the access or legal rights of the compilation's users
241
+beyond what the individual works permit.  Inclusion of a covered work
242
+in an aggregate does not cause this License to apply to the other
243
+parts of the aggregate.
244
+
245
+  6. Conveying Non-Source Forms.
246
+
247
+  You may convey a covered work in object code form under the terms
248
+of sections 4 and 5, provided that you also convey the
249
+machine-readable Corresponding Source under the terms of this License,
250
+in one of these ways:
251
+
252
+    a) Convey the object code in, or embodied in, a physical product
253
+    (including a physical distribution medium), accompanied by the
254
+    Corresponding Source fixed on a durable physical medium
255
+    customarily used for software interchange.
256
+
257
+    b) Convey the object code in, or embodied in, a physical product
258
+    (including a physical distribution medium), accompanied by a
259
+    written offer, valid for at least three years and valid for as
260
+    long as you offer spare parts or customer support for that product
261
+    model, to give anyone who possesses the object code either (1) a
262
+    copy of the Corresponding Source for all the software in the
263
+    product that is covered by this License, on a durable physical
264
+    medium customarily used for software interchange, for a price no
265
+    more than your reasonable cost of physically performing this
266
+    conveying of source, or (2) access to copy the
267
+    Corresponding Source from a network server at no charge.
268
+
269
+    c) Convey individual copies of the object code with a copy of the
270
+    written offer to provide the Corresponding Source.  This
271
+    alternative is allowed only occasionally and noncommercially, and
272
+    only if you received the object code with such an offer, in accord
273
+    with subsection 6b.
274
+
275
+    d) Convey the object code by offering access from a designated
276
+    place (gratis or for a charge), and offer equivalent access to the
277
+    Corresponding Source in the same way through the same place at no
278
+    further charge.  You need not require recipients to copy the
279
+    Corresponding Source along with the object code.  If the place to
280
+    copy the object code is a network server, the Corresponding Source
281
+    may be on a different server (operated by you or a third party)
282
+    that supports equivalent copying facilities, provided you maintain
283
+    clear directions next to the object code saying where to find the
284
+    Corresponding Source.  Regardless of what server hosts the
285
+    Corresponding Source, you remain obligated to ensure that it is
286
+    available for as long as needed to satisfy these requirements.
287
+
288
+    e) Convey the object code using peer-to-peer transmission, provided
289
+    you inform other peers where the object code and Corresponding
290
+    Source of the work are being offered to the general public at no
291
+    charge under subsection 6d.
292
+
293
+  A separable portion of the object code, whose source code is excluded
294
+from the Corresponding Source as a System Library, need not be
295
+included in conveying the object code work.
296
+
297
+  A "User Product" is either (1) a "consumer product", which means any
298
+tangible personal property which is normally used for personal, family,
299
+or household purposes, or (2) anything designed or sold for incorporation
300
+into a dwelling.  In determining whether a product is a consumer product,
301
+doubtful cases shall be resolved in favor of coverage.  For a particular
302
+product received by a particular user, "normally used" refers to a
303
+typical or common use of that class of product, regardless of the status
304
+of the particular user or of the way in which the particular user
305
+actually uses, or expects or is expected to use, the product.  A product
306
+is a consumer product regardless of whether the product has substantial
307
+commercial, industrial or non-consumer uses, unless such uses represent
308
+the only significant mode of use of the product.
309
+
310
+  "Installation Information" for a User Product means any methods,
311
+procedures, authorization keys, or other information required to install
312
+and execute modified versions of a covered work in that User Product from
313
+a modified version of its Corresponding Source.  The information must
314
+suffice to ensure that the continued functioning of the modified object
315
+code is in no case prevented or interfered with solely because
316
+modification has been made.
317
+
318
+  If you convey an object code work under this section in, or with, or
319
+specifically for use in, a User Product, and the conveying occurs as
320
+part of a transaction in which the right of possession and use of the
321
+User Product is transferred to the recipient in perpetuity or for a
322
+fixed term (regardless of how the transaction is characterized), the
323
+Corresponding Source conveyed under this section must be accompanied
324
+by the Installation Information.  But this requirement does not apply
325
+if neither you nor any third party retains the ability to install
326
+modified object code on the User Product (for example, the work has
327
+been installed in ROM).
328
+
329
+  The requirement to provide Installation Information does not include a
330
+requirement to continue to provide support service, warranty, or updates
331
+for a work that has been modified or installed by the recipient, or for
332
+the User Product in which it has been modified or installed.  Access to a
333
+network may be denied when the modification itself materially and
334
+adversely affects the operation of the network or violates the rules and
335
+protocols for communication across the network.
336
+
337
+  Corresponding Source conveyed, and Installation Information provided,
338
+in accord with this section must be in a format that is publicly
339
+documented (and with an implementation available to the public in
340
+source code form), and must require no special password or key for
341
+unpacking, reading or copying.
342
+
343
+  7. Additional Terms.
344
+
345
+  "Additional permissions" are terms that supplement the terms of this
346
+License by making exceptions from one or more of its conditions.
347
+Additional permissions that are applicable to the entire Program shall
348
+be treated as though they were included in this License, to the extent
349
+that they are valid under applicable law.  If additional permissions
350
+apply only to part of the Program, that part may be used separately
351
+under those permissions, but the entire Program remains governed by
352
+this License without regard to the additional permissions.
353
+
354
+  When you convey a copy of a covered work, you may at your option
355
+remove any additional permissions from that copy, or from any part of
356
+it.  (Additional permissions may be written to require their own
357
+removal in certain cases when you modify the work.)  You may place
358
+additional permissions on material, added by you to a covered work,
359
+for which you have or can give appropriate copyright permission.
360
+
361
+  Notwithstanding any other provision of this License, for material you
362
+add to a covered work, you may (if authorized by the copyright holders of
363
+that material) supplement the terms of this License with terms:
364
+
365
+    a) Disclaiming warranty or limiting liability differently from the
366
+    terms of sections 15 and 16 of this License; or
367
+
368
+    b) Requiring preservation of specified reasonable legal notices or
369
+    author attributions in that material or in the Appropriate Legal
370
+    Notices displayed by works containing it; or
371
+
372
+    c) Prohibiting misrepresentation of the origin of that material, or
373
+    requiring that modified versions of such material be marked in
374
+    reasonable ways as different from the original version; or
375
+
376
+    d) Limiting the use for publicity purposes of names of licensors or
377
+    authors of the material; or
378
+
379
+    e) Declining to grant rights under trademark law for use of some
380
+    trade names, trademarks, or service marks; or
381
+
382
+    f) Requiring indemnification of licensors and authors of that
383
+    material by anyone who conveys the material (or modified versions of
384
+    it) with contractual assumptions of liability to the recipient, for
385
+    any liability that these contractual assumptions directly impose on
386
+    those licensors and authors.
387
+
388
+  All other non-permissive additional terms are considered "further
389
+restrictions" within the meaning of section 10.  If the Program as you
390
+received it, or any part of it, contains a notice stating that it is
391
+governed by this License along with a term that is a further
392
+restriction, you may remove that term.  If a license document contains
393
+a further restriction but permits relicensing or conveying under this
394
+License, you may add to a covered work material governed by the terms
395
+of that license document, provided that the further restriction does
396
+not survive such relicensing or conveying.
397
+
398
+  If you add terms to a covered work in accord with this section, you
399
+must place, in the relevant source files, a statement of the
400
+additional terms that apply to those files, or a notice indicating
401
+where to find the applicable terms.
402
+
403
+  Additional terms, permissive or non-permissive, may be stated in the
404
+form of a separately written license, or stated as exceptions;
405
+the above requirements apply either way.
406
+
407
+  8. Termination.
408
+
409
+  You may not propagate or modify a covered work except as expressly
410
+provided under this License.  Any attempt otherwise to propagate or
411
+modify it is void, and will automatically terminate your rights under
412
+this License (including any patent licenses granted under the third
413
+paragraph of section 11).
414
+
415
+  However, if you cease all violation of this License, then your
416
+license from a particular copyright holder is reinstated (a)
417
+provisionally, unless and until the copyright holder explicitly and
418
+finally terminates your license, and (b) permanently, if the copyright
419
+holder fails to notify you of the violation by some reasonable means
420
+prior to 60 days after the cessation.
421
+
422
+  Moreover, your license from a particular copyright holder is
423
+reinstated permanently if the copyright holder notifies you of the
424
+violation by some reasonable means, this is the first time you have
425
+received notice of violation of this License (for any work) from that
426
+copyright holder, and you cure the violation prior to 30 days after
427
+your receipt of the notice.
428
+
429
+  Termination of your rights under this section does not terminate the
430
+licenses of parties who have received copies or rights from you under
431
+this License.  If your rights have been terminated and not permanently
432
+reinstated, you do not qualify to receive new licenses for the same
433
+material under section 10.
434
+
435
+  9. Acceptance Not Required for Having Copies.
436
+
437
+  You are not required to accept this License in order to receive or
438
+run a copy of the Program.  Ancillary propagation of a covered work
439
+occurring solely as a consequence of using peer-to-peer transmission
440
+to receive a copy likewise does not require acceptance.  However,
441
+nothing other than this License grants you permission to propagate or
442
+modify any covered work.  These actions infringe copyright if you do
443
+not accept this License.  Therefore, by modifying or propagating a
444
+covered work, you indicate your acceptance of this License to do so.
445
+
446
+  10. Automatic Licensing of Downstream Recipients.
447
+
448
+  Each time you convey a covered work, the recipient automatically
449
+receives a license from the original licensors, to run, modify and
450
+propagate that work, subject to this License.  You are not responsible
451
+for enforcing compliance by third parties with this License.
452
+
453
+  An "entity transaction" is a transaction transferring control of an
454
+organization, or substantially all assets of one, or subdividing an
455
+organization, or merging organizations.  If propagation of a covered
456
+work results from an entity transaction, each party to that
457
+transaction who receives a copy of the work also receives whatever
458
+licenses to the work the party's predecessor in interest had or could
459
+give under the previous paragraph, plus a right to possession of the
460
+Corresponding Source of the work from the predecessor in interest, if
461
+the predecessor has it or can get it with reasonable efforts.
462
+
463
+  You may not impose any further restrictions on the exercise of the
464
+rights granted or affirmed under this License.  For example, you may
465
+not impose a license fee, royalty, or other charge for exercise of
466
+rights granted under this License, and you may not initiate litigation
467
+(including a cross-claim or counterclaim in a lawsuit) alleging that
468
+any patent claim is infringed by making, using, selling, offering for
469
+sale, or importing the Program or any portion of it.
470
+
471
+  11. Patents.
472
+
473
+  A "contributor" is a copyright holder who authorizes use under this
474
+License of the Program or a work on which the Program is based.  The
475
+work thus licensed is called the contributor's "contributor version".
476
+
477
+  A contributor's "essential patent claims" are all patent claims
478
+owned or controlled by the contributor, whether already acquired or
479
+hereafter acquired, that would be infringed by some manner, permitted
480
+by this License, of making, using, or selling its contributor version,
481
+but do not include claims that would be infringed only as a
482
+consequence of further modification of the contributor version.  For
483
+purposes of this definition, "control" includes the right to grant
484
+patent sublicenses in a manner consistent with the requirements of
485
+this License.
486
+
487
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+patent license under the contributor's essential patent claims, to
489
+make, use, sell, offer for sale, import and otherwise run, modify and
490
+propagate the contents of its contributor version.
491
+
492
+  In the following three paragraphs, a "patent license" is any express
493
+agreement or commitment, however denominated, not to enforce a patent
494
+(such as an express permission to practice a patent or covenant not to
495
+sue for patent infringement).  To "grant" such a patent license to a
496
+party means to make such an agreement or commitment not to enforce a
497
+patent against the party.
498
+
499
+  If you convey a covered work, knowingly relying on a patent license,
500
+and the Corresponding Source of the work is not available for anyone
501
+to copy, free of charge and under the terms of this License, through a
502
+publicly available network server or other readily accessible means,
503
+then you must either (1) cause the Corresponding Source to be so
504
+available, or (2) arrange to deprive yourself of the benefit of the
505
+patent license for this particular work, or (3) arrange, in a manner
506
+consistent with the requirements of this License, to extend the patent
507
+license to downstream recipients.  "Knowingly relying" means you have
508
+actual knowledge that, but for the patent license, your conveying the
509
+covered work in a country, or your recipient's use of the covered work
510
+in a country, would infringe one or more identifiable patents in that
511
+country that you have reason to believe are valid.
512
+
513
+  If, pursuant to or in connection with a single transaction or
514
+arrangement, you convey, or propagate by procuring conveyance of, a
515
+covered work, and grant a patent license to some of the parties
516
+receiving the covered work authorizing them to use, propagate, modify
517
+or convey a specific copy of the covered work, then the patent license
518
+you grant is automatically extended to all recipients of the covered
519
+work and works based on it.
520
+
521
+  A patent license is "discriminatory" if it does not include within
522
+the scope of its coverage, prohibits the exercise of, or is
523
+conditioned on the non-exercise of one or more of the rights that are
524
+specifically granted under this License.  You may not convey a covered
525
+work if you are a party to an arrangement with a third party that is
526
+in the business of distributing software, under which you make payment
527
+to the third party based on the extent of your activity of conveying
528
+the work, and under which the third party grants, to any of the
529
+parties who would receive the covered work from you, a discriminatory
530
+patent license (a) in connection with copies of the covered work
531
+conveyed by you (or copies made from those copies), or (b) primarily
532
+for and in connection with specific products or compilations that
533
+contain the covered work, unless you entered into that arrangement,
534
+or that patent license was granted, prior to 28 March 2007.
535
+
536
+  Nothing in this License shall be construed as excluding or limiting
537
+any implied license or other defenses to infringement that may
538
+otherwise be available to you under applicable patent law.
539
+
540
+  12. No Surrender of Others' Freedom.
541
+
542
+  If conditions are imposed on you (whether by court order, agreement or
543
+otherwise) that contradict the conditions of this License, they do not
544
+excuse you from the conditions of this License.  If you cannot convey a
545
+covered work so as to satisfy simultaneously your obligations under this
546
+License and any other pertinent obligations, then as a consequence you may
547
+not convey it at all.  For example, if you agree to terms that obligate you
548
+to collect a royalty for further conveying from those to whom you convey
549
+the Program, the only way you could satisfy both those terms and this
550
+License would be to refrain entirely from conveying the Program.
551
+
552
+  13. Use with the GNU Affero General Public License.
553
+
554
+  Notwithstanding any other provision of this License, you have
555
+permission to link or combine any covered work with a work licensed
556
+under version 3 of the GNU Affero General Public License into a single
557
+combined work, and to convey the resulting work.  The terms of this
558
+License will continue to apply to the part which is the covered work,
559
+but the special requirements of the GNU Affero General Public License,
560
+section 13, concerning interaction through a network will apply to the
561
+combination as such.
562
+
563
+  14. Revised Versions of this License.
564
+
565
+  The Free Software Foundation may publish revised and/or new versions of
566
+the GNU General Public License from time to time.  Such new versions will
567
+be similar in spirit to the present version, but may differ in detail to
568
+address new problems or concerns.
569
+
570
+  Each version is given a distinguishing version number.  If the
571
+Program specifies that a certain numbered version of the GNU General
572
+Public License "or any later version" applies to it, you have the
573
+option of following the terms and conditions either of that numbered
574
+version or of any later version published by the Free Software
575
+Foundation.  If the Program does not specify a version number of the
576
+GNU General Public License, you may choose any version ever published
577
+by the Free Software Foundation.
578
+
579
+  If the Program specifies that a proxy can decide which future
580
+versions of the GNU General Public License can be used, that proxy's
581
+public statement of acceptance of a version permanently authorizes you
582
+to choose that version for the Program.
583
+
584
+  Later license versions may give you additional or different
585
+permissions.  However, no additional obligations are imposed on any
586
+author or copyright holder as a result of your choosing to follow a
587
+later version.
588
+
589
+  15. Disclaimer of Warranty.
590
+
591
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+  16. Limitation of Liability.
601
+
602
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+SUCH DAMAGES.
611
+
612
+  17. Interpretation of Sections 15 and 16.
613
+
614
+  If the disclaimer of warranty and limitation of liability provided
615
+above cannot be given local legal effect according to their terms,
616
+reviewing courts shall apply local law that most closely approximates
617
+an absolute waiver of all civil liability in connection with the
618
+Program, unless a warranty or assumption of liability accompanies a
619
+copy of the Program in return for a fee.
620
+
621
+                     END OF TERMS AND CONDITIONS
622
+
623
+            How to Apply These Terms to Your New Programs
624
+
625
+  If you develop a new program, and you want it to be of the greatest
626
+possible use to the public, the best way to achieve this is to make it
627
+free software which everyone can redistribute and change under these terms.
628
+
629
+  To do so, attach the following notices to the program.  It is safest
630
+to attach them to the start of each source file to most effectively
631
+state the exclusion of warranty; and each file should have at least
632
+the "copyright" line and a pointer to where the full notice is found.
633
+
634
+    <one line to give the program's name and a brief idea of what it does.>
635
+    Copyright (C) <year>  <name of author>
636
+
637
+    This program is free software: you can redistribute it and/or modify
638
+    it under the terms of the GNU General Public License as published by
639
+    the Free Software Foundation, either version 3 of the License, or
640
+    (at your option) any later version.
641
+
642
+    This program is distributed in the hope that it will be useful,
643
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
645
+    GNU General Public License for more details.
646
+
647
+    You should have received a copy of the GNU General Public License
648
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
649
+
650
+Also add information on how to contact you by electronic and paper mail.
651
+
652
+  If the program does terminal interaction, make it output a short
653
+notice like this when it starts in an interactive mode:
654
+
655
+    <program>  Copyright (C) <year>  <name of author>
656
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+    This is free software, and you are welcome to redistribute it
658
+    under certain conditions; type `show c' for details.
659
+
660
+The hypothetical commands `show w' and `show c' should show the appropriate
661
+parts of the General Public License.  Of course, your program's commands
662
+might be different; for a GUI interface, you would use an "about box".
663
+
664
+  You should also get your employer (if you work as a programmer) or school,
665
+if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+For more information on this, and how to apply and follow the GNU GPL, see
667
+<https://www.gnu.org/licenses/>.
668
+
669
+  The GNU General Public License does not permit incorporating your program
670
+into proprietary programs.  If your program is a subroutine library, you
671
+may consider it more useful to permit linking proprietary applications with
672
+the library.  If this is what you want to do, use the GNU Lesser General
673
+Public License instead of this License.  But first, please read
674
+<https://www.gnu.org/licenses/why-not-lgpl.html>.

+ 10
- 0
README.md View File

1
+# TDDC17AICourse
2
+Sharing of my labs carried out during the TDDC17 course at Linköping University (HT 2020).
3
+
4
+## Lab 4
5
+Commands used in lab 4 to use planner algorithms:
6
+```bash
7
+$ ipp -o task1_domain.pddl -f task1_pb1.pddl
8
+$ ff -o task1_domain.pddl -f task1_pb1.pddl
9
+$ lama task1_domain.pddl task1_pb1.pddl
10
+```

+ 434
- 0
lab1/myvacuumagent.py View File

1
+from lab1.liuvacuum import *
2
+
3
+DEBUG_OPT_DENSEWORLDMAP = False
4
+
5
+AGENT_STATE_UNKNOWN = 0
6
+AGENT_STATE_WALL = 1
7
+AGENT_STATE_CLEAR = 2
8
+AGENT_STATE_DIRT = 3
9
+AGENT_STATE_HOME = 4
10
+
11
+AGENT_DIRECTION_NORTH = 0
12
+AGENT_DIRECTION_EAST = 1
13
+AGENT_DIRECTION_SOUTH = 2
14
+AGENT_DIRECTION_WEST = 3
15
+
16
+def direction_to_string(cdr):
17
+    cdr %= 4
18
+    return  "NORTH" if cdr == AGENT_DIRECTION_NORTH else\
19
+            "EAST"  if cdr == AGENT_DIRECTION_EAST else\
20
+            "SOUTH" if cdr == AGENT_DIRECTION_SOUTH else\
21
+            "WEST" #if dir == AGENT_DIRECTION_WEST
22
+
23
+"""
24
+Internal state of a vacuum agent
25
+"""
26
+class MyAgentState:
27
+
28
+    def __init__(self, width, height):
29
+
30
+        # Initialize perceived world state
31
+        self.world = [[AGENT_STATE_UNKNOWN for _ in range(height)] for _ in range(width)]
32
+        self.world[1][1] = AGENT_STATE_HOME
33
+
34
+        # Agent internal state
35
+        self.last_action = ACTION_NOP
36
+        self.direction = AGENT_DIRECTION_EAST
37
+        self.pos_x = 1
38
+        self.pos_y = 1
39
+
40
+        # Metadata
41
+        self.world_width = width
42
+        self.world_height = height
43
+
44
+    """
45
+    Update perceived agent location and orientation
46
+    """
47
+    def update_position(self, bump):
48
+        if not bump and self.last_action == ACTION_FORWARD:
49
+            if self.direction == AGENT_DIRECTION_EAST:
50
+                self.pos_x += 1
51
+            elif self.direction == AGENT_DIRECTION_SOUTH:
52
+                self.pos_y += 1
53
+            elif self.direction == AGENT_DIRECTION_WEST:
54
+                self.pos_x -= 1
55
+            elif self.direction == AGENT_DIRECTION_NORTH:
56
+                self.pos_y -= 1
57
+        elif self.last_action == ACTION_TURN_LEFT:
58
+            if self.direction == AGENT_DIRECTION_EAST:
59
+                self.direction = AGENT_DIRECTION_NORTH
60
+            elif self.direction == AGENT_DIRECTION_SOUTH:
61
+                self.direction = AGENT_DIRECTION_EAST
62
+            elif self.direction == AGENT_DIRECTION_WEST:
63
+                self.direction = AGENT_DIRECTION_SOUTH
64
+            elif self.direction == AGENT_DIRECTION_NORTH:
65
+                self.direction = AGENT_DIRECTION_WEST
66
+        elif self.last_action == ACTION_TURN_RIGHT:
67
+            if self.direction == AGENT_DIRECTION_EAST:
68
+                self.direction = AGENT_DIRECTION_SOUTH
69
+            elif self.direction == AGENT_DIRECTION_SOUTH:
70
+                self.direction = AGENT_DIRECTION_WEST
71
+            elif self.direction == AGENT_DIRECTION_WEST:
72
+                self.direction = AGENT_DIRECTION_NORTH
73
+            elif self.direction == AGENT_DIRECTION_NORTH:
74
+                self.direction = AGENT_DIRECTION_EAST
75
+
76
+    """
77
+    Update perceived or inferred information about a part of the world
78
+    """
79
+    def update_world(self, x, y, info):
80
+        self.world[x][y] = info
81
+
82
+    """
83
+    Dumps a map of the world as the agent knows it
84
+    """
85
+    def print_world_debug(self):
86
+        for y in range(self.world_height):
87
+            for x in range(self.world_width):
88
+                if self.world[x][y] == AGENT_STATE_UNKNOWN:
89
+                    print("?" if DEBUG_OPT_DENSEWORLDMAP else " ? ", end="")
90
+                elif self.world[x][y] == AGENT_STATE_WALL:
91
+                    print("#" if DEBUG_OPT_DENSEWORLDMAP else " # ", end="")
92
+                elif self.world[x][y] == AGENT_STATE_CLEAR:
93
+                    print("." if DEBUG_OPT_DENSEWORLDMAP else " . ", end="")
94
+                elif self.world[x][y] == AGENT_STATE_DIRT:
95
+                    print("D" if DEBUG_OPT_DENSEWORLDMAP else " D ", end="")
96
+                elif self.world[x][y] == AGENT_STATE_HOME:
97
+                    print("H" if DEBUG_OPT_DENSEWORLDMAP else " H ", end="")
98
+
99
+            print() # Newline
100
+        print() # Delimiter post-print
101
+
102
+"""
103
+Vacuum agent
104
+"""
105
+class MyVacuumAgent(Agent):
106
+    """
107
+    Init function, everything here is execute once at the beginning
108
+    """
109
+    def __init__(self, world_width, world_height, log):
110
+        super().__init__(self.execute)
111
+        self.initial_random_actions = 10
112
+        self.iteration_counter = 1000
113
+        self.state = MyAgentState(world_width, world_height)
114
+        self.log = log
115
+
116
+        # Arrived variable for the goto function
117
+        self.arrived = True
118
+        # Arrived variable for the go_to_with_pathfinder function
119
+        self.arrived_destination = True
120
+        # If the agent has finished the cleaning
121
+        self.finished = False
122
+
123
+        # Goto coordinates for the goto function
124
+        self.goto_x = 1
125
+        self.goto_y = 1
126
+
127
+        # Goto coordinates for the go_to_with_pathfinder function
128
+        self.destination_x = 1
129
+        self.destination_y = 1
130
+
131
+        # If we need to re-calculate our destination
132
+        self.reset_destination = True
133
+
134
+        # Different list in agent memory
135
+        self.waypoint = []                  # Memory for next waypoint coordinates
136
+        self.slist = []                     # List of waypoint to go at the agent destination
137
+
138
+        # At the beginning, we assume that the zone is surrounded by wall
139
+        for i in range(0, world_width):
140
+            self.state.update_world(i, 0, AGENT_STATE_WALL)
141
+            self.state.update_world(i, world_height - 1, AGENT_STATE_WALL)
142
+        for j in range(1, world_height - 1):
143
+            self.state.update_world(0, j, AGENT_STATE_WALL)
144
+            self.state.update_world(world_width - 1, j, AGENT_STATE_WALL)
145
+
146
+    """
147
+    Function which move the agent to a ramdom start position
148
+    """
149
+    def move_to_random_start_position(self, bump):
150
+        action = random()
151
+
152
+        self.initial_random_actions -= 1
153
+        self.state.update_position(bump)
154
+        self.log("Actual direction: " + direction_to_string(self.state.direction))
155
+
156
+        if action < 0.1666666:   # 1/6 chance
157
+            self.state.last_action = ACTION_TURN_LEFT
158
+            return ACTION_TURN_LEFT
159
+        elif action < 0.3333333: # 1/6 chance
160
+            self.state.last_action = ACTION_TURN_RIGHT
161
+            return ACTION_TURN_RIGHT
162
+        else:                    # 4/6 chance
163
+            self.state.last_action = ACTION_FORWARD
164
+            return ACTION_FORWARD
165
+
166
+    """
167
+    A basic "go to" function which does not consider wall
168
+    """
169
+    def goto(self, bump, dirt):
170
+        self.state.update_position(bump)
171
+        self.log("Actual direction: " + direction_to_string(self.state.direction))
172
+        self.log("Next waypoint: {}, {}".format(self.goto_x, self.goto_y))
173
+
174
+        if dirt:
175
+            self.state.update_world(self.state.pos_x, self.state.pos_y, AGENT_STATE_DIRT)
176
+            self.log("DIRT -> choosing SUCK action!")
177
+            self.state.last_action = ACTION_SUCK
178
+            return ACTION_SUCK
179
+        else:
180
+            self.state.update_world(self.state.pos_x, self.state.pos_y, AGENT_STATE_CLEAR)
181
+
182
+        if (self.goto_x == self.state.pos_x and self.goto_y == self.state.pos_y) or bump:
183
+            self.arrived = True
184
+            self.log("Arrived to the target point")
185
+            self.state.last_action = ACTION_NOP
186
+            return ACTION_NOP
187
+
188
+        if abs(self.state.pos_x - self.goto_x) >= abs(self.state.pos_y - self.goto_y):
189
+            if self.state.pos_x - self.goto_x > 0:          # Need to go WEST
190
+                if self.state.direction == AGENT_DIRECTION_WEST:
191
+                    return ACTION_FORWARD
192
+                elif self.state.direction == AGENT_DIRECTION_SOUTH:
193
+                    return ACTION_TURN_RIGHT
194
+                else:
195
+                    return ACTION_TURN_LEFT
196
+            else:                                           # Need to go EAST
197
+                if self.state.direction == AGENT_DIRECTION_EAST:
198
+                    return ACTION_FORWARD
199
+                elif self.state.direction == AGENT_DIRECTION_NORTH:
200
+                    return ACTION_TURN_RIGHT
201
+                else:
202
+                    return ACTION_TURN_LEFT
203
+        else:
204
+            if self.state.pos_y - self.goto_y > 0:          # Need to go NORTH
205
+                if self.state.direction == AGENT_DIRECTION_NORTH:
206
+                    return ACTION_FORWARD
207
+                elif self.state.direction == AGENT_DIRECTION_WEST:
208
+                    return ACTION_TURN_RIGHT
209
+                else:
210
+                    return ACTION_TURN_LEFT
211
+            else:                                           # Need to go SOUTH
212
+                if self.state.direction == AGENT_DIRECTION_SOUTH:
213
+                    return ACTION_FORWARD
214
+                elif self.state.direction == AGENT_DIRECTION_EAST:
215
+                    return ACTION_TURN_RIGHT
216
+                else:
217
+                    return ACTION_TURN_LEFT
218
+
219
+    """
220
+    A pathfinding algorithm, based on the BFS algorithm
221
+    """
222
+    def pathfinding(self, target_x, target_y):
223
+
224
+        # Class for node used in the search
225
+        class Node:
226
+            def __init__(self, parent=None, x=-1, y=-1):
227
+                self.x = x
228
+                self.y = y
229
+                self.parent = parent
230
+
231
+            def __eq__(self, other):
232
+                return self.x == other.x and self.y == other.y
233
+
234
+        # Start and end nodes
235
+        start = Node(None, self.state.pos_x, self.state.pos_y)
236
+        end = Node(None, target_x, target_y)
237
+
238
+        # List containing the nodes to explore (By order of priority)
239
+        queue = [start]
240
+        # List of explored nodes
241
+        explored = []
242
+        # List which will be returned by the program containing
243
+        # the coordinates to follow to reach the targeted point
244
+        slist = []
245
+
246
+        # While there is node to explore
247
+        while queue:
248
+            # If the queue is to big, we assume that there is a problem
249
+            if len(queue) > 200:
250
+                break
251
+
252
+            # We take the first node in the queue
253
+            node = queue.pop(0)
254
+            # If it is the destination
255
+            if node == end:
256
+                print("Trying to go at : {}; {}".format(target_x, target_y))
257
+                print("Solution found : ")
258
+                n = node
259
+                # We return the path found
260
+                while n.parent:
261
+                    print("x: {}, y: {}".format(n.x, n.y))
262
+                    slist.append([n.x, n.y])
263
+                    n = n.parent
264
+                # and stop the processing
265
+                break
266
+
267
+            # If we never explored this node
268
+            elif node not in explored:
269
+                explored.append(node)
270
+
271
+                # For each adjacent node, if it is not a wall,
272
+                # we add it to the queue
273
+                if self.state.world[node.x - 1][node.y] != AGENT_STATE_WALL:
274
+                    queue.append(Node(node, node.x-1, node.y))
275
+                if self.state.world[node.x + 1][node.y] != AGENT_STATE_WALL:
276
+                    queue.append(Node(node, node.x+1, node.y))
277
+                if self.state.world[node.x][node.y - 1] != AGENT_STATE_WALL:
278
+                    queue.append(Node(node, node.x, node.y - 1))
279
+                if self.state.world[node.x][node.y + 1] != AGENT_STATE_WALL:
280
+                    queue.append(Node(node, node.x, node.y+1))
281
+
282
+        # If we don't find any solution
283
+        if not slist:
284
+            # We consider that the place in inaccessible
285
+            self.state.update_world(end.x, end.y, AGENT_STATE_WALL)
286
+            self.log("Find a inaccessible place, marking as a wall ##")
287
+            print("Overload! Inaccessible place!")
288
+        return slist
289
+
290
+    """
291
+    A "go to" function which implement the pathfinding algorithm using the goto function
292
+    """
293
+    def go_to_with_pathfinder(self, bump, dirt):
294
+        # If we start or if we need to reset the path
295
+        if self.reset_destination:
296
+            print("Launching the pathfinding algorithm.")
297
+            self.slist = self.pathfinding(self.destination_x, self.destination_y)
298
+
299
+        # If we have a path, we follow it
300
+        if self.slist:
301
+            # If the agent move correctly the previous time
302
+            if not bump:
303
+                self.waypoint = self.slist.pop()
304
+            self.goto_x = self.waypoint[0]
305
+            self.goto_y = self.waypoint[1]
306
+            self.arrived = False
307
+            action = self.goto(bump, dirt)
308
+            self.state.last_action = action
309
+            self.reset_destination = False
310
+            return action
311
+        # else (whether we arrived or we don't find a path), we assume
312
+        # that we will not go further
313
+        else:
314
+            self.reset_destination = True
315
+            self.arrived_destination = True
316
+            self.state.last_action = ACTION_NOP
317
+            return ACTION_NOP
318
+        pass
319
+
320
+    """
321
+    The execute function, which is call at each turn
322
+    """
323
+    def execute(self, percept):
324
+
325
+        # If the agent has finished, we do nothing
326
+        if self.finished:
327
+            return ACTION_NOP
328
+
329
+        ###########################
330
+        # DO NOT MODIFY THIS CODE #
331
+        ###########################
332
+
333
+        bump = percept.attributes["bump"]
334
+        dirt = percept.attributes["dirt"]
335
+        home = percept.attributes["home"]
336
+
337
+        # Move agent to a randomly chosen initial position
338
+        if self.initial_random_actions > 0:
339
+            self.log("Moving to random start position ({} steps left)".format(self.initial_random_actions))
340
+            return self.move_to_random_start_position(bump)
341
+
342
+        # Finalize randomization by properly updating position (without subsequently changing it)
343
+        elif self.initial_random_actions == 0:
344
+            self.initial_random_actions -= 1
345
+            self.state.update_position(bump)
346
+            self.state.last_action = ACTION_SUCK
347
+            self.log("Processing percepts after position randomization")
348
+            return ACTION_SUCK
349
+
350
+        ########################
351
+        # START MODIFYING HERE #
352
+        ########################
353
+
354
+        # Logging position and orientation
355
+        self.log("Position: ({}, {})\t\tDirection: {}".format(self.state.pos_x, self.state.pos_y,
356
+                                                              direction_to_string(self.state.direction)))
357
+
358
+        if bump:
359
+            # Not arrived, but this way we force our agent to re-calculate its path
360
+            self.arrived = True
361
+            self.reset_destination = True
362
+            # Get an xy-offset pair based on where the agent is facing
363
+            offset = [(0, -1), (1, 0), (0, 1), (-1, 0)][self.state.direction]
364
+
365
+            # Mark the tile at the offset from the agent as a wall (since the agent bumped into it)
366
+            self.state.update_world(self.state.pos_x + offset[0], self.state.pos_y + offset[1], AGENT_STATE_WALL)
367
+
368
+        # While we aren't arrived, we refer to the goto function
369
+        if not self.arrived:
370
+            action = self.goto(bump, dirt)
371
+            self.state.last_action = action
372
+            return action
373
+        # While we aren't arrived, we refer to the go_to_with_pathfinder function
374
+        elif not self.arrived_destination:
375
+            return self.go_to_with_pathfinder(bump, dirt)
376
+
377
+        # Max iterations for the agent
378
+        if self.iteration_counter < 1:
379
+            if self.iteration_counter == 0:
380
+                self.iteration_counter -= 1
381
+                self.log("Iteration counter is now 0. Halting!")
382
+                self.log("Performance: {}".format(self.performance))
383
+            return ACTION_NOP
384
+        self.iteration_counter -= 1
385
+
386
+        # Track position of agent
387
+        self.state.update_position(bump)
388
+
389
+        # Update perceived state of current tile
390
+        if dirt:
391
+            self.state.update_world(self.state.pos_x, self.state.pos_y, AGENT_STATE_DIRT)
392
+        else:
393
+            self.state.update_world(self.state.pos_x, self.state.pos_y, AGENT_STATE_CLEAR)
394
+
395
+        # Debug
396
+        self.state.print_world_debug()
397
+
398
+        # Variables used to determine the closest unknown place
399
+        closest_unk_range = self.state.world_height + self.state.world_width + 1
400
+        closest_x = 1
401
+        closest_y = 1
402
+        find_new = False
403
+
404
+        # Determination of the nearest unknown location
405
+        for i in range(self.state.world_width):
406
+            for j in range(self.state.world_height):
407
+                if self.state.world[i][j] == AGENT_STATE_UNKNOWN and (
408
+                        abs(self.state.pos_x - i) + abs(self.state.pos_y - j)) < closest_unk_range:
409
+                    find_new = True
410
+                    closest_unk_range = (abs(self.state.pos_x - i) + abs(self.state.pos_y - j))
411
+                    closest_x = i
412
+                    closest_y = j
413
+
414
+        # If we find a new place to go
415
+        if find_new:
416
+            self.log("Going to unknown places : ({};{})".format(closest_x, closest_y))
417
+            self.destination_x = closest_x
418
+            self.destination_y = closest_y
419
+            return self.go_to_with_pathfinder(bump, dirt)
420
+        # If not, we have finished, we go home
421
+        if home:
422
+            self.log("Finished !")
423
+            self.log("Performance: {}".format(self.performance))
424
+            self.finished = True
425
+        # Finally we are at home
426
+        else:
427
+            self.log("Job done, going back home.")
428
+            self.destination_x = 1
429
+            self.destination_y = 1
430
+            return self.go_to_with_pathfinder(bump, dirt)
431
+
432
+        # Useless
433
+        self.state.last_action = ACTION_NOP
434
+        return ACTION_NOP

+ 9
- 0
lab2/CustomBreadthFirstSearch.java View File

1
+package searchCustom;
2
+
3
+public class CustomBreadthFirstSearch  extends CustomGraphSearch{
4
+
5
+	public   CustomBreadthFirstSearch(int maxDepth){
6
+		super(false);
7
+		//System.out.println("Change line above in \"CustomBreadthFirstSearch.java\"! --> done.");
8
+	}
9
+};

+ 8
- 0
lab2/CustomDepthFirstSearch.java View File

1
+package searchCustom;
2
+
3
+public class CustomDepthFirstSearch extends CustomGraphSearch{
4
+	public CustomDepthFirstSearch(int maxDepth){
5
+		super(true);
6
+		//System.out.println("Change line above in \"CustomDepthFirstSearch.java\"! --> done.");
7
+	}
8
+};

+ 141
- 0
lab2/CustomGraphSearch.java View File

1
+package searchCustom;
2
+
3
+import java.util.ArrayList;
4
+import java.util.HashSet;
5
+
6
+import searchShared.NodeQueue;
7
+import searchShared.Problem;
8
+import searchShared.SearchObject;
9
+import searchShared.SearchNode;
10
+
11
+import world.GridPos;
12
+
13
+public class CustomGraphSearch implements SearchObject {
14
+
15
+	private HashSet<SearchNode> explored;
16
+	private NodeQueue frontier;
17
+	protected ArrayList<SearchNode> path;
18
+	private boolean insertFront;
19
+
20
+	/**
21
+	 * The constructor tells graph search whether it should insert nodes to front or back of the frontier 
22
+	 */
23
+    public CustomGraphSearch(boolean bInsertFront) {
24
+		insertFront = bInsertFront;
25
+    }
26
+
27
+	/**
28
+	 * Implements "graph search", which is the foundation of many search algorithms
29
+	 */
30
+	public ArrayList<SearchNode> search(Problem problem) {
31
+		// The frontier is a queue of expanded SearchNodes not processed yet
32
+		frontier = new NodeQueue();
33
+		// The explored set is a set of nodes that have been processed 
34
+		explored = new HashSet<SearchNode>();
35
+		// The start state is given
36
+		GridPos startState = (GridPos) problem.getInitialState();
37
+		// Initialise the frontier with the start state  
38
+		frontier.addNodeToFront(new SearchNode(startState));
39
+
40
+		// Path will be empty until we find the goal.
41
+		path = new ArrayList<SearchNode>();
42
+		
43
+		
44
+		/*
45
+		 * Note on how java and this program work:
46
+		 *  -ArrayList are just resizable array. "<>" contains the type of the listed objects
47
+		 *  -Structures :
48
+		 *  	while (boolean) {}
49
+		 *  	while (a > 0) {}
50
+		 *  	for (int i = 0; i < 5; i++){}		--> 5 iterations
51
+		 *  	for (String i : StringList){}		--> Iterations on all the objects in the list
52
+		 *  -Class used here:
53
+		 *  	-SearchNode					--> Equivalent of the "Node" class in the Python program. Represent a node.
54
+		 *  	-Problem 					--> Class containing lot of informations on the problem
55
+		 *  									like the reachable states from a position, the start, the end
56
+		 *  	-GridPos 					--> represent a position (with x and y coordinates)  	
57
+		 */
58
+		
59
+		
60
+		// While we have something to explore
61
+		while (frontier.size() > 0) {
62
+			// Get the first node on the list
63
+			SearchNode Node = frontier.removeFirst();
64
+			
65
+			// We check if it is our destination
66
+			if (problem.isGoalState(Node.getState())) {
67
+				return path = Node.getPathFromRoot();
68
+			} // if not, we continue
69
+			
70
+			// Get the list of children of the current node
71
+			ArrayList<GridPos> childPosition = problem.getReachableStatesFrom(Node.getState());
72
+			// For every child in the list
73
+			for (GridPos position : childPosition) {
74
+				// Creating a new node
75
+				SearchNode childNode = new SearchNode(position, Node);
76
+				// If we have not explored the node
77
+				if (explored.contains(childNode) == false) {
78
+					// Adding the child node to the frontier
79
+					// Front --> DFS (LIFO queue)
80
+					// Back --> BFS (FIFO queue)
81
+					if (insertFront) {
82
+						frontier.addNodeToFront(childNode);
83
+					}
84
+					else {
85
+						frontier.addNodeToBack(childNode);
86
+					}
87
+					// We add the node to explored node
88
+					explored.add(childNode);
89
+				}
90
+			}
91
+		}
92
+		
93
+		
94
+		/* Some hints:
95
+		 * -Read early part of chapter 3 in the book!
96
+		 * -You are free to change anything how you wish as long as the program runs, but some structure is given to help you.
97
+		 * -You can Google for "javadoc <class>" if you are uncertain of what you can do with a particular Java type.
98
+		 * 
99
+		 * -SearchNodes are the nodes of the search tree and contains the relevant problem state, in this case x,y position (GridPos) of the agent 
100
+		 * --You can create a new search node from a state by: SearchNode childNode = new SearchNode(childState, currentNode);
101
+		 * --You can also extract the state by .getState() method
102
+		 * --All search structures use search nodes, but the problem object only speaks in state, so you may need to convert between them 
103
+		 * 
104
+		 * -The frontier is a queue of search nodes, open this class to find out what you can do with it! 
105
+		 * 
106
+		 * -If you are unfamiliar with Java, the "HashSet<SearchNode>" used for the explored set means a set of SearchNode objects.
107
+		 * --You can add nodes to the explored set, or check if it contains a node!
108
+		 * 
109
+		 * -To get the child states (adjacent grid positions that are not walls) of a particular search node, do: ArrayList<GridPos> childStates = p.getReachableStatesFrom(currentState);
110
+		 * 
111
+		 * -Depending on the addNodesToFront boolean variable, you may need to do something with the frontier... (see book)
112
+		 * 
113
+		 * -You can check if you have reached the goal with p.isGoalState(NodeState)
114
+		 * 
115
+		 *  When the goal is found, the path to be returned can be found by: path = node.getPathFromRoot();
116
+		 */
117
+		/* Note: Returning an empty path signals that no path exists */
118
+		return path;
119
+	}
120
+
121
+	/*
122
+	 * Functions below are just getters used externally by the program 
123
+	 */
124
+	public ArrayList<SearchNode> getPath() {
125
+		return path;
126
+	}
127
+
128
+	public ArrayList<SearchNode> getFrontierNodes() {
129
+		return new ArrayList<SearchNode>(frontier.toList());
130
+	}
131
+	public ArrayList<SearchNode> getExploredNodes() {
132
+		return new ArrayList<SearchNode>(explored);
133
+	}
134
+	public ArrayList<SearchNode> getAllExpandedNodes() {
135
+		ArrayList<SearchNode> allNodes = new ArrayList<SearchNode>();
136
+		allNodes.addAll(getFrontierNodes());
137
+		allNodes.addAll(getExploredNodes());
138
+		return allNodes;
139
+	}
140
+
141
+}

+ 20
- 0
lab3/bayes.jnlp View File

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<jnlp spec="1.0+"
3
+  codebase="http://www.aispace.org/"
4
+>
5
+<information>
6
+  <title>Belief and Decision Networks</title>
7
+  <vendor>AIspace</vendor>
8
+  <homepage href="www.aispace.org" />
9
+</information>
10
+<offline-allowed/>
11
+<security>
12
+  <all-permissions/>
13
+</security>
14
+<resources>
15
+  <j2se version="1.5+" />
16
+  <jar href="bayes/bayes.jar"/>
17
+</resources>
18
+<application-desc />
19
+</jnlp>
20
+

+ 263
- 0
lab3/lab3_Mr_HS_v2.xml View File

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<BIF VERSION="0.3"  xmlns="http://www.cs.ubc.ca/labs/lci/fopi/ve/XMLBIFv0_3"
3
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+	xsi:schemaLocation="http://www.cs.ubc.ca/labs/lci/fopi/ve/XMLBIFv0_3 http://www.cs.ubc.ca/labs/lci/fopi/ve/XMLBIFv0_3/XMLBIFv0_3.xsd">
5
+<NETWORK>
6
+<NAME>Nuclear Power Station</NAME>
7
+<PROPERTY>detailed = </PROPERTY>
8
+<PROPERTY>short = </PROPERTY>
9
+
10
+<VARIABLE TYPE="nature">
11
+	<NAME>WaterLeak</NAME>
12
+	<OUTCOME>T</OUTCOME>
13
+	<OUTCOME>F</OUTCOME>
14
+	<PROPERTY>position = (7367.91845703125, 5357.0380859375)</PROPERTY>
15
+</VARIABLE>
16
+
17
+<VARIABLE TYPE="nature">
18
+	<NAME>WaterLeakWarning</NAME>
19
+	<OUTCOME>T</OUTCOME>
20
+	<OUTCOME>F</OUTCOME>
21
+	<PROPERTY>position = (7195.8505859375, 5497.32470703125)</PROPERTY>
22
+</VARIABLE>
23
+
24
+<VARIABLE TYPE="nature">
25
+	<NAME>IcyWeather</NAME>
26
+	<OUTCOME>T</OUTCOME>
27
+	<OUTCOME>F</OUTCOME>
28
+	<PROPERTY>position = (7565.81103515625, 5097.51025390625)</PROPERTY>
29
+</VARIABLE>
30
+
31
+<VARIABLE TYPE="nature">
32
+	<NAME>PumpFailure</NAME>
33
+	<OUTCOME>T</OUTCOME>
34
+	<OUTCOME>F</OUTCOME>
35
+	<PROPERTY>position = (7121.32080078125, 5349.66455078125)</PROPERTY>
36
+</VARIABLE>
37
+
38
+<VARIABLE TYPE="nature">
39
+	<NAME>PumpFailureWarning</NAME>
40
+	<OUTCOME>T</OUTCOME>
41
+	<OUTCOME>F</OUTCOME>
42
+	<PROPERTY>position = (6830.72802734375, 5504.23828125)</PROPERTY>
43
+</VARIABLE>
44
+
45
+<VARIABLE TYPE="nature">
46
+	<NAME>Meltdown</NAME>
47
+	<OUTCOME>T</OUTCOME>
48
+	<OUTCOME>F</OUTCOME>
49
+	<PROPERTY>position = (7467.087890625, 5603.3173828125)</PROPERTY>
50
+</VARIABLE>
51
+
52
+<VARIABLE TYPE="nature">
53
+	<NAME>Battery</NAME>
54
+	<OUTCOME>T</OUTCOME>
55
+	<OUTCOME>F</OUTCOME>
56
+	<PROPERTY>position = (7761.697265625, 5233.7236328125)</PROPERTY>
57
+</VARIABLE>
58
+
59
+<VARIABLE TYPE="nature">
60
+	<NAME>Radio</NAME>
61
+	<OUTCOME>T</OUTCOME>
62
+	<OUTCOME>F</OUTCOME>
63
+	<PROPERTY>position = (7667.05322265625, 5364.93359375)</PROPERTY>
64
+</VARIABLE>
65
+
66
+<VARIABLE TYPE="nature">
67
+	<NAME>Ignition</NAME>
68
+	<OUTCOME>T</OUTCOME>
69
+	<OUTCOME>F</OUTCOME>
70
+	<PROPERTY>position = (7914.4169921875, 5364.93359375)</PROPERTY>
71
+</VARIABLE>
72
+
73
+<VARIABLE TYPE="nature">
74
+	<NAME>Gas</NAME>
75
+	<OUTCOME>T</OUTCOME>
76
+	<OUTCOME>F</OUTCOME>
77
+	<PROPERTY>position = (8158.5546875, 5373.53759765625)</PROPERTY>
78
+</VARIABLE>
79
+
80
+<VARIABLE TYPE="nature">
81
+	<NAME>Start</NAME>
82
+	<OUTCOME>T</OUTCOME>
83
+	<OUTCOME>F</OUTCOME>
84
+	<PROPERTY>position = (8051.0048828125, 5523.03076171875)</PROPERTY>
85
+</VARIABLE>
86
+
87
+<VARIABLE TYPE="nature">
88
+	<NAME>Moves</NAME>
89
+	<OUTCOME>T</OUTCOME>
90
+	<OUTCOME>F</OUTCOME>
91
+	<PROPERTY>position = (8051.0048828125, 5678.9775390625)</PROPERTY>
92
+</VARIABLE>
93
+
94
+<VARIABLE TYPE="nature">
95
+	<NAME>Survives</NAME>
96
+	<OUTCOME>T</OUTCOME>
97
+	<OUTCOME>F</OUTCOME>
98
+	<PROPERTY>position = (7638.01513671875, 5822.0185546875)</PROPERTY>
99
+</VARIABLE>
100
+
101
+<VARIABLE TYPE="nature">
102
+	<NAME>Bicycle_works</NAME>
103
+	<OUTCOME>T</OUTCOME>
104
+	<OUTCOME>F</OUTCOME>
105
+	<PROPERTY>position = (7636.93896484375, 5681.12890625)</PROPERTY>
106
+</VARIABLE>
107
+
108
+<VARIABLE TYPE="nature">
109
+	<NAME>HS_is_awake</NAME>
110
+	<OUTCOME>T</OUTCOME>
111
+	<OUTCOME>F</OUTCOME>
112
+	<OBS>F</OBS>
113
+	<PROPERTY>position = (7004.9658203125, 5804.48974609375)</PROPERTY>
114
+</VARIABLE>
115
+
116
+<VARIABLE TYPE="nature">
117
+	<NAME>HS_do_something_not_stupid</NAME>
118
+	<OUTCOME>T</OUTCOME>
119
+	<OUTCOME>F</OUTCOME>
120
+	<PROPERTY>position = (7317.30908203125, 5806.892578125)</PROPERTY>
121
+</VARIABLE>
122
+
123
+<VARIABLE TYPE="nature">
124
+	<NAME>HS_remark_irregularity</NAME>
125
+	<OUTCOME>T</OUTCOME>
126
+	<OUTCOME>F</OUTCOME>
127
+	<PROPERTY>position = (7008.78662109375, 5680.53564453125)</PROPERTY>
128
+</VARIABLE>
129
+
130
+<VARIABLE TYPE="nature">
131
+	<NAME>Pay_day</NAME>
132
+	<OUTCOME>T</OUTCOME>
133
+	<OUTCOME>F</OUTCOME>
134
+	<PROPERTY>position = (6790.44482421875, 5682.78271484375)</PROPERTY>
135
+</VARIABLE>
136
+
137
+<VARIABLE TYPE="nature">
138
+	<NAME>Warning(s)?</NAME>
139
+	<OUTCOME>T</OUTCOME>
140
+	<OUTCOME>F</OUTCOME>
141
+	<OBS>T</OBS>
142
+	<PROPERTY>position = (7014.93408203125, 5581.3759765625)</PROPERTY>
143
+</VARIABLE>
144
+
145
+<DEFINITION>
146
+	<FOR>WaterLeak</FOR>
147
+	<GIVEN>IcyWeather</GIVEN>
148
+	<TABLE>0.2 0.8 0.1 0.9</TABLE>
149
+</DEFINITION>
150
+
151
+<DEFINITION>
152
+	<FOR>WaterLeakWarning</FOR>
153
+	<GIVEN>WaterLeak</GIVEN>
154
+	<TABLE>0.9 0.1 0.05 0.95</TABLE>
155
+</DEFINITION>
156
+
157
+<DEFINITION>
158
+	<FOR>IcyWeather</FOR>
159
+	<TABLE>0.05 0.95</TABLE>
160
+</DEFINITION>
161
+
162
+<DEFINITION>
163
+	<FOR>PumpFailure</FOR>
164
+	<TABLE>0.1 0.9</TABLE>
165
+</DEFINITION>
166
+
167
+<DEFINITION>
168
+	<FOR>PumpFailureWarning</FOR>
169
+	<GIVEN>PumpFailure</GIVEN>
170
+	<TABLE>0.9 0.1 0.05 0.95</TABLE>
171
+</DEFINITION>
172
+
173
+<DEFINITION>
174
+	<FOR>Meltdown</FOR>
175
+	<GIVEN>WaterLeak</GIVEN>
176
+	<GIVEN>PumpFailure</GIVEN>
177
+	<GIVEN>HS_do_something_not_stupid</GIVEN>
178
+	<TABLE>0.15 0.85 0.2 0.8 0.05 0.95 0.1 0.9 0.1 0.9 0.15 0.85 0.001 0.999 0.001 0.999</TABLE>
179
+</DEFINITION>
180
+
181
+<DEFINITION>
182
+	<FOR>Battery</FOR>
183
+	<GIVEN>IcyWeather</GIVEN>
184
+	<TABLE>0.8 0.2 0.95 0.05</TABLE>
185
+</DEFINITION>
186
+
187
+<DEFINITION>
188
+	<FOR>Radio</FOR>
189
+	<GIVEN>Battery</GIVEN>
190
+	<TABLE>0.95 0.05 0.0 1.0</TABLE>
191
+</DEFINITION>
192
+
193
+<DEFINITION>
194
+	<FOR>Ignition</FOR>
195
+	<GIVEN>Battery</GIVEN>
196
+	<TABLE>0.95 0.05 0.0 1.0</TABLE>
197
+</DEFINITION>
198
+
199
+<DEFINITION>
200
+	<FOR>Gas</FOR>
201
+	<TABLE>0.95 0.05</TABLE>
202
+</DEFINITION>
203
+
204
+<DEFINITION>
205
+	<FOR>Start</FOR>
206
+	<GIVEN>Ignition</GIVEN>
207
+	<GIVEN>Gas</GIVEN>
208
+	<TABLE>0.95 0.05 0.0 1.0 0.0 1.0 0.0 1.0</TABLE>
209
+</DEFINITION>
210
+
211
+<DEFINITION>
212
+	<FOR>Moves</FOR>
213
+	<GIVEN>Start</GIVEN>
214
+	<TABLE>0.95 0.05 0.0 1.0</TABLE>
215
+</DEFINITION>
216
+
217
+<DEFINITION>
218
+	<FOR>Survives</FOR>
219
+	<GIVEN>Meltdown</GIVEN>
220
+	<GIVEN>Moves</GIVEN>
221
+	<GIVEN>Bicycle_works</GIVEN>
222
+	<TABLE>0.9 0.1 0.8 0.2 0.6 0.4 0.0 1.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0</TABLE>
223
+</DEFINITION>
224
+
225
+<DEFINITION>
226
+	<FOR>Bicycle_works</FOR>
227
+	<TABLE>0.9 0.1</TABLE>
228
+</DEFINITION>
229
+
230
+<DEFINITION>
231
+	<FOR>HS_is_awake</FOR>
232
+	<GIVEN>Pay_day</GIVEN>
233
+	<TABLE>1.0 0.0 0.5 0.5</TABLE>
234
+</DEFINITION>
235
+
236
+<DEFINITION>
237
+	<FOR>HS_do_something_not_stupid</FOR>
238
+	<GIVEN>HS_is_awake</GIVEN>
239
+	<GIVEN>HS_remark_irregularity</GIVEN>
240
+	<TABLE>0.7 0.3 0.05 0.95 0.0 1.0 0.0 1.0</TABLE>
241
+</DEFINITION>
242
+
243
+<DEFINITION>
244
+	<FOR>HS_remark_irregularity</FOR>
245
+	<GIVEN>WaterLeakWarning</GIVEN>
246
+	<GIVEN>PumpFailureWarning</GIVEN>
247
+	<GIVEN>HS_is_awake</GIVEN>
248
+	<TABLE>0.9 0.1 0.0 1.0 0.7 0.3 0.0 1.0 0.7 0.3 0.0 1.0 0.05 0.95 0.0 1.0</TABLE>
249
+</DEFINITION>
250
+
251
+<DEFINITION>
252
+	<FOR>Pay_day</FOR>
253
+	<TABLE>0.03 0.97</TABLE>
254
+</DEFINITION>
255
+
256
+<DEFINITION>
257
+	<FOR>Warning(s)?</FOR>
258
+	<GIVEN>WaterLeakWarning</GIVEN>
259
+	<GIVEN>PumpFailureWarning</GIVEN>
260
+	<TABLE>1.0 0.0 1.0 0.0 1.0 0.0 0.0 1.0</TABLE>
261
+</DEFINITION>
262
+</NETWORK>
263
+</BIF>

+ 192
- 0
lab3/lab3_bicycle.xml View File

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<BIF VERSION="0.3"  xmlns="http://www.cs.ubc.ca/labs/lci/fopi/ve/XMLBIFv0_3"
3
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+	xsi:schemaLocation="http://www.cs.ubc.ca/labs/lci/fopi/ve/XMLBIFv0_3 http://www.cs.ubc.ca/labs/lci/fopi/ve/XMLBIFv0_3/XMLBIFv0_3.xsd">
5
+<NETWORK>
6
+<NAME>Nuclear Power Station</NAME>
7
+<PROPERTY>detailed = </PROPERTY>
8
+<PROPERTY>short = </PROPERTY>
9
+
10
+<VARIABLE TYPE="nature">
11
+	<NAME>WaterLeak</NAME>
12
+	<OUTCOME>T</OUTCOME>
13
+	<OUTCOME>F</OUTCOME>
14
+	<PROPERTY>position = (7384.1337890625, 5342.26220703125)</PROPERTY>
15
+</VARIABLE>
16
+
17
+<VARIABLE TYPE="nature">
18
+	<NAME>WaterLeakWarning</NAME>
19
+	<OUTCOME>T</OUTCOME>
20
+	<OUTCOME>F</OUTCOME>
21
+	<PROPERTY>position = (7260.0986328125, 5584.7626953125)</PROPERTY>
22
+</VARIABLE>
23
+
24
+<VARIABLE TYPE="nature">
25
+	<NAME>IcyWeather</NAME>
26
+	<OUTCOME>T</OUTCOME>
27
+	<OUTCOME>F</OUTCOME>
28
+	<PROPERTY>position = (7579.63818359375, 5085.86474609375)</PROPERTY>
29
+</VARIABLE>
30
+
31
+<VARIABLE TYPE="nature">
32
+	<NAME>PumpFailure</NAME>
33
+	<OUTCOME>T</OUTCOME>
34
+	<OUTCOME>F</OUTCOME>
35
+	<PROPERTY>position = (7123.5244140625, 5338.97509765625)</PROPERTY>
36
+</VARIABLE>
37
+
38
+<VARIABLE TYPE="nature">
39
+	<NAME>PumpFailureWarning</NAME>
40
+	<OUTCOME>T</OUTCOME>
41
+	<OUTCOME>F</OUTCOME>
42
+	<PROPERTY>position = (7029.26171875, 5583.60107421875)</PROPERTY>
43
+</VARIABLE>
44
+
45
+<VARIABLE TYPE="nature">
46
+	<NAME>Meltdown</NAME>
47
+	<OUTCOME>T</OUTCOME>
48
+	<OUTCOME>F</OUTCOME>
49
+	<PROPERTY>position = (7482.10693359375, 5585.57177734375)</PROPERTY>
50
+</VARIABLE>
51
+
52
+<VARIABLE TYPE="nature">
53
+	<NAME>Battery</NAME>
54
+	<OUTCOME>T</OUTCOME>
55
+	<OUTCOME>F</OUTCOME>
56
+	<PROPERTY>position = (7773.16650390625, 5220.43408203125)</PROPERTY>
57
+</VARIABLE>
58
+
59
+<VARIABLE TYPE="nature">
60
+	<NAME>Radio</NAME>
61
+	<OUTCOME>T</OUTCOME>
62
+	<OUTCOME>F</OUTCOME>
63
+	<PROPERTY>position = (7679.6611328125, 5350.0634765625)</PROPERTY>
64
+</VARIABLE>
65
+
66
+<VARIABLE TYPE="nature">
67
+	<NAME>Ignition</NAME>
68
+	<OUTCOME>T</OUTCOME>
69
+	<OUTCOME>F</OUTCOME>
70
+	<PROPERTY>position = (7924.04248046875, 5350.0634765625)</PROPERTY>
71
+</VARIABLE>
72
+
73
+<VARIABLE TYPE="nature">
74
+	<NAME>Gas</NAME>
75
+	<OUTCOME>T</OUTCOME>
76
+	<OUTCOME>F</OUTCOME>
77
+	<PROPERTY>position = (8165.234375, 5358.56396484375)</PROPERTY>
78
+</VARIABLE>
79
+
80
+<VARIABLE TYPE="nature">
81
+	<NAME>Start</NAME>
82
+	<OUTCOME>T</OUTCOME>
83
+	<OUTCOME>F</OUTCOME>
84
+	<PROPERTY>position = (8058.9833984375, 5506.25390625)</PROPERTY>
85
+</VARIABLE>
86
+
87
+<VARIABLE TYPE="nature">
88
+	<NAME>Moves</NAME>
89
+	<OUTCOME>T</OUTCOME>
90
+	<OUTCOME>F</OUTCOME>
91
+	<PROPERTY>position = (8058.9833984375, 5660.31982421875)</PROPERTY>
92
+</VARIABLE>
93
+
94
+<VARIABLE TYPE="nature">
95
+	<NAME>Survives</NAME>
96
+	<OUTCOME>T</OUTCOME>
97
+	<OUTCOME>F</OUTCOME>
98
+	<PROPERTY>position = (7650.9716796875, 5801.63623046875)</PROPERTY>
99
+</VARIABLE>
100
+
101
+<VARIABLE TYPE="nature">
102
+	<NAME>Bicycle_works</NAME>
103
+	<OUTCOME>T</OUTCOME>
104
+	<OUTCOME>F</OUTCOME>
105
+	<PROPERTY>position = (7649.91162109375, 5662.4453125)</PROPERTY>
106
+</VARIABLE>
107
+
108
+<DEFINITION>
109
+	<FOR>WaterLeak</FOR>
110
+	<GIVEN>IcyWeather</GIVEN>
111
+	<TABLE>0.2 0.8 0.1 0.9</TABLE>
112
+</DEFINITION>
113
+
114
+<DEFINITION>
115
+	<FOR>WaterLeakWarning</FOR>
116
+	<GIVEN>WaterLeak</GIVEN>
117
+	<TABLE>0.9 0.1 0.05 0.95</TABLE>
118
+</DEFINITION>
119
+
120
+<DEFINITION>
121
+	<FOR>IcyWeather</FOR>
122
+	<TABLE>0.05 0.95</TABLE>
123
+</DEFINITION>
124
+
125
+<DEFINITION>
126
+	<FOR>PumpFailure</FOR>
127
+	<TABLE>0.1 0.9</TABLE>
128
+</DEFINITION>
129
+
130
+<DEFINITION>
131
+	<FOR>PumpFailureWarning</FOR>
132
+	<GIVEN>PumpFailure</GIVEN>
133
+	<TABLE>0.9 0.1 0.05 0.95</TABLE>
134
+</DEFINITION>
135
+
136
+<DEFINITION>
137
+	<FOR>Meltdown</FOR>
138
+	<GIVEN>WaterLeak</GIVEN>
139
+	<GIVEN>PumpFailure</GIVEN>
140
+	<TABLE>0.2 0.8 0.1 0.9 0.15 0.85 0.001 0.999</TABLE>
141
+</DEFINITION>
142
+
143
+<DEFINITION>
144
+	<FOR>Battery</FOR>
145
+	<GIVEN>IcyWeather</GIVEN>
146
+	<TABLE>0.8 0.2 0.95 0.05</TABLE>
147
+</DEFINITION>
148
+
149
+<DEFINITION>
150
+	<FOR>Radio</FOR>
151
+	<GIVEN>Battery</GIVEN>
152
+	<TABLE>0.95 0.05 0.0 1.0</TABLE>
153
+</DEFINITION>
154
+
155
+<DEFINITION>
156
+	<FOR>Ignition</FOR>
157
+	<GIVEN>Battery</GIVEN>
158
+	<TABLE>0.95 0.05 0.0 1.0</TABLE>
159
+</DEFINITION>
160
+
161
+<DEFINITION>
162
+	<FOR>Gas</FOR>
163
+	<TABLE>0.95 0.05</TABLE>
164
+</DEFINITION>
165
+
166
+<DEFINITION>
167
+	<FOR>Start</FOR>
168
+	<GIVEN>Ignition</GIVEN>
169
+	<GIVEN>Gas</GIVEN>
170
+	<TABLE>0.95 0.05 0.0 1.0 0.0 1.0 0.0 1.0</TABLE>
171
+</DEFINITION>
172
+
173
+<DEFINITION>
174
+	<FOR>Moves</FOR>
175
+	<GIVEN>Start</GIVEN>
176
+	<TABLE>0.95 0.05 0.0 1.0</TABLE>
177
+</DEFINITION>
178
+
179
+<DEFINITION>
180
+	<FOR>Survives</FOR>
181
+	<GIVEN>Meltdown</GIVEN>
182
+	<GIVEN>Moves</GIVEN>
183
+	<GIVEN>Bicycle_works</GIVEN>
184
+	<TABLE>0.9 0.1 0.8 0.2 0.6 0.4 0.0 1.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0</TABLE>
185
+</DEFINITION>
186
+
187
+<DEFINITION>
188
+	<FOR>Bicycle_works</FOR>
189
+	<TABLE>0.9 0.1</TABLE>
190
+</DEFINITION>
191
+</NETWORK>
192
+</BIF>

+ 179
- 0
lab3/lab3_new_car.xml View File

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<BIF VERSION="0.3"  xmlns="http://www.cs.ubc.ca/labs/lci/fopi/ve/XMLBIFv0_3"
3
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+	xsi:schemaLocation="http://www.cs.ubc.ca/labs/lci/fopi/ve/XMLBIFv0_3 http://www.cs.ubc.ca/labs/lci/fopi/ve/XMLBIFv0_3/XMLBIFv0_3.xsd">
5
+<NETWORK>
6
+<NAME>Nuclear Power Station</NAME>
7
+<PROPERTY>detailed = </PROPERTY>
8
+<PROPERTY>short = </PROPERTY>
9
+
10
+<VARIABLE TYPE="nature">
11
+	<NAME>WaterLeak</NAME>
12
+	<OUTCOME>T</OUTCOME>
13
+	<OUTCOME>F</OUTCOME>
14
+	<PROPERTY>position = (7384.1337890625, 5342.26220703125)</PROPERTY>
15
+</VARIABLE>
16
+
17
+<VARIABLE TYPE="nature">
18
+	<NAME>WaterLeakWarning</NAME>
19
+	<OUTCOME>T</OUTCOME>
20
+	<OUTCOME>F</OUTCOME>
21
+	<PROPERTY>position = (7260.0986328125, 5584.7626953125)</PROPERTY>
22
+</VARIABLE>
23
+
24
+<VARIABLE TYPE="nature">
25
+	<NAME>IcyWeather</NAME>
26
+	<OUTCOME>T</OUTCOME>
27
+	<OUTCOME>F</OUTCOME>
28
+	<PROPERTY>position = (7579.63818359375, 5085.86474609375)</PROPERTY>
29
+</VARIABLE>
30
+
31
+<VARIABLE TYPE="nature">
32
+	<NAME>PumpFailure</NAME>
33
+	<OUTCOME>T</OUTCOME>
34
+	<OUTCOME>F</OUTCOME>
35
+	<PROPERTY>position = (7123.5244140625, 5338.97509765625)</PROPERTY>
36
+</VARIABLE>
37
+
38
+<VARIABLE TYPE="nature">
39
+	<NAME>PumpFailureWarning</NAME>
40
+	<OUTCOME>T</OUTCOME>
41
+	<OUTCOME>F</OUTCOME>
42
+	<PROPERTY>position = (7029.26171875, 5583.60107421875)</PROPERTY>
43
+</VARIABLE>
44
+
45
+<VARIABLE TYPE="nature">
46
+	<NAME>Meltdown</NAME>
47
+	<OUTCOME>T</OUTCOME>
48
+	<OUTCOME>F</OUTCOME>
49
+	<PROPERTY>position = (7482.10693359375, 5585.57177734375)</PROPERTY>
50
+</VARIABLE>
51
+
52
+<VARIABLE TYPE="nature">
53
+	<NAME>Battery</NAME>
54
+	<OUTCOME>T</OUTCOME>
55
+	<OUTCOME>F</OUTCOME>
56
+	<PROPERTY>position = (7773.16650390625, 5220.43408203125)</PROPERTY>
57
+</VARIABLE>
58
+
59
+<VARIABLE TYPE="nature">
60
+	<NAME>Radio</NAME>
61
+	<OUTCOME>T</OUTCOME>
62
+	<OUTCOME>F</OUTCOME>
63
+	<PROPERTY>position = (7679.6611328125, 5350.0634765625)</PROPERTY>
64
+</VARIABLE>
65
+
66
+<VARIABLE TYPE="nature">
67
+	<NAME>Ignition</NAME>
68
+	<OUTCOME>T</OUTCOME>
69
+	<OUTCOME>F</OUTCOME>
70
+	<PROPERTY>position = (7924.04248046875, 5350.0634765625)</PROPERTY>
71
+</VARIABLE>
72
+
73
+<VARIABLE TYPE="nature">
74
+	<NAME>Gas</NAME>
75
+	<OUTCOME>T</OUTCOME>
76
+	<OUTCOME>F</OUTCOME>
77
+	<PROPERTY>position = (8165.234375, 5358.56396484375)</PROPERTY>
78
+</VARIABLE>
79
+
80
+<VARIABLE TYPE="nature">
81
+	<NAME>Start</NAME>
82
+	<OUTCOME>T</OUTCOME>
83
+	<OUTCOME>F</OUTCOME>
84
+	<PROPERTY>position = (8058.9833984375, 5506.25390625)</PROPERTY>
85
+</VARIABLE>
86
+
87
+<VARIABLE TYPE="nature">
88
+	<NAME>Moves</NAME>
89
+	<OUTCOME>T</OUTCOME>
90
+	<OUTCOME>F</OUTCOME>
91
+	<PROPERTY>position = (8058.9833984375, 5660.31982421875)</PROPERTY>
92
+</VARIABLE>
93
+
94
+<VARIABLE TYPE="nature">
95
+	<NAME>Survives</NAME>
96
+	<OUTCOME>T</OUTCOME>
97
+	<OUTCOME>F</OUTCOME>
98
+	<PROPERTY>position = (7650.9716796875, 5801.63623046875)</PROPERTY>
99
+</VARIABLE>
100
+
101
+<DEFINITION>
102
+	<FOR>WaterLeak</FOR>
103
+	<GIVEN>IcyWeather</GIVEN>
104
+	<TABLE>0.2 0.8 0.1 0.9</TABLE>
105
+</DEFINITION>
106
+
107
+<DEFINITION>
108
+	<FOR>WaterLeakWarning</FOR>
109
+	<GIVEN>WaterLeak</GIVEN>
110
+	<TABLE>0.9 0.1 0.05 0.95</TABLE>
111
+</DEFINITION>
112
+
113
+<DEFINITION>
114
+	<FOR>IcyWeather</FOR>
115
+	<TABLE>0.05 0.95</TABLE>
116
+</DEFINITION>
117
+
118
+<DEFINITION>
119
+	<FOR>PumpFailure</FOR>
120
+	<TABLE>0.1 0.9</TABLE>
121
+</DEFINITION>
122
+
123
+<DEFINITION>
124
+	<FOR>PumpFailureWarning</FOR>
125
+	<GIVEN>PumpFailure</GIVEN>
126
+	<TABLE>0.9 0.1 0.05 0.95</TABLE>
127
+</DEFINITION>
128
+
129
+<DEFINITION>
130
+	<FOR>Meltdown</FOR>
131
+	<GIVEN>WaterLeak</GIVEN>
132
+	<GIVEN>PumpFailure</GIVEN>
133
+	<TABLE>0.2 0.8 0.1 0.9 0.15 0.85 0.001 0.999</TABLE>
134
+</DEFINITION>
135
+
136
+<DEFINITION>
137
+	<FOR>Battery</FOR>
138
+	<GIVEN>IcyWeather</GIVEN>
139
+	<TABLE>0.8 0.2 0.95 0.05</TABLE>
140
+</DEFINITION>
141
+
142
+<DEFINITION>
143
+	<FOR>Radio</FOR>
144
+	<GIVEN>Battery</GIVEN>
145
+	<TABLE>0.95 0.05 0.0 1.0</TABLE>
146
+</DEFINITION>
147
+
148
+<DEFINITION>
149
+	<FOR>Ignition</FOR>
150
+	<GIVEN>Battery</GIVEN>
151
+	<TABLE>0.95 0.05 0.0 1.0</TABLE>
152
+</DEFINITION>
153
+
154
+<DEFINITION>
155
+	<FOR>Gas</FOR>
156
+	<TABLE>0.95 0.05</TABLE>
157
+</DEFINITION>
158
+
159
+<DEFINITION>
160
+	<FOR>Start</FOR>
161
+	<GIVEN>Ignition</GIVEN>
162
+	<GIVEN>Gas</GIVEN>
163
+	<TABLE>0.95 0.05 0.0 1.0 0.0 1.0 0.0 1.0</TABLE>
164
+</DEFINITION>
165
+
166
+<DEFINITION>
167
+	<FOR>Moves</FOR>
168
+	<GIVEN>Start</GIVEN>
169
+	<TABLE>0.95 0.05 0.0 1.0</TABLE>
170
+</DEFINITION>
171
+
172
+<DEFINITION>
173
+	<FOR>Survives</FOR>
174
+	<GIVEN>Meltdown</GIVEN>
175
+	<GIVEN>Moves</GIVEN>
176
+	<TABLE>0.8 0.2 0.0 1.0 1.0 0.0 1.0 0.0</TABLE>
177
+</DEFINITION>
178
+</NETWORK>
179
+</BIF>

+ 88
- 0
lab3/nuclear_power_station.xml View File

1
+<?xml version="1.0" encoding="US-ASCII"?>
2
+
3
+<BIF VERSION="0.3"  xmlns="http://www.cs.ubc.ca/labs/lci/fopi/ve/XMLBIFv0_3"
4
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+	xsi:schemaLocation="http://www.cs.ubc.ca/labs/lci/fopi/ve/XMLBIFv0_3 http://www.cs.ubc.ca/labs/lci/fopi/ve/XMLBIFv0_3/XMLBIFv0_3.xsd">
6
+<NETWORK>
7
+<NAME>Nuclear Power Station</NAME>
8
+<VARIABLE TYPE="nature">
9
+   <NAME>WaterLeak</NAME>
10
+   <OUTCOME>T</OUTCOME>
11
+   <OUTCOME>F</OUTCOME>
12
+   <PROPERTY>position = (53.0, -52.0)</PROPERTY>
13
+</VARIABLE>
14
+
15
+<VARIABLE TYPE="nature">
16
+   <NAME>WaterLeakWarning</NAME>
17
+   <OUTCOME>T</OUTCOME>
18
+   <OUTCOME>F</OUTCOME>
19
+   <PROPERTY>position = (112.0, 49.0)</PROPERTY>
20
+</VARIABLE>
21
+
22
+<VARIABLE TYPE="nature">
23
+   <NAME>IcyWeather</NAME>
24
+   <OUTCOME>T</OUTCOME>
25
+   <OUTCOME>F</OUTCOME>
26
+   <PROPERTY>position = (53.0, -144.0)</PROPERTY>
27
+</VARIABLE>
28
+
29
+<VARIABLE TYPE="nature">
30
+   <NAME>PumpFailure</NAME>
31
+   <OUTCOME>T</OUTCOME>
32
+   <OUTCOME>F</OUTCOME>
33
+   <PROPERTY>position = (-145.0, -54.0)</PROPERTY>
34
+</VARIABLE>
35
+
36
+<VARIABLE TYPE="nature">
37
+   <NAME>PumpFailureWarning</NAME>
38
+   <OUTCOME>T</OUTCOME>
39
+   <OUTCOME>F</OUTCOME>
40
+   <PROPERTY>position = (-203.0, 47.0)</PROPERTY>
41
+</VARIABLE>
42
+
43
+<VARIABLE TYPE="nature">
44
+   <NAME>Meltdown</NAME>
45
+   <OUTCOME>T</OUTCOME>
46
+   <OUTCOME>F</OUTCOME>
47
+   <PROPERTY>position = (-60.0, 140.0)</PROPERTY>
48
+</VARIABLE>
49
+
50
+
51
+<DEFINITION>
52
+   <FOR>WaterLeak</FOR>
53
+   <GIVEN>IcyWeather</GIVEN>
54
+   <TABLE> 0.2 0.8 0.1 0.9</TABLE>
55
+</DEFINITION>
56
+
57
+<DEFINITION>
58
+   <FOR>WaterLeakWarning</FOR>
59
+   <GIVEN>WaterLeak</GIVEN>
60
+   <TABLE> 0.9 0.1 0.05 0.95</TABLE>
61
+</DEFINITION>
62
+
63
+<DEFINITION>
64
+   <FOR>IcyWeather</FOR>
65
+   <TABLE> 0.05 0.95</TABLE>
66
+</DEFINITION>
67
+
68
+<DEFINITION>
69
+   <FOR>PumpFailure</FOR>
70
+   <TABLE> 0.1 0.9</TABLE>
71
+</DEFINITION>
72
+
73
+<DEFINITION>
74
+   <FOR>PumpFailureWarning</FOR>
75
+   <GIVEN>PumpFailure</GIVEN>
76
+   <TABLE> 0.9 0.1 0.05 0.95</TABLE>
77
+</DEFINITION>
78
+
79
+<DEFINITION>
80
+   <FOR>Meltdown</FOR>
81
+   <GIVEN>PumpFailure</GIVEN>
82
+   <GIVEN>WaterLeak</GIVEN>
83
+   <TABLE> 0.2 0.8 0.15 0.85 0.1 0.9 0.0010 0.999</TABLE>
84
+</DEFINITION>
85
+
86
+
87
+</NETWORK>
88
+</BIF>

+ 63
- 0
lab4/part1/results.md View File

1
+## Some results for pb1 on domain "Shakey"
2
+The problem 1 is not complex enough to have time comparison, but we can observe different strategies.
3
+
4
+### IPP algorithm
5
+```
6
+time step    0: MOVE R2 R1
7
+time step    1: PUSH BOX1 R1 R2
8
+time step    2: PUSH BOX1 R2 R3
9
+time step    3: TURN_ON_LIGHT R3 BOX1
10
+time step    4: GRAB SMALL4 R3 LEFT
11
+                GRAB SMALL3 R3 RIGHT
12
+time step    5: PUSH BOX1 R3 R2
13
+time step    6: PUSH BOX1 R2 R1
14
+time step    7: RELEASE SMALL3 R1 RIGHT
15
+                RELEASE SMALL4 R1 LEFT
16
+time step    8: PUSH BOX1 R1 R2
17
+time step    9: TURN_ON_LIGHT R2 BOX1
18
+time step   10: GRAB SMALL2 R2 RIGHT
19
+time step   11: PUSH BOX1 R2 R1
20
+time step   12: RELEASE SMALL2 R1 RIGHT
21
+
22
+Memory used:   0.09 MBytes for domain representation
23
+               2.50 MBytes for graph
24
+               0.04 MBytes for exclusions
25
+               0.04 MBytes for memoization
26
+               0.14 MBytes for wave front
27
+```
28
+### FF algorithm
29
+```
30
+step    0: MOVE R2 R1
31
+        1: PUSH BOX1 R1 R2
32
+        2: TURN_ON_LIGHT R2 BOX1
33
+        3: GRAB SMALL2 R2 LEFT
34
+        4: MOVE R2 R1
35
+        5: RELEASE SMALL2 R1 LEFT
36
+        6: MOVE R1 R2
37
+        7: PUSH BOX1 R2 R3
38
+        8: TURN_ON_LIGHT R3 BOX1
39
+        9: GRAB SMALL3 R3 LEFT
40
+       10: GRAB SMALL4 R3 RIGHT
41
+       11: MOVE R3 R2
42
+       12: MOVE R2 R1
43
+       13: RELEASE SMALL3 R1 LEFT
44
+       14: RELEASE SMALL4 R1 RIGHT
45
+```
46
+### LAMA algorithm
47
+```
48
+(move r2 r1)
49
+(push box1 r1 r2)
50
+(turn_on_light r2 box1)
51
+(grab small2 r2 right)
52
+(move r2 r1)
53
+(release small2 r1 right)
54
+(move r1 r2)
55
+(push box1 r2 r3)
56
+(turn_on_light r3 box1)
57
+(grab small3 r3 left)
58
+(grab small4 r3 right)
59
+(move r3 r2)
60
+(move r2 r1)
61
+(release small3 r1 left)
62
+(release small4 r1 right)
63
+```

+ 73
- 0
lab4/part1/task1_domain.pddl View File

1
+;; TDDC17 - Lab 4
2
+;; Shakey's World
3
+
4
+;; The objective here is to give a basic
5
+;; domain for the Shakey's World problem.
6
+
7
+;; Our domain definition
8
+(define (domain shakey)
9
+	;; We only use strips
10
+	(:requirements :strips)	
11
+	
12
+	(:types 
13
+		room	;; Represent a room
14
+		object	;; Represent any object (small objects or boxes)
15
+		gripper ;; Represent Shakey's gripper
16
+	)	
17
+
18
+	;; Predicates definition
19
+	(:predicates
20
+		(position ?r - room)			;; Is Shakey in the given room?
21
+		(light ?r - room)			;; Are lights on in the given room?
22
+
23
+		(connected_wide ?r1 ?r2 - room)		;; Are rooms connected by a wide door?
24
+		(connected ?r1 ?r2 - room)		;; Are rooms connected by a door?
25
+		
26
+		(in ?o - object ?r - room)		;; Is the given object in the given room?
27
+		(is_empty ?g - gripper)			;; Is the given gripper empty?
28
+		(hold_on ?g - gripper ?o - object)	;; Is the given gripper holding the given object?
29
+		(is_big ?o - object)			;; Is this object big? I.e. is this object a box?
30
+	)
31
+
32
+	;; Actions definition
33
+	;; Robot's actions
34
+	(:action move		;; MOVE action, from the room ?pos to ?trg
35
+		:parameters	(?pos ?trg - room)
36
+		:precondition	(and (position ?pos) 
37
+				(connected ?pos ?trg))
38
+		:effect		(and (not (position ?pos)) (position ?trg))
39
+	)
40
+	(:action turn_on_light	;; Act of turning on lights. Requires a support.
41
+		:parameters	(?pos - room ?support - object)
42
+		:precondition   (and (position ?pos)
43
+				     (in ?support ?pos)
44
+				     (is_big ?support)
45
+				     (not (light ?pos)))
46
+		:effect		(light ?pos)
47
+	)
48
+
49
+	;; Object actions
50
+	(:action grab		;; Action to GRAB sth
51
+		:parameters	(?what - object ?where - room ?g - gripper)
52
+		:precondition	(and (position ?where)
53
+				     (light ?where)
54
+				     (in ?what ?where)
55
+				     (is_empty ?g)
56
+				     (not (is_big ?what)))
57
+		:effect		(and (not (is_empty ?g))(hold_on ?g ?what)(in ?what ?where))
58
+	)
59
+	(:action release	;; Action to RELEASE sth
60
+		:parameters	(?what - object ?where - room ?g - gripper)
61
+		:precondition   (and (position ?where)
62
+				     (hold_on ?g ?what))
63
+		:effect		(and (not (hold_on ?g ?what))(in ?what ?where)(is_empty ?g))
64
+	)
65
+	(:action push		;; Action to PUSH sth
66
+		:parameters	(?what - object ?r1 - room ?r2 - room)
67
+		:precondition   (and (position ?r1)
68
+				     (is_big ?what)
69
+				     (in ?what ?r1)
70
+				     (connected_wide ?r1 ?r2))
71
+		:effect		(and (position ?r2)(not (position ?r1))(in ?what ?r2)(not(in ?what ?r1)))
72
+	)
73
+)	

+ 89
- 0
lab4/part1/task1_pb1.pddl View File

1
+;; TDDC17 - Lab 4
2
+;; S.'s W. problem 1
3
+;; Last modification: 2020-10-04
4
+
5
+;; Problem description
6
+;; The first problem has three rooms, connect by doors as discribed below:
7
+;;      -------------------------------------------------------------------------
8
+;;      |                       |                       |                       |
9
+;;      |                       |                       |                       |
10
+;;      |       light switch 1 -|- light switch2        |- light switch3        |
11
+;;      |                       |                       |                       |
12
+;;      |       ---             |                     door2                     |
13
+;;      |       | |           door1      shakey         |                       |
14
+;;      |       ---           (wide)                    |                       |
15
+;;      |       box             |                       |                       |
16
+;;      |                       |                     door3                     |
17
+;;      |                       |                     (wide)                    |
18
+;;      |        r1             |        r2             |         r3            |
19
+;;      -------------------------------------------------------------------------
20
+;; Shakey must find four small objects distributed in the three rooms and bring 
21
+;; them back to the first room. All lights are off initially. The box allowing 
22
+;; Shakey to turn on the lights is in the first room.
23
+
24
+
25
+;; Our problem1 definition
26
+(define (problem pb1)
27
+	(:domain shakey)
28
+	
29
+	(:objects
30
+		;; Our three rooms
31
+		r1 - room
32
+		r2 - room
33
+		r3 - room
34
+
35
+		;; The box
36
+		box1 - object
37
+
38
+		;; The four small objects
39
+		small1 - object
40
+		small2 - object
41
+		small3 - object
42
+		small4 - object
43
+
44
+		;; The two Shakey's grippers
45
+		right - gripper
46
+		left - gripper
47
+	)
48
+	
49
+	(:init
50
+		;; Init position
51
+		;; At the beginning, Shakey is in room 2.
52
+		(position r2)
53
+		
54
+		;; Init connections (as discribed above).
55
+		(connected_wide r1 r2)
56
+		(connected_wide r2 r1)
57
+		(connected_wide r2 r3)
58
+		(connected_wide r3 r2)
59
+		(connected r1 r2)
60
+		(connected r2 r1)
61
+		(connected r2 r3)
62
+		(connected r3 r2)
63
+
64
+		;; Init object positions
65
+		(in box1 r1)
66
+		(is_big box1)
67
+		(in small1 r1)
68
+		(in small2 r2)
69
+		(in small3 r3)
70
+		(in small4 r3)
71
+		
72
+		;; Init light (light nowhere)
73
+		;;(not (light r1))
74
+		;;(not (light r2))
75
+		;;(not (light r3))
76
+
77
+		;; Init gripper
78
+		(is_empty right)
79
+		(is_empty left)
80
+	)
81
+	
82
+	;; The goal is to have all four objects in the room 1.
83
+	(:goal
84
+		(and (in small1 r1)
85
+		(in small2 r1)
86
+                (in small3 r1)
87
+                (in small4 r1))
88
+	)
89
+)

+ 68
- 0
lab4/part2/domain.pddl View File

1
+(define (domain transport-strips)
2
+(:requirements :typing :action-costs)
3
+
4
+(:types location fuellevel locatable - object 
5
+	package truck - locatable
6
+)
7
+
8
+(:predicates 
9
+(connected ?l1 ?l2 - location)
10
+(at ?o - locatable ?l - location)
11
+(in ?p - package ?t - truck)
12
+(fuel ?t - truck ?level - fuellevel)
13
+(fuelcost ?level - fuellevel ?l1 ?l2 - location)
14
+(sum ?a ?b ?c - fuellevel)
15
+)
16
+
17
+(:functions 
18
+(total-cost) - number)
19
+
20
+(:action LOAD
21
+:parameters
22
+(?p - package
23
+?t - truck
24
+?l - location)
25
+:precondition
26
+(and (at ?t ?l) (at ?p ?l))
27
+:effect
28
+(and (not (at ?p ?l)) (in ?p ?t) (increase (total-cost) 1))
29
+)
30
+
31
+(:action UNLOAD
32
+:parameters
33
+(?p - package
34
+?t - truck
35
+?l - location)
36
+:precondition
37
+(and (at ?t ?l) (in ?p ?t))
38
+:effect
39
+(and (at ?p ?l) (not (in ?p ?t)) (increase (total-cost) 1))
40
+)
41
+
42
+(:action DRIVE
43
+:parameters
44
+(?t - truck
45
+?l1 - location
46
+?l2 - location
47
+?fuelpost - fuellevel
48
+?fueldelta - fuellevel
49
+?fuelpre - fuellevel)
50
+:precondition
51
+(and 
52
+(connected ?l1 ?l2)
53
+(fuelcost ?fueldelta ?l1 ?l2)
54
+(fuel ?t ?fuelpre)
55
+(sum ?fuelpost ?fueldelta ?fuelpre)
56
+(at ?t ?l1)
57
+)
58
+:effect
59
+(and (not (at ?t ?l1)) 
60
+     (at ?t ?l2) 
61
+     (not (fuel ?t ?fuelpre)) 
62
+     (fuel ?t ?fuelpost)
63
+     (increase (total-cost) 1))
64
+)
65
+
66
+)
67
+
68
+

+ 27
- 0
lab4/part2/exe.sh View File

1
+#!/bin/bash
2
+# TDDC17 
3
+# Script to run all problems with all configurations
4
+
5
+echo "Setting up env."
6
+mkdir output
7
+echo -ne "Working in: "
8
+pwd
9
+echo ""
10
+
11
+## CONFIG 1: FF heuristic
12
+echo "$i: Running configuration 1 (Eager greedy search, FF heuristic)"
13
+/courses/TDDC17/sw/fdlog/fast-downward.py domain.pddl p02.pddl --log-file output/output-config1FF-pb2 --heuristic 'hff=ff()' --search 'eager_greedy([hff])'
14
+/courses/TDDC17/sw/fdlog/fast-downward.py domain.pddl p03.pddl --log-file output/output-config1FF-pb3 --heuristic 'hff=ff()' --search 'eager_greedy([hff])'
15
+
16
+## CONFIG 2: Goal count heristic
17
+echo "$i: Running configuration 2 (Eager greedy search, Goal count heuristic)"
18
+/courses/TDDC17/sw/fdlog/fast-downward.py domain.pddl p02.pddl --log-file output/output-config2GC-pb2 --heuristic 'gc=goalcount()' --search 'eager_greedy([gc])'
19
+/courses/TDDC17/sw/fdlog/fast-downward.py domain.pddl p03.pddl --log-file output/output-config2GC-pb3 --heuristic 'gc=goalcount()' --search 'eager_greedy([gc])'
20
+
21
+## CONFIG 3: Goal count heuristic with FF helpful actions
22
+echo "$i: Running configuration 2 (Eager greedy search, goal count heuristic with FF helpful actions)"
23
+/courses/TDDC17/sw/fdlog/fast-downward.py domain.pddl p02.pddl --log-file output/output-config3GF-pb2 --heuristic 'gc=goalcount()' --heuristic 'hff=ff()' --search 'eager_greedy([gc], preferred=[hff], boost=256)'
24
+/courses/TDDC17/sw/fdlog/fast-downward.py domain.pddl p03.pddl --log-file output/output-config3GF-pb3 --heuristic 'gc=goalcount()' --heuristic 'hff=ff()' --search 'eager_greedy([gc], preferred=[hff], boost=256)'
25
+
26
+echo "Done."
27
+exit 0

+ 1421
- 0
lab4/part2/output/output-config1ff-pb2.txt
File diff suppressed because it is too large
View File


+ 48394
- 0
lab4/part2/output/output-config1ff-pb3.txt
File diff suppressed because it is too large
View File


+ 269167
- 0
lab4/part2/output/output-config2gc-pb2.txt
File diff suppressed because it is too large
View File


+ 10366
- 0
lab4/part2/output/output-config2gc-pb3.txt
File diff suppressed because it is too large
View File


+ 52447
- 0
lab4/part2/output/output-config3gf-pb2.txt
File diff suppressed because it is too large
View File


+ 8976
- 0
lab4/part2/output/output-config3gf-pb3.txt
File diff suppressed because it is too large
View File


+ 699
- 0
lab4/part2/output_shakey/output-config1ff-shakey.txt View File

1
+{"act": "begin_group", "ts": 0}
2
+{"act": "open_list_sorting", "key_list": ["h_SINGLE", "h_(", "h_ff", "h_INSERTION_ORDER", "h_)"]}
3
+{"ts":0, "act": "state_update", "state_id": 0, "state": {"var0": "0(Atom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "1(NegatedAtom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "1(NegatedAtom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "g": -1, "real_g": -1}
4
+{"ts": 0, "act": "evaluated_states", "state_id": 0, "preferred": 1}
5
+{"act": "end_group"}
6
+{"act": "begin_group", "ts": 0}
7
+{"ts":0, "act": "state_update", "state_id": 0, "h_ff": 12}
8
+{"ts": 0, "act": "evaluated_heuristics", "count": 1}
9
+{"act": "preferred_heuristics", "key_list": []}
10
+{"act": "main_heuristic", "target": "h_ff"}
11
+{"act": "end_group"}
12
+{"act": "begin_group", "ts": 1}
13
+{"ts":1, "act": "state_update", "state_id": 0, "g": 0, "real_g": 0}
14
+{"ts": 1, "act": "expanded_states", "state_id": 0}
15
+{"act": "end_group"}
16
+{"act": "begin_group", "ts": 1}
17
+{"ts":1, "act": "state_update", "state_id": 1, "state": {"var0": "0(Atom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "0(Atom position(r1))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "1(NegatedAtom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "1(NegatedAtom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [0, "move r2 r1", 1]}
18
+{"ts": 1, "act": "generated_states", "state_id": 0, "op": "move r2 r1"}
19
+{"ts":1, "act": "state_update", "state_id": 1, "g": -1, "real_g": -1}
20
+{"ts": 1, "act": "evaluated_states", "state_id": 1, "preferred": 0}
21
+{"act": "end_group"}
22
+{"act": "begin_group", "ts": 1}
23
+{"ts":1, "act": "state_update", "state_id": 1, "h_ff": 12}
24
+{"ts": 1, "act": "evaluated_heuristics", "count": 1}
25
+{"ts":1, "act": "state_update", "state_id": 2, "state": {"var0": "0(Atom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "1(NegatedAtom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "1(NegatedAtom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [0, "move r2 r3", 1]}
26
+{"ts": 1, "act": "generated_states", "state_id": 0, "op": "move r2 r3"}
27
+{"ts":1, "act": "state_update", "state_id": 2, "g": -1, "real_g": -1}
28
+{"ts": 1, "act": "evaluated_states", "state_id": 2, "preferred": 0}
29
+{"act": "end_group"}
30
+{"act": "begin_group", "ts": 1}
31
+{"ts":1, "act": "state_update", "state_id": 2, "h_ff": 12}
32
+{"ts": 1, "act": "evaluated_heuristics", "count": 1}
33
+{"act": "end_group"}
34
+{"act": "begin_group", "ts": 2}
35
+{"ts":2, "act": "state_update", "state_id": 1, "g": 1, "real_g": 1}
36
+{"ts": 2, "act": "expanded_states", "state_id": 1}
37
+{"act": "end_group"}
38
+{"act": "begin_group", "ts": 2}
39
+{"ts":2, "act": "state_update", "state_id": 3, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "1(NegatedAtom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "1(NegatedAtom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [1, "push box1 r1 r2", 1]}
40
+{"ts": 2, "act": "generated_states", "state_id": 1, "op": "push box1 r1 r2"}
41
+{"ts":2, "act": "state_update", "state_id": 3, "g": -1, "real_g": -1}
42
+{"ts": 2, "act": "evaluated_states", "state_id": 3, "preferred": 0}
43
+{"act": "end_group"}
44
+{"act": "begin_group", "ts": 2}
45
+{"ts":2, "act": "state_update", "state_id": 3, "h_ff": 11}
46
+{"ts": 2, "act": "evaluated_heuristics", "count": 1}
47
+{"ts":2, "act": "state_update", "state_id": 4, "state": {"var0": "0(Atom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "0(Atom position(r1))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "1(NegatedAtom light(r2))", "var5": "0(Atom light(r1))", "var6": "1(NegatedAtom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [1, "turn_on_light r1 box1", 1]}
48
+{"ts": 2, "act": "generated_states", "state_id": 1, "op": "turn_on_light r1 box1"}
49
+{"ts":2, "act": "state_update", "state_id": 4, "g": -1, "real_g": -1}
50
+{"ts": 2, "act": "evaluated_states", "state_id": 4, "preferred": 0}
51
+{"act": "end_group"}
52
+{"act": "begin_group", "ts": 2}
53
+{"ts":2, "act": "state_update", "state_id": 4, "h_ff": 12}
54
+{"ts": 2, "act": "evaluated_heuristics", "count": 1}
55
+{"ts":2, "act": "state_update", "state_id": 0, "new_parent": [1, "move r1 r2", 1]}
56
+{"ts": 2, "act": "generated_states", "state_id": 1, "op": "move r1 r2"}
57
+{"act": "end_group"}
58
+{"act": "begin_group", "ts": 3}
59
+{"ts":3, "act": "state_update", "state_id": 3, "g": 2, "real_g": 2}
60
+{"ts": 3, "act": "expanded_states", "state_id": 3}
61
+{"act": "end_group"}
62
+{"act": "begin_group", "ts": 3}
63
+{"ts":3, "act": "state_update", "state_id": 5, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "0(Atom position(r1))", "var3": "0(Atom in(box1, r2))", "var4": "1(NegatedAtom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "1(NegatedAtom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [3, "move r2 r1", 1]}
64
+{"ts": 3, "act": "generated_states", "state_id": 3, "op": "move r2 r1"}
65
+{"ts":3, "act": "state_update", "state_id": 5, "g": -1, "real_g": -1}
66
+{"ts": 3, "act": "evaluated_states", "state_id": 5, "preferred": 0}
67
+{"act": "end_group"}
68
+{"act": "begin_group", "ts": 3}
69
+{"ts":3, "act": "state_update", "state_id": 5, "h_ff": 11}
70
+{"ts": 3, "act": "evaluated_heuristics", "count": 1}
71
+{"ts":3, "act": "state_update", "state_id": 6, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "0(Atom in(box1, r2))", "var4": "1(NegatedAtom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "1(NegatedAtom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [3, "move r2 r3", 1]}
72
+{"ts": 3, "act": "generated_states", "state_id": 3, "op": "move r2 r3"}
73
+{"ts":3, "act": "state_update", "state_id": 6, "g": -1, "real_g": -1}
74
+{"ts": 3, "act": "evaluated_states", "state_id": 6, "preferred": 0}
75
+{"act": "end_group"}
76
+{"act": "begin_group", "ts": 3}
77
+{"ts":3, "act": "state_update", "state_id": 6, "h_ff": 11}
78
+{"ts": 3, "act": "evaluated_heuristics", "count": 1}
79
+{"ts":3, "act": "state_update", "state_id": 1, "new_parent": [3, "push box1 r2 r1", 1]}
80
+{"ts": 3, "act": "generated_states", "state_id": 3, "op": "push box1 r2 r1"}
81
+{"ts":3, "act": "state_update", "state_id": 7, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "1(NegatedAtom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "1(NegatedAtom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [3, "push box1 r2 r3", 1]}
82
+{"ts": 3, "act": "generated_states", "state_id": 3, "op": "push box1 r2 r3"}
83
+{"ts":3, "act": "state_update", "state_id": 7, "g": -1, "real_g": -1}
84
+{"ts": 3, "act": "evaluated_states", "state_id": 7, "preferred": 0}
85
+{"act": "end_group"}
86
+{"act": "begin_group", "ts": 3}
87
+{"ts":3, "act": "state_update", "state_id": 7, "h_ff": 11}
88
+{"ts": 3, "act": "evaluated_heuristics", "count": 1}
89
+{"ts":3, "act": "state_update", "state_id": 8, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "1(NegatedAtom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [3, "turn_on_light r2 box1", 1]}
90
+{"ts": 3, "act": "generated_states", "state_id": 3, "op": "turn_on_light r2 box1"}
91
+{"ts":3, "act": "state_update", "state_id": 8, "g": -1, "real_g": -1}
92
+{"ts": 3, "act": "evaluated_states", "state_id": 8, "preferred": 0}
93
+{"act": "end_group"}
94
+{"act": "begin_group", "ts": 3}
95
+{"ts":3, "act": "state_update", "state_id": 8, "h_ff": 10}
96
+{"ts": 3, "act": "evaluated_heuristics", "count": 1}
97
+{"act": "end_group"}
98
+{"act": "begin_group", "ts": 4}
99
+{"ts":4, "act": "state_update", "state_id": 8, "g": 3, "real_g": 3}
100
+{"ts": 4, "act": "expanded_states", "state_id": 8}
101
+{"act": "end_group"}
102
+{"act": "begin_group", "ts": 4}
103
+{"ts":4, "act": "state_update", "state_id": 9, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "0(Atom position(r1))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "1(NegatedAtom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [8, "move r2 r1", 1]}
104
+{"ts": 4, "act": "generated_states", "state_id": 8, "op": "move r2 r1"}
105
+{"ts":4, "act": "state_update", "state_id": 9, "g": -1, "real_g": -1}
106
+{"ts": 4, "act": "evaluated_states", "state_id": 9, "preferred": 0}
107
+{"act": "end_group"}
108
+{"act": "begin_group", "ts": 4}
109
+{"ts":4, "act": "state_update", "state_id": 9, "h_ff": 10}
110
+{"ts": 4, "act": "evaluated_heuristics", "count": 1}
111
+{"ts":4, "act": "state_update", "state_id": 10, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "1(NegatedAtom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [8, "move r2 r3", 1]}
112
+{"ts": 4, "act": "generated_states", "state_id": 8, "op": "move r2 r3"}
113
+{"ts":4, "act": "state_update", "state_id": 10, "g": -1, "real_g": -1}
114
+{"ts": 4, "act": "evaluated_states", "state_id": 10, "preferred": 0}
115
+{"act": "end_group"}
116
+{"act": "begin_group", "ts": 4}
117
+{"ts":4, "act": "state_update", "state_id": 10, "h_ff": 10}
118
+{"ts": 4, "act": "evaluated_heuristics", "count": 1}
119
+{"ts":4, "act": "state_update", "state_id": 11, "state": {"var0": "0(Atom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "0(Atom position(r1))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "1(NegatedAtom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [8, "push box1 r2 r1", 1]}
120
+{"ts": 4, "act": "generated_states", "state_id": 8, "op": "push box1 r2 r1"}
121
+{"ts":4, "act": "state_update", "state_id": 11, "g": -1, "real_g": -1}
122
+{"ts": 4, "act": "evaluated_states", "state_id": 11, "preferred": 0}
123
+{"act": "end_group"}
124
+{"act": "begin_group", "ts": 4}
125
+{"ts":4, "act": "state_update", "state_id": 11, "h_ff": 11}
126
+{"ts": 4, "act": "evaluated_heuristics", "count": 1}
127
+{"ts":4, "act": "state_update", "state_id": 12, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "1(NegatedAtom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [8, "push box1 r2 r3", 1]}
128
+{"ts": 4, "act": "generated_states", "state_id": 8, "op": "push box1 r2 r3"}
129
+{"ts":4, "act": "state_update", "state_id": 12, "g": -1, "real_g": -1}
130
+{"ts": 4, "act": "evaluated_states", "state_id": 12, "preferred": 0}
131
+{"act": "end_group"}
132
+{"act": "begin_group", "ts": 4}
133
+{"ts":4, "act": "state_update", "state_id": 12, "h_ff": 9}
134
+{"ts": 4, "act": "evaluated_heuristics", "count": 1}
135
+{"ts":4, "act": "state_update", "state_id": 13, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "1(NegatedAtom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "1(Atom hold_on(left, small2))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [8, "grab small2 r2 left", 1]}
136
+{"ts": 4, "act": "generated_states", "state_id": 8, "op": "grab small2 r2 left"}
137
+{"ts":4, "act": "state_update", "state_id": 13, "g": -1, "real_g": -1}
138
+{"ts": 4, "act": "evaluated_states", "state_id": 13, "preferred": 0}
139
+{"act": "end_group"}
140
+{"act": "begin_group", "ts": 4}
141
+{"ts":4, "act": "state_update", "state_id": 13, "h_ff": 9}
142
+{"ts": 4, "act": "evaluated_heuristics", "count": 1}
143
+{"ts":4, "act": "state_update", "state_id": 14, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "1(NegatedAtom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "1(Atom hold_on(right, small2))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [8, "grab small2 r2 right", 1]}
144
+{"ts": 4, "act": "generated_states", "state_id": 8, "op": "grab small2 r2 right"}
145
+{"ts":4, "act": "state_update", "state_id": 14, "g": -1, "real_g": -1}
146
+{"ts": 4, "act": "evaluated_states", "state_id": 14, "preferred": 0}
147
+{"act": "end_group"}
148
+{"act": "begin_group", "ts": 4}
149
+{"ts":4, "act": "state_update", "state_id": 14, "h_ff": 9}
150
+{"ts": 4, "act": "evaluated_heuristics", "count": 1}
151
+{"act": "end_group"}
152
+{"act": "begin_group", "ts": 5}
153
+{"ts":5, "act": "state_update", "state_id": 12, "g": 4, "real_g": 4}
154
+{"ts": 5, "act": "expanded_states", "state_id": 12}
155
+{"act": "end_group"}
156
+{"act": "begin_group", "ts": 5}
157
+{"ts":5, "act": "state_update", "state_id": 8, "new_parent": [12, "push box1 r3 r2", 1]}
158
+{"ts": 5, "act": "generated_states", "state_id": 12, "op": "push box1 r3 r2"}
159
+{"ts":5, "act": "state_update", "state_id": 15, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [12, "turn_on_light r3 box1", 1]}
160
+{"ts": 5, "act": "generated_states", "state_id": 12, "op": "turn_on_light r3 box1"}
161
+{"ts":5, "act": "state_update", "state_id": 15, "g": -1, "real_g": -1}
162
+{"ts": 5, "act": "evaluated_states", "state_id": 15, "preferred": 0}
163
+{"act": "end_group"}
164
+{"act": "begin_group", "ts": 5}
165
+{"ts":5, "act": "state_update", "state_id": 15, "h_ff": 8}
166
+{"ts": 5, "act": "evaluated_heuristics", "count": 1}
167
+{"ts":5, "act": "state_update", "state_id": 16, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "1(NegatedAtom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [12, "move r3 r2", 1]}
168
+{"ts": 5, "act": "generated_states", "state_id": 12, "op": "move r3 r2"}
169
+{"ts":5, "act": "state_update", "state_id": 16, "g": -1, "real_g": -1}
170
+{"ts": 5, "act": "evaluated_states", "state_id": 16, "preferred": 0}
171
+{"act": "end_group"}
172
+{"act": "begin_group", "ts": 5}
173
+{"ts":5, "act": "state_update", "state_id": 16, "h_ff": 9}
174
+{"ts": 5, "act": "evaluated_heuristics", "count": 1}
175
+{"act": "end_group"}
176
+{"act": "begin_group", "ts": 6}
177
+{"ts":6, "act": "state_update", "state_id": 15, "g": 5, "real_g": 5}
178
+{"ts": 6, "act": "expanded_states", "state_id": 15}
179
+{"act": "end_group"}
180
+{"act": "begin_group", "ts": 6}
181
+{"ts":6, "act": "state_update", "state_id": 17, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [15, "push box1 r3 r2", 1]}
182
+{"ts": 6, "act": "generated_states", "state_id": 15, "op": "push box1 r3 r2"}
183
+{"ts":6, "act": "state_update", "state_id": 17, "g": -1, "real_g": -1}
184
+{"ts": 6, "act": "evaluated_states", "state_id": 17, "preferred": 0}
185
+{"act": "end_group"}
186
+{"act": "begin_group", "ts": 6}
187
+{"ts":6, "act": "state_update", "state_id": 17, "h_ff": 8}
188
+{"ts": 6, "act": "evaluated_heuristics", "count": 1}
189
+{"ts":6, "act": "state_update", "state_id": 18, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [15, "move r3 r2", 1]}
190
+{"ts": 6, "act": "generated_states", "state_id": 15, "op": "move r3 r2"}
191
+{"ts":6, "act": "state_update", "state_id": 18, "g": -1, "real_g": -1}
192
+{"ts": 6, "act": "evaluated_states", "state_id": 18, "preferred": 0}
193
+{"act": "end_group"}
194
+{"act": "begin_group", "ts": 6}
195
+{"ts":6, "act": "state_update", "state_id": 18, "h_ff": 8}
196
+{"ts": 6, "act": "evaluated_heuristics", "count": 1}
197
+{"ts":6, "act": "state_update", "state_id": 19, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "2(Atom hold_on(left, small3))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [15, "grab small3 r3 left", 1]}
198
+{"ts": 6, "act": "generated_states", "state_id": 15, "op": "grab small3 r3 left"}
199
+{"ts":6, "act": "state_update", "state_id": 19, "g": -1, "real_g": -1}
200
+{"ts": 6, "act": "evaluated_states", "state_id": 19, "preferred": 0}
201
+{"act": "end_group"}
202
+{"act": "begin_group", "ts": 6}
203
+{"ts":6, "act": "state_update", "state_id": 19, "h_ff": 7}
204
+{"ts": 6, "act": "evaluated_heuristics", "count": 1}
205
+{"ts":6, "act": "state_update", "state_id": 20, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "3(Atom hold_on(left, small4))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [15, "grab small4 r3 left", 1]}
206
+{"ts": 6, "act": "generated_states", "state_id": 15, "op": "grab small4 r3 left"}
207
+{"ts":6, "act": "state_update", "state_id": 20, "g": -1, "real_g": -1}
208
+{"ts": 6, "act": "evaluated_states", "state_id": 20, "preferred": 0}
209
+{"act": "end_group"}
210
+{"act": "begin_group", "ts": 6}
211
+{"ts":6, "act": "state_update", "state_id": 20, "h_ff": 7}
212
+{"ts": 6, "act": "evaluated_heuristics", "count": 1}
213
+{"ts":6, "act": "state_update", "state_id": 21, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "2(Atom hold_on(right, small3))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [15, "grab small3 r3 right", 1]}
214
+{"ts": 6, "act": "generated_states", "state_id": 15, "op": "grab small3 r3 right"}
215
+{"ts":6, "act": "state_update", "state_id": 21, "g": -1, "real_g": -1}
216
+{"ts": 6, "act": "evaluated_states", "state_id": 21, "preferred": 0}
217
+{"act": "end_group"}
218
+{"act": "begin_group", "ts": 6}
219
+{"ts":6, "act": "state_update", "state_id": 21, "h_ff": 7}
220
+{"ts": 6, "act": "evaluated_heuristics", "count": 1}
221
+{"ts":6, "act": "state_update", "state_id": 22, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "3(Atom hold_on(right, small4))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [15, "grab small4 r3 right", 1]}
222
+{"ts": 6, "act": "generated_states", "state_id": 15, "op": "grab small4 r3 right"}
223
+{"ts":6, "act": "state_update", "state_id": 22, "g": -1, "real_g": -1}
224
+{"ts": 6, "act": "evaluated_states", "state_id": 22, "preferred": 0}
225
+{"act": "end_group"}
226
+{"act": "begin_group", "ts": 6}
227
+{"ts":6, "act": "state_update", "state_id": 22, "h_ff": 7}
228
+{"ts": 6, "act": "evaluated_heuristics", "count": 1}
229
+{"act": "end_group"}
230
+{"act": "begin_group", "ts": 7}
231
+{"ts":7, "act": "state_update", "state_id": 19, "g": 6, "real_g": 6}
232
+{"ts": 7, "act": "expanded_states", "state_id": 19}
233
+{"act": "end_group"}
234
+{"act": "begin_group", "ts": 7}
235
+{"ts":7, "act": "state_update", "state_id": 23, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "2(Atom hold_on(left, small3))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [19, "push box1 r3 r2", 1]}
236
+{"ts": 7, "act": "generated_states", "state_id": 19, "op": "push box1 r3 r2"}
237
+{"ts":7, "act": "state_update", "state_id": 23, "g": -1, "real_g": -1}
238
+{"ts": 7, "act": "evaluated_states", "state_id": 23, "preferred": 0}
239
+{"act": "end_group"}
240
+{"act": "begin_group", "ts": 7}
241
+{"ts":7, "act": "state_update", "state_id": 23, "h_ff": 7}
242
+{"ts": 7, "act": "evaluated_heuristics", "count": 1}
243
+{"ts":7, "act": "state_update", "state_id": 24, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "2(Atom hold_on(left, small3))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [19, "move r3 r2", 1]}
244
+{"ts": 7, "act": "generated_states", "state_id": 19, "op": "move r3 r2"}
245
+{"ts":7, "act": "state_update", "state_id": 24, "g": -1, "real_g": -1}
246
+{"ts": 7, "act": "evaluated_states", "state_id": 24, "preferred": 0}
247
+{"act": "end_group"}
248
+{"act": "begin_group", "ts": 7}
249
+{"ts":7, "act": "state_update", "state_id": 24, "h_ff": 7}
250
+{"ts": 7, "act": "evaluated_heuristics", "count": 1}
251
+{"ts":7, "act": "state_update", "state_id": 25, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "2(Atom hold_on(left, small3))", "var13": "2(Atom hold_on(right, small3))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [19, "grab small3 r3 right", 1]}
252
+{"ts": 7, "act": "generated_states", "state_id": 19, "op": "grab small3 r3 right"}
253
+{"ts":7, "act": "state_update", "state_id": 25, "g": -1, "real_g": -1}
254
+{"ts": 7, "act": "evaluated_states", "state_id": 25, "preferred": 0}
255
+{"act": "end_group"}
256
+{"act": "begin_group", "ts": 7}
257
+{"ts":7, "act": "state_update", "state_id": 25, "h_ff": 9}
258
+{"ts": 7, "act": "evaluated_heuristics", "count": 1}
259
+{"ts":7, "act": "state_update", "state_id": 26, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "2(Atom hold_on(left, small3))", "var13": "3(Atom hold_on(right, small4))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [19, "grab small4 r3 right", 1]}
260
+{"ts": 7, "act": "generated_states", "state_id": 19, "op": "grab small4 r3 right"}
261
+{"ts":7, "act": "state_update", "state_id": 26, "g": -1, "real_g": -1}
262
+{"ts": 7, "act": "evaluated_states", "state_id": 26, "preferred": 0}
263
+{"act": "end_group"}
264
+{"act": "begin_group", "ts": 7}
265
+{"ts":7, "act": "state_update", "state_id": 26, "h_ff": 7}
266
+{"ts": 7, "act": "evaluated_heuristics", "count": 1}
267
+{"ts":7, "act": "state_update", "state_id": 15, "new_parent": [19, "release small3 r3 left", 1]}
268
+{"ts": 7, "act": "generated_states", "state_id": 19, "op": "release small3 r3 left"}
269
+{"act": "end_group"}
270
+{"act": "begin_group", "ts": 8}
271
+{"ts":8, "act": "state_update", "state_id": 20, "g": 6, "real_g": 6}
272
+{"ts": 8, "act": "expanded_states", "state_id": 20}
273
+{"act": "end_group"}
274
+{"act": "begin_group", "ts": 8}
275
+{"ts":8, "act": "state_update", "state_id": 27, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "3(Atom hold_on(left, small4))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [20, "push box1 r3 r2", 1]}
276
+{"ts": 8, "act": "generated_states", "state_id": 20, "op": "push box1 r3 r2"}
277
+{"ts":8, "act": "state_update", "state_id": 27, "g": -1, "real_g": -1}
278
+{"ts": 8, "act": "evaluated_states", "state_id": 27, "preferred": 0}
279
+{"act": "end_group"}
280
+{"act": "begin_group", "ts": 8}
281
+{"ts":8, "act": "state_update", "state_id": 27, "h_ff": 7}
282
+{"ts": 8, "act": "evaluated_heuristics", "count": 1}
283
+{"ts":8, "act": "state_update", "state_id": 28, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "3(Atom hold_on(left, small4))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [20, "move r3 r2", 1]}
284
+{"ts": 8, "act": "generated_states", "state_id": 20, "op": "move r3 r2"}
285
+{"ts":8, "act": "state_update", "state_id": 28, "g": -1, "real_g": -1}
286
+{"ts": 8, "act": "evaluated_states", "state_id": 28, "preferred": 0}
287
+{"act": "end_group"}
288
+{"act": "begin_group", "ts": 8}
289
+{"ts":8, "act": "state_update", "state_id": 28, "h_ff": 7}
290
+{"ts": 8, "act": "evaluated_heuristics", "count": 1}
291
+{"ts":8, "act": "state_update", "state_id": 29, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "3(Atom hold_on(left, small4))", "var13": "2(Atom hold_on(right, small3))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [20, "grab small3 r3 right", 1]}
292
+{"ts": 8, "act": "generated_states", "state_id": 20, "op": "grab small3 r3 right"}
293
+{"ts":8, "act": "state_update", "state_id": 29, "g": -1, "real_g": -1}
294
+{"ts": 8, "act": "evaluated_states", "state_id": 29, "preferred": 0}
295
+{"act": "end_group"}
296
+{"act": "begin_group", "ts": 8}
297
+{"ts":8, "act": "state_update", "state_id": 29, "h_ff": 7}
298
+{"ts": 8, "act": "evaluated_heuristics", "count": 1}
299
+{"ts":8, "act": "state_update", "state_id": 30, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "3(Atom hold_on(left, small4))", "var13": "3(Atom hold_on(right, small4))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [20, "grab small4 r3 right", 1]}
300
+{"ts": 8, "act": "generated_states", "state_id": 20, "op": "grab small4 r3 right"}
301
+{"ts":8, "act": "state_update", "state_id": 30, "g": -1, "real_g": -1}
302
+{"ts": 8, "act": "evaluated_states", "state_id": 30, "preferred": 0}
303
+{"act": "end_group"}
304
+{"act": "begin_group", "ts": 8}
305
+{"ts":8, "act": "state_update", "state_id": 30, "h_ff": 9}
306
+{"ts": 8, "act": "evaluated_heuristics", "count": 1}
307
+{"ts":8, "act": "state_update", "state_id": 15, "new_parent": [20, "release small4 r3 left", 1]}
308
+{"ts": 8, "act": "generated_states", "state_id": 20, "op": "release small4 r3 left"}
309
+{"act": "end_group"}
310
+{"act": "begin_group", "ts": 9}
311
+{"ts":9, "act": "state_update", "state_id": 21, "g": 6, "real_g": 6}
312
+{"ts": 9, "act": "expanded_states", "state_id": 21}
313
+{"act": "end_group"}
314
+{"act": "begin_group", "ts": 9}
315
+{"ts":9, "act": "state_update", "state_id": 31, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "2(Atom hold_on(right, small3))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [21, "push box1 r3 r2", 1]}
316
+{"ts": 9, "act": "generated_states", "state_id": 21, "op": "push box1 r3 r2"}
317
+{"ts":9, "act": "state_update", "state_id": 31, "g": -1, "real_g": -1}
318
+{"ts": 9, "act": "evaluated_states", "state_id": 31, "preferred": 0}
319
+{"act": "end_group"}
320
+{"act": "begin_group", "ts": 9}
321
+{"ts":9, "act": "state_update", "state_id": 31, "h_ff": 7}
322
+{"ts": 9, "act": "evaluated_heuristics", "count": 1}
323
+{"ts":9, "act": "state_update", "state_id": 32, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "2(Atom hold_on(right, small3))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [21, "move r3 r2", 1]}
324
+{"ts": 9, "act": "generated_states", "state_id": 21, "op": "move r3 r2"}
325
+{"ts":9, "act": "state_update", "state_id": 32, "g": -1, "real_g": -1}
326
+{"ts": 9, "act": "evaluated_states", "state_id": 32, "preferred": 0}
327
+{"act": "end_group"}
328
+{"act": "begin_group", "ts": 9}
329
+{"ts":9, "act": "state_update", "state_id": 32, "h_ff": 7}
330
+{"ts": 9, "act": "evaluated_heuristics", "count": 1}
331
+{"ts":9, "act": "state_update", "state_id": 25, "new_parent": [21, "grab small3 r3 left", 1]}
332
+{"ts": 9, "act": "generated_states", "state_id": 21, "op": "grab small3 r3 left"}
333
+{"ts":9, "act": "state_update", "state_id": 25, "g": 7, "real_g": 7}
334
+{"ts":9, "act": "state_update", "state_id": 29, "new_parent": [21, "grab small4 r3 left", 1]}
335
+{"ts": 9, "act": "generated_states", "state_id": 21, "op": "grab small4 r3 left"}
336
+{"ts":9, "act": "state_update", "state_id": 29, "g": 7, "real_g": 7}
337
+{"ts":9, "act": "state_update", "state_id": 15, "new_parent": [21, "release small3 r3 right", 1]}
338
+{"ts": 9, "act": "generated_states", "state_id": 21, "op": "release small3 r3 right"}
339
+{"act": "end_group"}
340
+{"act": "begin_group", "ts": 10}
341
+{"ts":10, "act": "state_update", "state_id": 22, "g": 6, "real_g": 6}
342
+{"ts": 10, "act": "expanded_states", "state_id": 22}
343
+{"act": "end_group"}
344
+{"act": "begin_group", "ts": 10}
345
+{"ts":10, "act": "state_update", "state_id": 33, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "3(Atom hold_on(right, small4))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [22, "push box1 r3 r2", 1]}
346
+{"ts": 10, "act": "generated_states", "state_id": 22, "op": "push box1 r3 r2"}
347
+{"ts":10, "act": "state_update", "state_id": 33, "g": -1, "real_g": -1}
348
+{"ts": 10, "act": "evaluated_states", "state_id": 33, "preferred": 0}
349
+{"act": "end_group"}
350
+{"act": "begin_group", "ts": 10}
351
+{"ts":10, "act": "state_update", "state_id": 33, "h_ff": 7}
352
+{"ts": 10, "act": "evaluated_heuristics", "count": 1}
353
+{"ts":10, "act": "state_update", "state_id": 34, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "3(Atom hold_on(right, small4))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [22, "move r3 r2", 1]}
354
+{"ts": 10, "act": "generated_states", "state_id": 22, "op": "move r3 r2"}
355
+{"ts":10, "act": "state_update", "state_id": 34, "g": -1, "real_g": -1}
356
+{"ts": 10, "act": "evaluated_states", "state_id": 34, "preferred": 0}
357
+{"act": "end_group"}
358
+{"act": "begin_group", "ts": 10}
359
+{"ts":10, "act": "state_update", "state_id": 34, "h_ff": 7}
360
+{"ts": 10, "act": "evaluated_heuristics", "count": 1}
361
+{"ts":10, "act": "state_update", "state_id": 26, "new_parent": [22, "grab small3 r3 left", 1]}
362
+{"ts": 10, "act": "generated_states", "state_id": 22, "op": "grab small3 r3 left"}
363
+{"ts":10, "act": "state_update", "state_id": 26, "g": 7, "real_g": 7}
364
+{"ts":10, "act": "state_update", "state_id": 30, "new_parent": [22, "grab small4 r3 left", 1]}
365
+{"ts": 10, "act": "generated_states", "state_id": 22, "op": "grab small4 r3 left"}
366
+{"ts":10, "act": "state_update", "state_id": 30, "g": 7, "real_g": 7}
367
+{"ts":10, "act": "state_update", "state_id": 15, "new_parent": [22, "release small4 r3 right", 1]}
368
+{"ts": 10, "act": "generated_states", "state_id": 22, "op": "release small4 r3 right"}
369
+{"act": "end_group"}
370
+{"act": "begin_group", "ts": 11}
371
+{"ts":11, "act": "state_update", "state_id": 23, "g": 7, "real_g": 7}
372
+{"ts": 11, "act": "expanded_states", "state_id": 23}
373
+{"act": "end_group"}
374
+{"act": "begin_group", "ts": 11}
375
+{"ts":11, "act": "state_update", "state_id": 35, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "0(Atom position(r1))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "2(Atom hold_on(left, small3))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [23, "move r2 r1", 1]}
376
+{"ts": 11, "act": "generated_states", "state_id": 23, "op": "move r2 r1"}
377
+{"ts":11, "act": "state_update", "state_id": 35, "g": -1, "real_g": -1}
378
+{"ts": 11, "act": "evaluated_states", "state_id": 35, "preferred": 0}
379
+{"act": "end_group"}
380
+{"act": "begin_group", "ts": 11}
381
+{"ts":11, "act": "state_update", "state_id": 35, "h_ff": 7}
382
+{"ts": 11, "act": "evaluated_heuristics", "count": 1}
383
+{"ts":11, "act": "state_update", "state_id": 36, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "2(Atom hold_on(left, small3))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [23, "move r2 r3", 1]}
384
+{"ts": 11, "act": "generated_states", "state_id": 23, "op": "move r2 r3"}
385
+{"ts":11, "act": "state_update", "state_id": 36, "g": -1, "real_g": -1}
386
+{"ts": 11, "act": "evaluated_states", "state_id": 36, "preferred": 0}
387
+{"act": "end_group"}
388
+{"act": "begin_group", "ts": 11}
389
+{"ts":11, "act": "state_update", "state_id": 36, "h_ff": 7}
390
+{"ts": 11, "act": "evaluated_heuristics", "count": 1}
391
+{"ts":11, "act": "state_update", "state_id": 37, "state": {"var0": "0(Atom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "0(Atom position(r1))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "2(Atom hold_on(left, small3))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [23, "push box1 r2 r1", 1]}
392
+{"ts": 11, "act": "generated_states", "state_id": 23, "op": "push box1 r2 r1"}
393
+{"ts":11, "act": "state_update", "state_id": 37, "g": -1, "real_g": -1}
394
+{"ts": 11, "act": "evaluated_states", "state_id": 37, "preferred": 0}
395
+{"act": "end_group"}
396
+{"act": "begin_group", "ts": 11}
397
+{"ts":11, "act": "state_update", "state_id": 37, "h_ff": 7}
398
+{"ts": 11, "act": "evaluated_heuristics", "count": 1}
399
+{"ts":11, "act": "state_update", "state_id": 19, "new_parent": [23, "push box1 r2 r3", 1]}
400
+{"ts": 11, "act": "generated_states", "state_id": 23, "op": "push box1 r2 r3"}
401
+{"ts":11, "act": "state_update", "state_id": 38, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "2(Atom hold_on(left, small3))", "var13": "1(Atom hold_on(right, small2))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [23, "grab small2 r2 right", 1]}
402
+{"ts": 11, "act": "generated_states", "state_id": 23, "op": "grab small2 r2 right"}
403
+{"ts":11, "act": "state_update", "state_id": 38, "g": -1, "real_g": -1}
404
+{"ts": 11, "act": "evaluated_states", "state_id": 38, "preferred": 0}
405
+{"act": "end_group"}
406
+{"act": "begin_group", "ts": 11}
407
+{"ts":11, "act": "state_update", "state_id": 38, "h_ff": 7}
408
+{"ts": 11, "act": "evaluated_heuristics", "count": 1}
409
+{"ts":11, "act": "state_update", "state_id": 39, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "0(Atom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [23, "release small3 r2 left", 1]}
410
+{"ts": 11, "act": "generated_states", "state_id": 23, "op": "release small3 r2 left"}
411
+{"ts":11, "act": "state_update", "state_id": 39, "g": -1, "real_g": -1}
412
+{"ts": 11, "act": "evaluated_states", "state_id": 39, "preferred": 0}
413
+{"act": "end_group"}
414
+{"act": "begin_group", "ts": 11}
415
+{"ts":11, "act": "state_update", "state_id": 39, "h_ff": 8}
416
+{"ts": 11, "act": "evaluated_heuristics", "count": 1}
417
+{"act": "end_group"}
418
+{"act": "begin_group", "ts": 12}
419
+{"ts":12, "act": "state_update", "state_id": 24, "g": 7, "real_g": 7}
420
+{"ts": 12, "act": "expanded_states", "state_id": 24}
421
+{"act": "end_group"}
422
+{"act": "begin_group", "ts": 12}
423
+{"ts":12, "act": "state_update", "state_id": 40, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "0(Atom position(r1))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "2(Atom hold_on(left, small3))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [24, "move r2 r1", 1]}
424
+{"ts": 12, "act": "generated_states", "state_id": 24, "op": "move r2 r1"}
425
+{"ts":12, "act": "state_update", "state_id": 40, "g": -1, "real_g": -1}
426
+{"ts": 12, "act": "evaluated_states", "state_id": 40, "preferred": 0}
427
+{"act": "end_group"}
428
+{"act": "begin_group", "ts": 12}
429
+{"ts":12, "act": "state_update", "state_id": 40, "h_ff": 7}
430
+{"ts": 12, "act": "evaluated_heuristics", "count": 1}
431
+{"ts":12, "act": "state_update", "state_id": 19, "new_parent": [24, "move r2 r3", 1]}
432
+{"ts": 12, "act": "generated_states", "state_id": 24, "op": "move r2 r3"}
433
+{"ts":12, "act": "state_update", "state_id": 41, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "2(Atom hold_on(left, small3))", "var13": "1(Atom hold_on(right, small2))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [24, "grab small2 r2 right", 1]}
434
+{"ts": 12, "act": "generated_states", "state_id": 24, "op": "grab small2 r2 right"}
435
+{"ts":12, "act": "state_update", "state_id": 41, "g": -1, "real_g": -1}
436
+{"ts": 12, "act": "evaluated_states", "state_id": 41, "preferred": 0}
437
+{"act": "end_group"}
438
+{"act": "begin_group", "ts": 12}
439
+{"ts":12, "act": "state_update", "state_id": 41, "h_ff": 7}
440
+{"ts": 12, "act": "evaluated_heuristics", "count": 1}
441
+{"ts":12, "act": "state_update", "state_id": 42, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "0(Atom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [24, "release small3 r2 left", 1]}
442
+{"ts": 12, "act": "generated_states", "state_id": 24, "op": "release small3 r2 left"}
443
+{"ts":12, "act": "state_update", "state_id": 42, "g": -1, "real_g": -1}
444
+{"ts": 12, "act": "evaluated_states", "state_id": 42, "preferred": 0}
445
+{"act": "end_group"}
446
+{"act": "begin_group", "ts": 12}
447
+{"ts":12, "act": "state_update", "state_id": 42, "h_ff": 8}
448
+{"ts": 12, "act": "evaluated_heuristics", "count": 1}
449
+{"act": "end_group"}
450
+{"act": "begin_group", "ts": 13}
451
+{"ts": 13, "act": "expanded_states", "state_id": 26}
452
+{"act": "end_group"}
453
+{"act": "begin_group", "ts": 13}
454
+{"ts":13, "act": "state_update", "state_id": 43, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "2(Atom hold_on(left, small3))", "var13": "3(Atom hold_on(right, small4))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [26, "push box1 r3 r2", 1]}
455
+{"ts": 13, "act": "generated_states", "state_id": 26, "op": "push box1 r3 r2"}
456
+{"ts":13, "act": "state_update", "state_id": 43, "g": -1, "real_g": -1}
457
+{"ts": 13, "act": "evaluated_states", "state_id": 43, "preferred": 0}
458
+{"act": "end_group"}
459
+{"act": "begin_group", "ts": 13}
460
+{"ts":13, "act": "state_update", "state_id": 43, "h_ff": 6}
461
+{"ts": 13, "act": "evaluated_heuristics", "count": 1}
462
+{"ts":13, "act": "state_update", "state_id": 44, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "2(Atom hold_on(left, small3))", "var13": "3(Atom hold_on(right, small4))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [26, "move r3 r2", 1]}
463
+{"ts": 13, "act": "generated_states", "state_id": 26, "op": "move r3 r2"}
464
+{"ts":13, "act": "state_update", "state_id": 44, "g": -1, "real_g": -1}
465
+{"ts": 13, "act": "evaluated_states", "state_id": 44, "preferred": 0}
466
+{"act": "end_group"}
467
+{"act": "begin_group", "ts": 13}
468
+{"ts":13, "act": "state_update", "state_id": 44, "h_ff": 6}
469
+{"ts": 13, "act": "evaluated_heuristics", "count": 1}
470
+{"ts":13, "act": "state_update", "state_id": 22, "new_parent": [26, "release small3 r3 left", 1]}
471
+{"ts": 13, "act": "generated_states", "state_id": 26, "op": "release small3 r3 left"}
472
+{"ts":13, "act": "state_update", "state_id": 19, "new_parent": [26, "release small4 r3 right", 1]}
473
+{"ts": 13, "act": "generated_states", "state_id": 26, "op": "release small4 r3 right"}
474
+{"act": "end_group"}
475
+{"act": "begin_group", "ts": 14}
476
+{"ts":14, "act": "state_update", "state_id": 43, "g": 8, "real_g": 8}
477
+{"ts": 14, "act": "expanded_states", "state_id": 43}
478
+{"act": "end_group"}
479
+{"act": "begin_group", "ts": 14}
480
+{"ts":14, "act": "state_update", "state_id": 45, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "0(Atom position(r1))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "2(Atom hold_on(left, small3))", "var13": "3(Atom hold_on(right, small4))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [43, "move r2 r1", 1]}
481
+{"ts": 14, "act": "generated_states", "state_id": 43, "op": "move r2 r1"}
482
+{"ts":14, "act": "state_update", "state_id": 45, "g": -1, "real_g": -1}
483
+{"ts": 14, "act": "evaluated_states", "state_id": 45, "preferred": 0}
484
+{"act": "end_group"}
485
+{"act": "begin_group", "ts": 14}
486
+{"ts":14, "act": "state_update", "state_id": 45, "h_ff": 5}
487
+{"ts": 14, "act": "evaluated_heuristics", "count": 1}
488
+{"ts":14, "act": "state_update", "state_id": 46, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "2(Atom hold_on(left, small3))", "var13": "3(Atom hold_on(right, small4))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [43, "move r2 r3", 1]}
489
+{"ts": 14, "act": "generated_states", "state_id": 43, "op": "move r2 r3"}
490
+{"ts":14, "act": "state_update", "state_id": 46, "g": -1, "real_g": -1}
491
+{"ts": 14, "act": "evaluated_states", "state_id": 46, "preferred": 0}
492
+{"act": "end_group"}
493
+{"act": "begin_group", "ts": 14}
494
+{"ts":14, "act": "state_update", "state_id": 46, "h_ff": 7}
495
+{"ts": 14, "act": "evaluated_heuristics", "count": 1}
496
+{"ts":14, "act": "state_update", "state_id": 47, "state": {"var0": "0(Atom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "0(Atom position(r1))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "2(Atom hold_on(left, small3))", "var13": "3(Atom hold_on(right, small4))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [43, "push box1 r2 r1", 1]}
497
+{"ts": 14, "act": "generated_states", "state_id": 43, "op": "push box1 r2 r1"}
498
+{"ts":14, "act": "state_update", "state_id": 47, "g": -1, "real_g": -1}
499
+{"ts": 14, "act": "evaluated_states", "state_id": 47, "preferred": 0}
500
+{"act": "end_group"}
501
+{"act": "begin_group", "ts": 14}
502
+{"ts":14, "act": "state_update", "state_id": 47, "h_ff": 5}
503
+{"ts": 14, "act": "evaluated_heuristics", "count": 1}
504
+{"ts":14, "act": "state_update", "state_id": 26, "new_parent": [43, "push box1 r2 r3", 1]}
505
+{"ts": 14, "act": "generated_states", "state_id": 43, "op": "push box1 r2 r3"}
506
+{"ts":14, "act": "state_update", "state_id": 48, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "0(Atom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "3(Atom hold_on(right, small4))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [43, "release small3 r2 left", 1]}
507
+{"ts": 14, "act": "generated_states", "state_id": 43, "op": "release small3 r2 left"}
508
+{"ts":14, "act": "state_update", "state_id": 48, "g": -1, "real_g": -1}
509
+{"ts": 14, "act": "evaluated_states", "state_id": 48, "preferred": 0}
510
+{"act": "end_group"}
511
+{"act": "begin_group", "ts": 14}
512
+{"ts":14, "act": "state_update", "state_id": 48, "h_ff": 6}
513
+{"ts": 14, "act": "evaluated_heuristics", "count": 1}
514
+{"ts":14, "act": "state_update", "state_id": 49, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "0(Atom in(small4, r2))", "var12": "2(Atom hold_on(left, small3))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [43, "release small4 r2 right", 1]}
515
+{"ts": 14, "act": "generated_states", "state_id": 43, "op": "release small4 r2 right"}
516
+{"ts":14, "act": "state_update", "state_id": 49, "g": -1, "real_g": -1}
517
+{"ts": 14, "act": "evaluated_states", "state_id": 49, "preferred": 0}
518
+{"act": "end_group"}
519
+{"act": "begin_group", "ts": 14}
520
+{"ts":14, "act": "state_update", "state_id": 49, "h_ff": 6}
521
+{"ts": 14, "act": "evaluated_heuristics", "count": 1}
522
+{"act": "end_group"}
523
+{"act": "begin_group", "ts": 15}
524
+{"ts":15, "act": "state_update", "state_id": 45, "g": 9, "real_g": 9}
525
+{"ts": 15, "act": "expanded_states", "state_id": 45}
526
+{"act": "end_group"}
527
+{"act": "begin_group", "ts": 15}
528
+{"ts":15, "act": "state_update", "state_id": 43, "new_parent": [45, "move r1 r2", 1]}
529
+{"ts": 15, "act": "generated_states", "state_id": 45, "op": "move r1 r2"}
530
+{"ts":15, "act": "state_update", "state_id": 50, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "0(Atom position(r1))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "3(Atom hold_on(right, small4))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "0(Atom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [45, "release small3 r1 left", 1]}
531
+{"ts": 15, "act": "generated_states", "state_id": 45, "op": "release small3 r1 left"}
532
+{"ts":15, "act": "state_update", "state_id": 50, "g": -1, "real_g": -1}
533
+{"ts": 15, "act": "evaluated_states", "state_id": 50, "preferred": 0}
534
+{"act": "end_group"}
535
+{"act": "begin_group", "ts": 15}
536
+{"ts":15, "act": "state_update", "state_id": 50, "h_ff": 4}
537
+{"ts": 15, "act": "evaluated_heuristics", "count": 1}
538
+{"ts":15, "act": "state_update", "state_id": 51, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "0(Atom position(r1))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "2(Atom hold_on(left, small3))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "1(NegatedAtom in(small3, r1))", "var16": "0(Atom in(small4, r1))"}, "new_parent": [45, "release small4 r1 right", 1]}
539
+{"ts": 15, "act": "generated_states", "state_id": 45, "op": "release small4 r1 right"}
540
+{"ts":15, "act": "state_update", "state_id": 51, "g": -1, "real_g": -1}
541
+{"ts": 15, "act": "evaluated_states", "state_id": 51, "preferred": 0}
542
+{"act": "end_group"}
543
+{"act": "begin_group", "ts": 15}
544
+{"ts":15, "act": "state_update", "state_id": 51, "h_ff": 4}
545
+{"ts": 15, "act": "evaluated_heuristics", "count": 1}
546
+{"act": "end_group"}
547
+{"act": "begin_group", "ts": 16}
548
+{"ts":16, "act": "state_update", "state_id": 50, "g": 10, "real_g": 10}
549
+{"ts": 16, "act": "expanded_states", "state_id": 50}
550
+{"act": "end_group"}
551
+{"act": "begin_group", "ts": 16}
552
+{"ts":16, "act": "state_update", "state_id": 52, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "3(Atom hold_on(right, small4))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "0(Atom in(small3, r1))", "var16": "1(NegatedAtom in(small4, r1))"}, "new_parent": [50, "move r1 r2", 1]}
553
+{"ts": 16, "act": "generated_states", "state_id": 50, "op": "move r1 r2"}
554
+{"ts":16, "act": "state_update", "state_id": 52, "g": -1, "real_g": -1}
555
+{"ts": 16, "act": "evaluated_states", "state_id": 52, "preferred": 0}
556
+{"act": "end_group"}
557
+{"act": "begin_group", "ts": 16}
558
+{"ts":16, "act": "state_update", "state_id": 52, "h_ff": 4}
559
+{"ts": 16, "act": "evaluated_heuristics", "count": 1}
560
+{"ts":16, "act": "state_update", "state_id": 53, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "0(Atom position(r1))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "0(Atom in(small3, r1))", "var16": "0(Atom in(small4, r1))"}, "new_parent": [50, "release small4 r1 right", 1]}
561
+{"ts": 16, "act": "generated_states", "state_id": 50, "op": "release small4 r1 right"}
562
+{"ts":16, "act": "state_update", "state_id": 53, "g": -1, "real_g": -1}
563
+{"ts": 16, "act": "evaluated_states", "state_id": 53, "preferred": 0}
564
+{"act": "end_group"}
565
+{"act": "begin_group", "ts": 16}
566
+{"ts":16, "act": "state_update", "state_id": 53, "h_ff": 3}
567
+{"ts": 16, "act": "evaluated_heuristics", "count": 1}
568
+{"act": "end_group"}
569
+{"act": "begin_group", "ts": 17}
570
+{"ts":17, "act": "state_update", "state_id": 53, "g": 11, "real_g": 11}
571
+{"ts": 17, "act": "expanded_states", "state_id": 53}
572
+{"act": "end_group"}
573
+{"act": "begin_group", "ts": 17}
574
+{"ts":17, "act": "state_update", "state_id": 54, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "0(Atom in(small3, r1))", "var16": "0(Atom in(small4, r1))"}, "new_parent": [53, "move r1 r2", 1]}
575
+{"ts": 17, "act": "generated_states", "state_id": 53, "op": "move r1 r2"}
576
+{"ts":17, "act": "state_update", "state_id": 54, "g": -1, "real_g": -1}
577
+{"ts": 17, "act": "evaluated_states", "state_id": 54, "preferred": 0}
578
+{"act": "end_group"}
579
+{"act": "begin_group", "ts": 17}
580
+{"ts":17, "act": "state_update", "state_id": 54, "h_ff": 3}
581
+{"ts": 17, "act": "evaluated_heuristics", "count": 1}
582
+{"act": "end_group"}
583
+{"act": "begin_group", "ts": 18}
584
+{"ts":18, "act": "state_update", "state_id": 54, "g": 12, "real_g": 12}
585
+{"ts": 18, "act": "expanded_states", "state_id": 54}
586
+{"act": "end_group"}
587
+{"act": "begin_group", "ts": 18}
588
+{"ts":18, "act": "state_update", "state_id": 53, "new_parent": [54, "move r2 r1", 1]}
589
+{"ts": 18, "act": "generated_states", "state_id": 54, "op": "move r2 r1"}
590
+{"ts":18, "act": "state_update", "state_id": 55, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "0(Atom in(small3, r1))", "var16": "0(Atom in(small4, r1))"}, "new_parent": [54, "move r2 r3", 1]}
591
+{"ts": 18, "act": "generated_states", "state_id": 54, "op": "move r2 r3"}
592
+{"ts":18, "act": "state_update", "state_id": 55, "g": -1, "real_g": -1}
593
+{"ts": 18, "act": "evaluated_states", "state_id": 55, "preferred": 0}
594
+{"act": "end_group"}
595
+{"act": "begin_group", "ts": 18}
596
+{"ts":18, "act": "state_update", "state_id": 55, "h_ff": 4}
597
+{"ts": 18, "act": "evaluated_heuristics", "count": 1}
598
+{"ts":18, "act": "state_update", "state_id": 56, "state": {"var0": "0(Atom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "0(Atom position(r1))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "0(Atom in(small3, r1))", "var16": "0(Atom in(small4, r1))"}, "new_parent": [54, "push box1 r2 r1", 1]}
599
+{"ts": 18, "act": "generated_states", "state_id": 54, "op": "push box1 r2 r1"}
600
+{"ts":18, "act": "state_update", "state_id": 56, "g": -1, "real_g": -1}
601
+{"ts": 18, "act": "evaluated_states", "state_id": 56, "preferred": 0}
602
+{"act": "end_group"}
603
+{"act": "begin_group", "ts": 18}
604
+{"ts":18, "act": "state_update", "state_id": 56, "h_ff": 3}
605
+{"ts": 18, "act": "evaluated_heuristics", "count": 1}
606
+{"ts":18, "act": "state_update", "state_id": 57, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "0(Atom in(small3, r1))", "var16": "0(Atom in(small4, r1))"}, "new_parent": [54, "push box1 r2 r3", 1]}
607
+{"ts": 18, "act": "generated_states", "state_id": 54, "op": "push box1 r2 r3"}
608
+{"ts":18, "act": "state_update", "state_id": 57, "g": -1, "real_g": -1}
609
+{"ts": 18, "act": "evaluated_states", "state_id": 57, "preferred": 0}
610
+{"act": "end_group"}
611
+{"act": "begin_group", "ts": 18}
612
+{"ts":18, "act": "state_update", "state_id": 57, "h_ff": 4}
613
+{"ts": 18, "act": "evaluated_heuristics", "count": 1}
614
+{"ts":18, "act": "state_update", "state_id": 58, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "1(Atom hold_on(left, small2))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "0(Atom in(small3, r1))", "var16": "0(Atom in(small4, r1))"}, "new_parent": [54, "grab small2 r2 left", 1]}
615
+{"ts": 18, "act": "generated_states", "state_id": 54, "op": "grab small2 r2 left"}
616
+{"ts":18, "act": "state_update", "state_id": 58, "g": -1, "real_g": -1}
617
+{"ts": 18, "act": "evaluated_states", "state_id": 58, "preferred": 0}
618
+{"act": "end_group"}
619
+{"act": "begin_group", "ts": 18}
620
+{"ts":18, "act": "state_update", "state_id": 58, "h_ff": 2}
621
+{"ts": 18, "act": "evaluated_heuristics", "count": 1}
622
+{"ts":18, "act": "state_update", "state_id": 59, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "1(Atom hold_on(right, small2))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "0(Atom in(small3, r1))", "var16": "0(Atom in(small4, r1))"}, "new_parent": [54, "grab small2 r2 right", 1]}
623
+{"ts": 18, "act": "generated_states", "state_id": 54, "op": "grab small2 r2 right"}
624
+{"ts":18, "act": "state_update", "state_id": 59, "g": -1, "real_g": -1}
625
+{"ts": 18, "act": "evaluated_states", "state_id": 59, "preferred": 0}
626
+{"act": "end_group"}
627
+{"act": "begin_group", "ts": 18}
628
+{"ts":18, "act": "state_update", "state_id": 59, "h_ff": 2}
629
+{"ts": 18, "act": "evaluated_heuristics", "count": 1}
630
+{"act": "end_group"}
631
+{"act": "begin_group", "ts": 19}
632
+{"ts":19, "act": "state_update", "state_id": 58, "g": 13, "real_g": 13}
633
+{"ts": 19, "act": "expanded_states", "state_id": 58}
634
+{"act": "end_group"}
635
+{"act": "begin_group", "ts": 19}
636
+{"ts":19, "act": "state_update", "state_id": 60, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "0(Atom position(r1))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "1(Atom hold_on(left, small2))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "0(Atom in(small3, r1))", "var16": "0(Atom in(small4, r1))"}, "new_parent": [58, "move r2 r1", 1]}
637
+{"ts": 19, "act": "generated_states", "state_id": 58, "op": "move r2 r1"}
638
+{"ts":19, "act": "state_update", "state_id": 60, "g": -1, "real_g": -1}
639
+{"ts": 19, "act": "evaluated_states", "state_id": 60, "preferred": 0}
640
+{"act": "end_group"}
641
+{"act": "begin_group", "ts": 19}
642
+{"ts":19, "act": "state_update", "state_id": 60, "h_ff": 1}
643
+{"ts": 19, "act": "evaluated_heuristics", "count": 1}
644
+{"ts":19, "act": "state_update", "state_id": 61, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "1(Atom hold_on(left, small2))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "0(Atom in(small3, r1))", "var16": "0(Atom in(small4, r1))"}, "new_parent": [58, "move r2 r3", 1]}
645
+{"ts": 19, "act": "generated_states", "state_id": 58, "op": "move r2 r3"}
646
+{"ts":19, "act": "state_update", "state_id": 61, "g": -1, "real_g": -1}
647
+{"ts": 19, "act": "evaluated_states", "state_id": 61, "preferred": 0}
648
+{"act": "end_group"}
649
+{"act": "begin_group", "ts": 19}
650
+{"ts":19, "act": "state_update", "state_id": 61, "h_ff": 3}
651
+{"ts": 19, "act": "evaluated_heuristics", "count": 1}
652
+{"ts":19, "act": "state_update", "state_id": 62, "state": {"var0": "0(Atom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "0(Atom position(r1))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "1(Atom hold_on(left, small2))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "0(Atom in(small3, r1))", "var16": "0(Atom in(small4, r1))"}, "new_parent": [58, "push box1 r2 r1", 1]}
653
+{"ts": 19, "act": "generated_states", "state_id": 58, "op": "push box1 r2 r1"}
654
+{"ts":19, "act": "state_update", "state_id": 62, "g": -1, "real_g": -1}
655
+{"ts": 19, "act": "evaluated_states", "state_id": 62, "preferred": 0}
656
+{"act": "end_group"}
657
+{"act": "begin_group", "ts": 19}
658
+{"ts":19, "act": "state_update", "state_id": 62, "h_ff": 1}
659
+{"ts": 19, "act": "evaluated_heuristics", "count": 1}
660
+{"ts":19, "act": "state_update", "state_id": 63, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "0(Atom in(box1, r3))", "var2": "2(Atom position(r3))", "var3": "1(NegatedAtom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "1(Atom hold_on(left, small2))", "var13": "4(Atom is_empty(right))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "0(Atom in(small3, r1))", "var16": "0(Atom in(small4, r1))"}, "new_parent": [58, "push box1 r2 r3", 1]}
661
+{"ts": 19, "act": "generated_states", "state_id": 58, "op": "push box1 r2 r3"}
662
+{"ts":19, "act": "state_update", "state_id": 63, "g": -1, "real_g": -1}
663
+{"ts": 19, "act": "evaluated_states", "state_id": 63, "preferred": 0}
664
+{"act": "end_group"}
665
+{"act": "begin_group", "ts": 19}
666
+{"ts":19, "act": "state_update", "state_id": 63, "h_ff": 3}
667
+{"ts": 19, "act": "evaluated_heuristics", "count": 1}
668
+{"ts":19, "act": "state_update", "state_id": 64, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "1(Atom position(r2))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "1(Atom hold_on(left, small2))", "var13": "1(Atom hold_on(right, small2))", "var14": "1(NegatedAtom in(small2, r1))", "var15": "0(Atom in(small3, r1))", "var16": "0(Atom in(small4, r1))"}, "new_parent": [58, "grab small2 r2 right", 1]}
669
+{"ts": 19, "act": "generated_states", "state_id": 58, "op": "grab small2 r2 right"}
670
+{"ts":19, "act": "state_update", "state_id": 64, "g": -1, "real_g": -1}
671
+{"ts": 19, "act": "evaluated_states", "state_id": 64, "preferred": 0}
672
+{"act": "end_group"}
673
+{"act": "begin_group", "ts": 19}
674
+{"ts":19, "act": "state_update", "state_id": 64, "h_ff": 2}
675
+{"ts": 19, "act": "evaluated_heuristics", "count": 1}
676
+{"ts":19, "act": "state_update", "state_id": 54, "new_parent": [58, "release small2 r2 left", 1]}
677
+{"ts": 19, "act": "generated_states", "state_id": 58, "op": "release small2 r2 left"}
678
+{"act": "end_group"}
679
+{"act": "begin_group", "ts": 20}
680
+{"ts":20, "act": "state_update", "state_id": 60, "g": 14, "real_g": 14}
681
+{"ts": 20, "act": "expanded_states", "state_id": 60}
682
+{"act": "end_group"}
683
+{"act": "begin_group", "ts": 20}
684
+{"ts":20, "act": "state_update", "state_id": 58, "new_parent": [60, "move r1 r2", 1]}
685
+{"ts": 20, "act": "generated_states", "state_id": 60, "op": "move r1 r2"}
686
+{"ts":20, "act": "state_update", "state_id": 65, "state": {"var0": "1(NegatedAtom in(box1, r1))", "var1": "1(NegatedAtom in(box1, r3))", "var2": "0(Atom position(r1))", "var3": "0(Atom in(box1, r2))", "var4": "0(Atom light(r2))", "var5": "1(NegatedAtom light(r1))", "var6": "0(Atom light(r3))", "var7": "1(NegatedAtom in(small1, r2))", "var8": "1(NegatedAtom in(small1, r3))", "var9": "1(NegatedAtom in(small2, r3))", "var10": "1(NegatedAtom in(small3, r2))", "var11": "1(NegatedAtom in(small4, r2))", "var12": "4(Atom is_empty(left))", "var13": "4(Atom is_empty(right))", "var14": "0(Atom in(small2, r1))", "var15": "0(Atom in(small3, r1))", "var16": "0(Atom in(small4, r1))"}, "new_parent": [60, "release small2 r1 left", 1]}
687
+{"ts": 20, "act": "generated_states", "state_id": 60, "op": "release small2 r1 left"}
688
+{"ts":20, "act": "state_update", "state_id": 65, "g": -1, "real_g": -1}
689
+{"ts": 20, "act": "evaluated_states", "state_id": 65, "preferred": 0}
690
+{"act": "end_group"}
691
+{"act": "begin_group", "ts": 20}
692
+{"ts":20, "act": "state_update", "state_id": 65, "h_ff": 0}
693
+{"ts": 20, "act": "evaluated_heuristics", "count": 1}
694
+{"act": "end_group"}
695
+{"act": "begin_group", "ts": 21}
696
+{"ts":21, "act": "state_update", "state_id": 65, "g": 15, "real_g": 15}
697
+{"ts": 21, "act": "expanded_states", "state_id": 65}
698
+{"act": "end_group"}
699
+{"ts": 21, "act": "plan_found", "state_ids": [0, 1, 3, 8, 12, 15, 19, 26, 43, 45, 50, 53, 54, 58, 60, 65]}

+ 7134
- 0
lab4/part2/output_shakey/output-config2gc-shakey.txt
File diff suppressed because it is too large
View File


+ 1871
- 0
lab4/part2/output_shakey/output-config3gf-shakey.txt
File diff suppressed because it is too large
View File


+ 5128
- 0
lab4/part2/p02.pddl
File diff suppressed because it is too large
View File


+ 16559
- 0
lab4/part2/p03.pddl
File diff suppressed because it is too large
View File


+ 308
- 0
lab5/QLearningController.java View File

1
+import java.text.DecimalFormat;
2
+import java.text.NumberFormat;
3
+import java.util.Hashtable;
4
+import java.util.Locale;
5
+import java.util.Random;
6
+
7
+// TDDC17 - Lab 5
8
+// Part 2: Q Learning Controller
9
+// Last modification: 2020-10-06
10
+
11
+/* GUI commands :
12
+ * 		M : disable GUI, much faster
13
+ * 		E : toggle exploration
14
+ * 		V : Speed up learning
15
+ * 		P : turn off controller
16
+ * 		O : turn on controller
17
+ * 		W, A, S, D : manual commands
18
+ */
19
+
20
+/* TODO: 
21
+ * -Define state and reward functions (StateAndReward.java) suitable for your problem --> done.
22
+ * -Define actions --> done.
23
+ * -Implement missing parts of Q-learning --> done.
24
+ * -Tune state and reward function, and parameters below if the result is not satisfactory */
25
+
26
+public class QLearningController extends Controller {
27
+	// Change this value for part 3 (State & reward hover)
28
+	boolean HOVER_MODE = true;
29
+	
30
+	/* These are the agents senses (inputs) */
31
+	DoubleFeature x; /* Positions */
32
+	DoubleFeature y;
33
+	DoubleFeature vx; /* Velocities */
34
+	DoubleFeature vy;
35
+	DoubleFeature angle; /* Angle */
36
+
37
+	/* These are the agents actuators (outputs)*/
38
+	RocketEngine leftEngine;
39
+	RocketEngine middleEngine;
40
+	RocketEngine rightEngine;
41
+
42
+	final static int NUM_ACTIONS = 7; /* The takeAction function must be changed if this is modified */
43
+	
44
+	/* Keep track of the previous state and action */
45
+	String previous_state = null;
46
+	double previous_vx = 0;
47
+	double previous_vy = 0;
48
+	double previous_angle = 0;
49
+	int previous_action = 0; 
50
+	
51
+	/* The tables used by Q-learning */
52
+	Hashtable<String, Double> Qtable = new Hashtable<String, Double>(); /* Contains the Q-values - the state-action utilities */
53
+	Hashtable<String, Integer> Ntable = new Hashtable<String, Integer>(); /* Keeps track of how many times each state-action combination has been used */
54
+
55
+	/* PARAMETERS OF THE LEARNING ALGORITHM - THESE MAY BE TUNED BUT THE DEFAULT VALUES OFTEN WORK REASONABLY WELL  */
56
+	static final double GAMMA_DISCOUNT_FACTOR = 0.95; /* Must be < 1, small values make it very greedy */
57
+	static final double LEARNING_RATE_CONSTANT = 10; /* See alpha(), lower values are good for quick results in large and deterministic state spaces */
58
+	double explore_chance = 0.5; /* The exploration chance during the exploration phase */
59
+	final static int REPEAT_ACTION_MAX = 30; /* Repeat selected action at most this many times trying reach a new state, without a max it could loop forever if the action cannot lead to a new state */
60
+
61
+	/* Some internal counters */
62
+	int iteration = 0; /* Keeps track of how many iterations the agent has run */
63
+	int action_counter = 0; /* Keeps track of how many times we have repeated the current action */
64
+	int print_counter = 0; /* Makes printouts less spammy */ 
65
+
66
+	/* These are just internal helper variables, you can ignore these */
67
+	boolean paused = false;
68
+	boolean explore = true; /* Will always do exploration by default */
69
+
70
+	DecimalFormat df = (DecimalFormat) NumberFormat.getNumberInstance(Locale.US); 
71
+	public SpringObject object;
72
+	ComposedSpringObject cso;
73
+	long lastPressedExplore = 0;
74
+
75
+	public void init() {
76
+		cso = (ComposedSpringObject) object;
77
+		x = (DoubleFeature) cso.getObjectById("x");
78
+		y = (DoubleFeature) cso.getObjectById("y");
79
+		vx = (DoubleFeature) cso.getObjectById("vx");
80
+		vy = (DoubleFeature) cso.getObjectById("vy");
81
+		angle = (DoubleFeature) cso.getObjectById("angle");
82
+		
83
+		previous_vy = vy.getValue();
84
+		previous_vx = vx.getValue();
85
+		previous_angle = angle.getValue();
86
+
87
+		leftEngine = (RocketEngine) cso.getObjectById("rocket_engine_left");
88
+		rightEngine = (RocketEngine) cso.getObjectById("rocket_engine_right");
89
+		middleEngine = (RocketEngine) cso.getObjectById("rocket_engine_middle");
90
+	}
91
+
92
+	
93
+	/* Turn off all rockets */
94
+	void resetRockets() {
95
+		leftEngine.setBursting(false);
96
+		rightEngine.setBursting(false);
97
+		middleEngine.setBursting(false);
98
+	}
99
+
100
+	/* Performs the chosen action */
101
+	void performAction(int action) {
102
+		/* Fire zeh rockets! */
103
+		resetRockets();
104
+		switch (action) {
105
+			// Do nothing
106
+			case 0: break;
107
+			
108
+			case 1: leftEngine.setBursting(true); 
109
+			break;
110
+			
111
+			case 2: rightEngine.setBursting(true); 
112
+			break;
113
+			
114
+			case 3: middleEngine.setBursting(true); 
115
+			break;
116
+			
117
+			case 4: leftEngine.setBursting(true); 
118
+			middleEngine.setBursting(true); 
119
+			break;
120
+			
121
+			case 5: rightEngine.setBursting(true);
122
+			middleEngine.setBursting(true); 
123
+			break;
124
+			
125
+			case 6: middleEngine.setBursting(true);
126
+			leftEngine.setBursting(true);
127
+			rightEngine.setBursting(true); 
128
+			break;
129
+			
130
+			case 7: rightEngine.setBursting(true);
131
+			leftEngine.setBursting(true); 
132
+			break;
133
+		}
134
+	}
135
+
136
+	/* Main decision loop. Called every iteration by the simulator */
137
+	public void tick(int currentTime) {
138
+		iteration++;
139
+		
140
+		if (!paused) {
141
+			String new_state;
142
+			double previous_reward;
143
+			
144
+			// You can choose the value of HOVER_MODE line 19 (for part 3)
145
+			if (!HOVER_MODE) {
146
+				new_state = StateAndReward.getStateAngle(angle.getValue(), vx.getValue(), vy.getValue());
147
+				previous_reward = StateAndReward.getRewardAngle(previous_angle, previous_vx, previous_vy);
148
+			}
149
+			else {
150
+				new_state = StateAndReward.getStateHover(angle.getValue(), vx.getValue(), vy.getValue());
151
+				previous_reward = StateAndReward.getRewardHover(previous_angle, previous_vx, previous_vy);
152
+			}
153
+
154
+			/* Repeat the chosen action for a while, hoping to reach a new state. This is a trick to speed up learning on this problem. */
155
+			action_counter++;
156
+			if (new_state.equals(previous_state) && action_counter < REPEAT_ACTION_MAX) {
157
+				return;
158
+			}
159
+
160
+			action_counter = 0;
161
+
162
+			/* The agent is in a new state, do learning and action selection */
163
+			if (previous_state != null) {
164
+				/* Create state-action key */
165
+				String prev_stateaction = previous_state + previous_action;
166
+
167
+				/* Increment state-action counter */
168
+				if (Ntable.get(prev_stateaction) == null) {
169
+					Ntable.put(prev_stateaction, 0);
170
+				}
171
+				Ntable.put(prev_stateaction, Ntable.get(prev_stateaction) + 1);
172
+
173
+				/* Update Q value */
174
+				if (Qtable.get(prev_stateaction) == null) {
175
+					Qtable.put(prev_stateaction, 0.0);
176
+				} else {
177
+					// Here, we use temporal-difference Q-learning equation, as define in
178
+					// AI: A Modern Approach, 4th ed. (Russell, Norvig) p. 802 (22.7):
179
+					// Q(s,a) <-- Q(s,a) + alpha*[R(s,a,s') + gamma*max(a')(Q(s',a')) - Q(s,a)]
180
+					// where: 	alpha --> learning rate
181
+					//			gamma --> discount factor
182
+					
183
+					double gamma = GAMMA_DISCOUNT_FACTOR;
184
+					double alpha = alpha(Ntable.get(prev_stateaction));
185
+					
186
+					double Q = Qtable.get(prev_stateaction) 
187
+							+ alpha*(previous_reward + gamma*getMaxActionQValue(new_state) - Qtable.get(prev_stateaction));
188
+					
189
+					Qtable.put(prev_stateaction, Q);
190
+					
191
+					// done.
192
+				}
193
+				
194
+				int action = selectAction(new_state); /* Make sure you understand how it selects an action */
195
+
196
+				performAction(action);
197
+				
198
+				/* Only print every 10th line to reduce spam */
199
+				print_counter++;
200
+				if (print_counter % 1000 == 0) {
201
+					System.out.println("ITERATION: " + iteration + " SENSORS: a=" + df.format(angle.getValue()) + " vx=" + df.format(vx.getValue()) + 
202
+							" vy=" + df.format(vy.getValue()) + " P_STATE: " + previous_state + " P_ACTION: " + previous_action + 
203
+							" P_REWARD: " + df.format(previous_reward) + " P_QVAL: " + df.format(Qtable.get(prev_stateaction)) + " Tested: "
204
+							+ Ntable.get(prev_stateaction) + " times.");
205
+				}
206
+				
207
+				previous_vy = vy.getValue();
208
+				previous_vx = vx.getValue();
209
+				previous_angle = angle.getValue();
210
+				previous_action = action;
211
+			}
212
+			previous_state = new_state;
213
+		}
214
+
215
+	}
216
+
217
+	/* Computes the learning rate parameter alpha based on the number of times the state-action combination has been tested */
218
+	public double alpha(int num_tested) {
219
+		/* Lower learning rate constants means that alpha will become small faster and therefore make the agent behavior converge to 
220
+		 * to a solution faster, but if the state space is not properly explored at that point the resulting behavior may be poor.
221
+		 * If your state-space is really huge you may need to increase it. */
222
+		double alpha = (LEARNING_RATE_CONSTANT/(LEARNING_RATE_CONSTANT + num_tested));
223
+		return alpha;
224
+	}
225
+	
226
+	/* Finds the highest Qvalue of any action in the given state */
227
+	public double getMaxActionQValue(String state) {
228
+		double maxQval = Double.NEGATIVE_INFINITY;
229
+		
230
+		for (int action = 0; action < NUM_ACTIONS; action++) {
231
+			Double Qval = Qtable.get(state+action);
232
+			if (Qval != null && Qval > maxQval) {
233
+				maxQval = Qval;
234
+			} 
235
+		}
236
+
237
+		if (maxQval == Double.NEGATIVE_INFINITY) {
238
+			/* Assign 0 as that corresponds to initializing the Qtable to 0. */
239
+			maxQval = 0;
240
+		}
241
+		return maxQval;
242
+	}
243
+	
244
+	/* Selects an action in a state based on the registered Q-values and the exploration chance */
245
+	public int selectAction(String state) {
246
+		Random rand = new Random();
247
+
248
+		int action = 0;
249
+		/* May do exploratory move if in exploration mode */
250
+		if (explore && Math.abs(rand.nextDouble()) < explore_chance) {
251
+			/* Taking random exploration action! */
252
+			action = Math.abs(rand. nextInt()) % NUM_ACTIONS;
253
+			return action;
254
+		}
255
+
256
+		/* Find action with highest Q-val (utility) in given state */
257
+		double maxQval = Double.NEGATIVE_INFINITY;
258
+		for (int i = 0; i < NUM_ACTIONS; i++) {
259
+			String test_pair = state + i; /* Generate a state-action pair for all actions */
260
+			double Qval = 0;
261
+			if (Qtable.get(test_pair) != null) {
262
+				Qval = Qtable.get(test_pair);
263
+			}
264
+			if (Qval > maxQval) {
265
+				maxQval = Qval;
266
+				action = i;
267
+			}
268
+		}
269
+		return action;
270
+	}
271
+
272
+	
273
+	
274
+	/* The 'E' key will toggle the agents exploration mode. Turn this off to test its behavior */
275
+	public void toggleExplore() {
276
+		/* Make sure we don't toggle it multiple times */
277
+		if (System.currentTimeMillis() - lastPressedExplore < 1000) {
278
+			return;
279
+		}
280
+		if (explore) {
281
+			System.out.println("Turning OFF exploration!");
282
+			explore = false;
283
+		} else {
284
+			System.out.println("Turning ON exploration!");
285
+			explore = true;
286
+		}
287
+		lastPressedExplore = System.currentTimeMillis(); 
288
+	}
289
+
290
+	/* Keys 1 and 2 can be customized for whatever purpose if you want to */
291
+	public void toggleCustom1() {
292
+		System.out.println("Custom key 1 pressed!");
293
+	}
294
+
295
+	/* Keys 1 and 2 can be customized for whatever purpose if you want to */
296
+	public void toggleCustom2() {
297
+		System.out.println("Custom key 2 pressed!");
298
+	}
299
+	
300
+	public void pause() {
301
+		paused = true;
302
+		resetRockets();
303
+	}
304
+
305
+	public void run() {
306
+		paused = false;
307
+	}
308
+}

+ 87
- 0
lab5/StateAndReward.java View File

1
+public class StateAndReward {
2
+
3
+	
4
+	/* State discretization function for the angle controller */
5
+	public static String getStateAngle(double angle, double vx, double vy) {		
6
+		return " " + discretize2(angle, 20, 2*-Math.PI/3, 2*Math.PI/3) + " ";
7
+	}
8
+
9
+	/* Reward function for the angle controller */
10
+	public static double getRewardAngle(double angle, double vx, double vy) {
11
+		return Math.PI - Math.abs(angle);
12
+	}
13
+
14
+	/* State discretization function for the full hover controller */
15
+	public static String getStateHover(double angle, double vx, double vy) {
16
+		return discretize2(angle, 10, 2*-Math.PI/3, 2*Math.PI/3) 
17
+			+ " / " + discretize(vx, 3, -1, 1) 
18
+			+ " / " + discretize(vy, 11, -1, 1);
19
+	}
20
+
21
+	/* Reward function for the full hover controller */
22
+	public static double getRewardHover(double angle, double vx, double vy) {
23
+		return (Math.PI - Math.abs(angle))/2 + (10 - Math.abs(Math.max(Math.abs(vx), Math.abs(vy)))) / 5;
24
+	}
25
+
26
+	// ///////////////////////////////////////////////////////////
27
+	// discretize() performs a uniform discretization of the
28
+	// value parameter.
29
+	// It returns an integer between 0 and nrValues-1.
30
+	// The min and max parameters are used to specify the interval
31
+	// for the discretization.
32
+	// If the value is lower than min, 0 is returned
33
+	// If the value is higher than min, nrValues-1 is returned
34
+	// otherwise a value between 1 and nrValues-2 is returned.
35
+	//
36
+	// Use discretize2() if you want a discretization method that does
37
+	// not handle values lower than min and higher than max.
38
+	// ///////////////////////////////////////////////////////////
39
+	public static int discretize(double value, int nrValues, double min,
40
+			double max) {
41
+		if (nrValues < 2) {
42
+			return 0;
43
+		}
44
+
45
+		double diff = max - min;
46
+
47
+		if (value < min) {
48
+			return 0;
49
+		}
50
+		if (value > max) {
51
+			return nrValues - 1;
52
+		}
53
+
54
+		double tempValue = value - min;
55
+		double ratio = tempValue / diff;
56
+
57
+		return (int) (ratio * (nrValues - 2)) + 1;
58
+	}
59
+
60
+	// ///////////////////////////////////////////////////////////
61
+	// discretize2() performs a uniform discretization of the
62
+	// value parameter.
63
+	// It returns an integer between 0 and nrValues-1.
64
+	// The min and max parameters are used to specify the interval
65
+	// for the discretization.
66
+	// If the value is lower than min, 0 is returned
67
+	// If the value is higher than min, nrValues-1 is returned
68
+	// otherwise a value between 0 and nrValues-1 is returned.
69
+	// ///////////////////////////////////////////////////////////
70
+	public static int discretize2(double value, int nrValues, double min,
71
+			double max) {
72
+		double diff = max - min;
73
+
74
+		if (value < min) {
75
+			return 0;
76
+		}
77
+		if (value > max) {
78
+			return nrValues - 1;
79
+		}
80
+
81
+		double tempValue = value - min;
82
+		double ratio = tempValue / diff;
83
+
84
+		return (int) (ratio * nrValues);
85
+	}
86
+
87
+}

+ 80
- 0
lab5/TutorialController.java View File

1
+// INFO: See below.
2
+
3
+public class TutorialController extends Controller {
4
+
5
+    public SpringObject object;
6
+
7
+    ComposedSpringObject cso;
8
+
9
+    /* These are the agents senses (inputs) */
10
+	DoubleFeature x; /* Positions */
11
+	DoubleFeature y;
12
+	DoubleFeature vx; /* Velocities */
13
+	DoubleFeature vy;
14
+	DoubleFeature angle; /* Angle */
15
+
16
+    /* Example:
17
+     * x.getValue() returns the vertical position of the rocket 
18
+     */
19
+
20
+	/* These are the agents actuators (outputs)*/
21
+	RocketEngine leftRocket;
22
+	RocketEngine middleRocket;
23
+	RocketEngine rightRocket;
24
+
25
+    /* Example:
26
+     * leftRocket.setBursting(true) turns on the left rocket 
27
+     */
28
+	
29
+	public void init() {
30
+		cso = (ComposedSpringObject) object;
31
+		x = (DoubleFeature) cso.getObjectById("x");
32
+		y = (DoubleFeature) cso.getObjectById("y");
33
+		vx = (DoubleFeature) cso.getObjectById("vx");
34
+		vy = (DoubleFeature) cso.getObjectById("vy");
35
+		angle = (DoubleFeature) cso.getObjectById("angle");
36
+
37
+		leftRocket = (RocketEngine) cso.getObjectById("rocket_engine_left");
38
+		rightRocket = (RocketEngine) cso.getObjectById("rocket_engine_right");
39
+		middleRocket = (RocketEngine) cso.getObjectById("rocket_engine_middle");
40
+	}
41
+
42
+    public void tick(int currentTime) {
43
+
44
+    	// TDDC17
45
+    	// Part1: Print useful informations and use 
46
+    	// threshold to guide the vessel
47
+    	
48
+    	System.out.println("Tick: " + currentTime + ". Angle: " + angle.getValue() + ", vx: " + vx.getValue() + ", vy: " + vy.getValue());
49
+    	
50
+    	
51
+    	System.out.print("Vessel state: ");
52
+    	if (angle.getValue() > 0.01) {
53
+    		rightRocket.setBursting(true);
54
+    		System.out.print("ENG_RGT ON; ");
55
+    	}
56
+    	else {
57
+    		rightRocket.setBursting(false);
58
+    		System.out.print("ENG_RGT OFF; ");
59
+    	}
60
+    	if (angle.getValue() < -0.01) {
61
+    		leftRocket.setBursting(true);
62
+   			System.out.print("ENG_LFT ON; ");
63
+    	}
64
+    	else {
65
+    		leftRocket.setBursting(false);
66
+    		System.out.print("ENG_LFT OFF; ");
67
+    	}
68
+    	if (vy.getValue() > 0.05) {
69
+    		middleRocket.setBursting(true);
70
+    		System.out.print("ENG_MDL ON; ");
71
+    	}
72
+    	else {
73
+    		middleRocket.setBursting(false);
74
+    		System.out.print("ENG_MDL OFF; ");
75
+    	}
76
+    	
77
+    	System.out.println("");
78
+    }
79
+
80
+}

Loading…
Cancel
Save