-
Notifications
You must be signed in to change notification settings - Fork 0
/
healthcare.ujshop
1204 lines (955 loc) · 47.8 KB
/
healthcare.ujshop
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(defdomain healthcare
(
; Generic Axioms
;==========================================================
;Equalities between conditions on commitments and on goals
;==========================================================
; True if the success condition of ?g matches the antecedent of ?c
;(?gv and ?cv will unify with the specific instance of ?g and ?c that match this)
(:- (eqGSCP ?g ?gv ?c ?cv) (and (imply (s ?g ?g ?gv) (p ?c ?c ?cv)) (imply (p ?c ?c ?cv) (s ?g ?g ?gv)) ) ) ; Basically a logical equivalence <->
;TODO make sure that the variables ?gv and ?cv get instantiated
; True of the success condition of ?g matches the consequent of ?c
(:- (eqGSCQ ?g ?gv ?c ?cv) (and (imply (s ?g ?gi ?gv) (q ?c ?ci ?cv)) (imply (q ?c ?ci ?cv) (s ?g ?gi ?gv)) ) ) ; Basically a logical equivalence <->
; True of the the antecedent of commitment ?c1 matches the consequent of commitment ?c2 (so they are reciprocal)
(:- (eqCPCQ ?c1 ?cv1 ?c2 ?cv2) (and (imply (p ?c1 ?ci1 ?cv1) (q ?c2 ?ci2 ?cv2)) (imply (q ?c2 ?ci2 ?cv2) (p ?c1 ?ci1 ?cv1)) ) ) ; Basically a logical equivalence <->
;Domain-specific axioms
; G1 = G(PHYSICIAN, diagnosisRequested, - diagnosisRequested)
(:- (pg G1 ?gi (?t)) (and (goal ?g ?gi ?a) ) )
(:- (s G1 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (diagnosisRequested ?t ?a) ) )
(:- (f G1 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (dontknow ?a) ))
; G2 = G(PATIENT, diagnosisRequested, - diagnosisRequested)
(:- (pg G2 ?gi (?t)) (and (goal ?g ?gi ?a) ) )
(:- (s G2 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (diagnosisRequested ?a ?physician) ) )
(:- (f G2 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (dontknow ?a) ))
; G3 = G(RADIOLOGIST, imagingRequested ^ iAppointmentRequested, - imagingRequested v - iAppointmentRequested)
(:- (pg G3 ?gi (?t)) (and (goal ?g ?gi ?a) ) )
(:- (s G3 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (imagingRequested ?physician ?t) (iAppointmentRequested ?t ?a) ) )
(:- (f G3 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (dontknow ?patient) ))
; G4 = G(PHYSICIAN, imgagingRequested ^ iAppointmentRequested, - imagingRequested v - iAppointmentRequested)
(:- (pg G4 ?gi (?t)) (and (goal ?g ?gi ?a) ) )
(:- (s G4 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (imagingRequested ?a ?t) ) )
(:- (f G4 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (dontknow ?patient) ))
; G6 = G(PATIENT, iAppointmentKept, - iAppointmentKept)
(:- (pg G6 ?gi (?t)) (and (goal ?g ?gi ?a) ) )
(:- (s G6 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (iAppointmentKept ?a ?radiologist) ) )
(:- (f G6 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (dontknow ?a) ))
; G7 = G(RADIOLOGIST, imagingResultsReported, - imagingResultsReported)
(:- (pg G7 ?gi (?t)) (and (goal ?g ?gi ?a) ) )
(:- (s G7 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (imagingResultsReported ?a ?physician ?t) ) )
(:- (f G7 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (dontknow ?patient) ))
; G8 = G(RADIOLOGIST, biopsyRequested ^ bAppointmentRequested, - biopsyRequested V - bAppointmentRequested)
(:- (pg G8 ?gi (?t)) (and (goal ?g ?gi ?a) ) )
(:- (s G8 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) ((biopsyRequested ?physician ?t) (bAppointmentRequested ?t ?pathologist)) ) )
(:- (f G8 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (dontknow ?patient) ))
; G9 = G(PHYSICIAN, biopsyRequested ^ bAppointmentRequested, - biopsyRequested v - bAppointmentRequested)
(:- (pg G9 ?gi (?t)) (and (goal ?g ?gi ?a) ) )
(:- (s G9 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (biopsyRequested ?a ?t) (bAppointmentRequested ?t ?pathologist) ) )
(:- (f G9 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (dontknow ?a) ))
; G11 = G(PATIENT, bAppointmentKept, - bAppointmentKept)
(:- (pg G11 ?gi (?t)) (and (goal ?g ?gi ?a) ) )
(:- (s G11 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (bAppointmentKept ?a ?pathologist) ) )
(:- (f G11 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (dontknow ?a) ))
; G12 = G(PATHOLOGIST, pathologyRequested ^ tissueProvided, - pathologyRequested V - tissueProvided)
(:- (pg G12 ?gi (?t)) (and (goal ?g ?gi ?a) ) )
(:- (s G12 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (pathologyRequested ?physician ?a ?t) (tissueProvided ?t)) )
(:- (f G12 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (dontknow ?t) ))
; G13 = G(RADIOLOGIST, pathologyRequested ^ tissueProvided, - pathologyRequested v -tissueProvided)
(:- (pg G13 ?gi (?t)) (and (goal ?g ?gi ?a) ) )
(:- (s G13 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (pathologyRequested ?physician ?d ?t) (tissueProvided ?t)) )
(:- (f G13 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (dontknow ?patient) ))
; G15 = G(PATHOLOGIST, pathResultsReported, - pathResultsReported)
(:- (pg G15 ?gi (?t)) (and (goal ?g ?gi ?a) ) )
(:- (s G15 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (pathResultsReported ?radiologist ?physician ?t)) )
(:- (f G15 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (dontknow ?patient) ))
; G16 = G(RADIOLOGIST, radPathResultsReported, - radPathResultsReported)
(:- (pg G16 ?gi (?t)) (and (goal ?g ?gi ?a) ) )
; (:- (s G16 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (radPathResultsReported ?radiologist ?physician ?patient) ) ) ; TODO check that this is really incorrect
(:- (s G16 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (integratedReport ?t ?physician) ) )
(:- (f G16 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (dontknow ?patient) ))
; G17 = G(REGISTRAR, reportPatientWithCancer, - reportPatientWithCancer)
(:- (pg G17 ?gi (?t)) (and (goal ?g ?gi ?a) ) )
(:- (s G17 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (patientReportedToRegistrar ?t ?a)) )
(:- (f G17 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (dontknow ?patient) ))
; G18 = G(PATHOLOGIST, reportPatientWithCancer, - reportPatientWithCancer)
(:- (pg G18 ?gi (?t)) (and (goal ?g ?gi ?a) ) )
(:- (s G18 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (patientReportedToRegistrar ?t ?registrar)) )
(:- (f G18 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (dontknow ?patient) ))
; G19 = G(REGISTRAR, addPatientToRegistry, - addPatientToRegistry)
(:- (pg G19 ?gi (?t)) (and (goal ?g ?gi ?a) ) )
(:- (s G19 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (inRegistry ?t)) )
(:- (f G19 ?gi (?t)) (and (goal ?g ?gi ?a) (varG ?g ?gi (?t)) (dontknow ?patient) ))
;=============================================
; Axioms for commitments
; predicates on commitments
; null(c,ci,cv) cancelled(c,ci,cv) released(c,ci,cv)
; pending(c,ci,cv) satisfied(c,ci,cv)
;=============================================
(:- (null ?c ?ci ?cv) (not (var ?c ?ci ?cv)) )
(:- (conditional ?c ?ci ?cv)
(and (active ?c ?ci ?cv) (not (p ?c ?ci ?cv)) ) )
(:- (detached ?c ?ci ?cv)
(and (active ?c ?ci ?cv) (p ?c ?ci ?cv) ) )
; A conditional commitment is active
(:- (active ?c ?ci ?cv) (and (var ?c ?ci ?cv);(not (null ?c ?ci ?cv))
(not (terminal ?c ?ci ?cv))
(not (pending ?c ?ci ?cv))
(not (satisfied ?c ?ci ?cv))
) )
(:- (terminated ?c ?ci ?cv) (or (and (not (p ?c ?ci ?cv)) (cancelled ?c ?ci ?cv)) (released ?c ?ci ?cv)) )
; (:- (violated ?c ?ci ?cv) (or (and (p ?c ?ci ?cv) (cancelled ?c ?ci ?cv)) (and (not (p ?c ?ci ?cv)) ) ) ) ; Previous formalization with a mistaken disjunction, detected by Pankaj
(:- (violated ?c ?ci ?cv) (and (p ?c ?ci ?cv) (cancelled ?c ?ci ?cv)) )
(:- (satisfied ?c ?ci ?cv) (and (not (null ?c ?ci ?cv)) (not (terminal ?c ?ci ?cv)) (q ?c ?ci ?cv)) )
;(:- (expired ?c ?ci ?cv) (and (not (null ?c ?ci ?cv)) (not (p ?c ?ci ?cv)) ) )
; A rule to enumerate that certain states are terimnal
(:- (terminal ?c ?ci ?cv) (and (commitment ?c ?ci ?de ?cr) (or (cancelled ?c ?ci ?cv) (released ?c ?ci ?cv) (expired ?c ?ci ?cv))) )
; Domain specific axioms
;C1(PHYSICIAN, PATIENT, diagnosisRequested ^ -vio(C2) ^ -vio(C3), diagnosisProvided)
(:- (p C1 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (and (diagnosisRequested ?a ?d) (not (violated ?c C2 (?t))) (not (violated ?c C3 (?t)))) ) )
; TODO Correct this, to "include inactive for the two commitments"
(:- (q C1 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (and (diagnosisProvided ?d ?a)) ) )
;C2(PATIENT, PHYSICIAN, iAppointmentRequested, iAppointmentKept)
(:- (p C2 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (and (iAppointmentRequested ?d ?radiologist))))
(:- (q C2 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (and (iAppointmentKept ?d ?radiologist))))
;C3(PATIENT, PHYSICIAN, bAppointmentRequested, bAppointmentKept)
(:- (p C3 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (and (bAppointmentRequested ?d ?pathologist)) ) )
(:- (q C3 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (and (bAppointmentKept ?d ?pathologist)) ) )
;C4(RADIOLOGIST, PHYSICIAN, imagingRequested ^ iAppointmentKept, imagingResultsReported)
(:- (p C4 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (and (imagingRequested ?a ?t) (iAppointmentKept ?t ?d) ) ) )
(:- (q C4 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (and (imagingResultsReported ?d ?a ?t)) ) )
;C5(RADIOLOGIST, PHYSICIAN, biopsyRequested ^ bAppointmentKept, radPathResultsReported)
(:- (p C5 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (and (biopsyRequested ?a ?patient) (bAppointmentKept ?patient ?d)) ) )
(:- (q C5 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (and (radPathResultsReported ?d ?a ?patient)) ) )
;C6(PATHOLOGIST, RADIOLOGIST, pathologyRequested ^ tissueProvided, pathResultsReported)
(:- (p C6 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (and (pathologyRequested ?physician ?d ?patient) (tissueProvided ?patient)) ))
(:- (q C6 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (and (pathResultsReported ?a ?physician ?patient)) ))
;C7 = C(REGISTRAR, PATHOLOGIST, reportPatientWithCancer, addPatientToRegistry)
(:- (p C7 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (and (patientReportedToRegistrar ?t ?d)) ) )
(:- (q C7 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (and (inRegistry ?t)) ) )
; ;C10(TUMORBOARD, RADIOLOGIST, radRequestsAssessment, TBAgreesPath _ TBDisagreesPath)
; (:- (p C10 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (and (radRequestsAssessment)) ) )
; (:- (q C10 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (or (TBAgreesPath) (TBDisagreesPath)) ))
; ;C11(TUMORBOARD, PHYSICIAN, phyRequestsAssessment, TBAgreesRad _ TBDisagreesRad)
; (:- (p C11 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (and (phyRequestsAssessment)) ) )
; (:- (q C11 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (or (TBAgreesRad) (TBDisagreesRad)) ) )
; ;C12(TUMORBOARD, PATIENT, patRequestsAssessment, TBAgreesPCP _ TBDisagreesPCP)
; (:- (p C12 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (and (patRequestsAssessment) ) ) )
; (:- (q C12 ?ci (?t)) (and (commitment ?c ?ci ?d ?a) (var ?c ?ci (?t)) (or (TBAgreesPCP) (TBDisagreesPCP) ) ) )
; Generic operators
;======================
; Commitment operators
;======================
(:operator (!!testSuccess ?c ?ci ?cv ?state)
(commitment ?c ?ci ?de ?cr)
()
()
0
)
(:operator (!!testFailure ?cg ?cgi ?state)
nil
nil
nil
0
)
(:operator (!create ?c ?ci ?de ?cr ?cv)
((commitment ?c ?ci ?de ?cr)
(null ?c ?ci ?cv)
)
()
((var ?c ?ci ?cv) )
0
)
(:operator (!suspend ?c ?ci ?de ?cr ?cv)
((commitment ?c ?ci ?de ?cr)
(active ?c ?ci ?cv)
)
( )
((pending ?c ?ci ?cv))
1
)
; FM: In PDDL it was revive, but in the papers it's called reactivate
; PT: Without checking for p in the pre-condition, these operators will
; not work correctly
; FM (26/12/2012): Which ones? Just reactivate? <------ TODO: Check this Pankaj
(:operator (!reactivate ?c ?ci ?de ?cr ?cv)
((commitment ?c ?ci ?de ?cr)
(pending ?c ?ci ?cv)
)
((pending ?c ?ci ?cv))
( )
1
)
; Satisfy should be an operator if we want the state never to leave satisfied
; (:operator (!satisfy ?c ?ci ?de ?cr ?cv)
; ((commitment ?c ?ci ?de ?cr)
; (active ?c ?ci ?cv)
; (q ?c ?ci ?cv)
; )
;
; ( )
; ((satisfied ?c ?ci ?cv))
; 1
; )
(:operator (!expire ?c ?ci ?de ?cr ?cv)
((commitment ?c ?ci ?de ?cr)
(conditional ?c ?ci ?cv)
(activetimeout ?c ?ci ?cv)
)
( )
((expired ?c ?ci ?cv))
5
)
(:operator (!timeoutviolate ?c ?ci ?de ?cr ?cv)
((commitment ?c ?ci ?de ?cr)
(detached ?c ?ci ?cv)
(detachedtimeout ?c ?ci ?cv)
)
((detached ?c ?ci ?cv))
((violated ?c ?ci ?cv))
5
)
(:operator (!cancel ?c ?ci ?de ?cr ?cv)
((commitment ?c ?ci ?de ?cr)
(active ?c ?ci ?cv)
)
( )
((cancelled ?c ?ci ?cv))
10
)
(:operator (!release ?c ?ci ?de ?cr ?cv)
((commitment ?c ?ci ?de ?cr)
(active ?c ?ci ?cv)
)
( )
((released ?c ?ci ?cv))
1
)
;=============================================
; Axioms for goals
; predicates on goals - null(g,gi,gv) suspendedG(g,gi,gv) aborted(g,gi,gv) dropped(g,gi,gv) satisfiedG(g,gi,gv)
;=============================================
(:- (nullG ?g ?gi ?gv) (not (varG ?g ?gi ?gv) ) )
(:- (inactiveG ?g ?gi ?gv)
(and (not (nullG ?g ?gi ?gv)) (not (f ?g ?gi ?gv))
(not (s ?g ?gi ?gv)) (not (terminalG ?g ?gi ?gv))
(not (suspendedG ?g ?gi ?gv)) (not (activeG ?g ?gi ?gv))) )
; Fix this
(:- (activeG ?g ?gi ?gv)
(and (activatedG ?g ?gi ?gv) (not (f ?g ?gi ?gv)) (not (satisfiedG ?g ?gi ?gv))
(not (terminalG ?g ?gi ?gv)) (not (suspendedG ?g ?gi ?gv))) )
(:- (satisfiedG ?g ?gi ?gv) (and (not (nullG ?g ?gi ?gv)) (not (terminalG ?g ?gi ?gv))
(pg ?g ?gi ?gv) (s ?g ?gi ?gv) (not (f ?g ?gi ?gv))) )
; (:- (suspended ?g ?gi ?gv) (and (not (nullG ?g ?gi ?gv)) (not (terminal ?g ?gi ?gv)) (suspended ?g ?gi ?gv) ) )
(:- (failedG ?g ?gi ?gv) (and (not (nullG ?g ?gi ?gv)) (f ?g ?gi ?gv) ) )
(:- (terminatedG ?g ?gi ?gv) (and (not (nullG ?g ?gi ?gv)) (or (dropped ?g ?gi ?gv) (aborted ?g ?gi ?gv)) ) )
; A rule to ensure that once a goal enters a terminal state (e.g. dropped or aborted), it cannot return
(:- (terminalG ?g ?gi ?gv) (and (goal ?g ?gi ?a) (or (dropped ?g ?gi ?gv) (aborted ?g ?gi ?gv) )) )
;=============================================
; Goal operators
;=============================================
(:operator (!!testSuccessG ?g ?gi ?gv ?state)
(goal ?g ?gi ?a)
()
()
0
)
; Regular transitions
(:operator (!consider ?g ?gi ?a ?gv)
((goal ?g ?gi ?a)
(nullG ?g ?gi ?gv)
(pg ?g ?gi ?gv)
)
()
((varG ?g ?gi ?gv))
1
)
(:operator (!activate ?g ?gi ?a ?gv)
((goal ?g ?gi ?a) (inactiveG ?g ?gi ?gv))
()
((activatedG ?g ?gi ?gv))
1
)
(:operator (!suspendG ?g ?gi ?a ?gv)
((goal ?g ?gi ?a)
(not (terminalG ?g ?gi ?gv))
(not (nullG ?g ?gi ?gv))
)
((activatedG ?g ?gi ?gv))
((suspendedG ?g ?gi ?gv))
1
)
(:operator (!reconsider ?g ?gi ?a ?gv)
((goal ?g ?gi ?a)
(suspendedG ?g ?gi ?gv)
(not (terminalG ?g ?gi ?gv))
;(not (pg ?g ?gi ?gv))
(not (nullG ?g ?gi ?gv))
)
((suspendedG ?g ?gi ?gv))
( )
1
)
(:operator (!reactivateG ?g ?gi ?a ?gv)
((goal ?g ?gi ?a)
(suspendedG ?g ?gi ?gv)
(not (terminalG ?g ?gi ?gv))
;(pg ?g ?gi ?gv)
(not (nullG ?g ?gi ?gv))
)
((suspendedG ?g ?gi ?gv))
( (activatedG ?g ?gi ?gv) )
1
)
(:operator (!drop ?g ?gi ?a ?gv)
((goal ?g ?gi ?a)
(not (terminalG ?g ?gi ?gv))
(not (nullG ?g ?gi ?gv))
)
( )
((dropped ?g ?gi ?gv))
1
)
(:operator (!abort ?g ?gi ?a ?gv)
((goal ?g ?gi ?a)
(not (terminalG ?g ?gi ?gv))
(not (nullG ?g ?gi ?gv))
)
( )
((aborted ?g ?gi ?gv))
1
)
;Fail does not depend on the agent to happen
; (:operator (!fail ?g ?gi ?a ?gv)
; ((goal ?g ?gi ?a)
; (not (nullG ?g ?gi ?gv))
; (f ?g ?gi ?gv)
; )
;
; ( )
; ((failed ?g ?gi ?gv))
; 1
; )
;================================
; Methods to achieve agent goals
;================================
(:method (achieveGoals)
workTowardsGoal
((goal ?g ?gi ?a) (activeG ?g ?gi ?gv))
((achieveGoal ?g ?gi ?a ?gv))
)
(:method (achieveGoals)
activateGoal
((goal ?g ?gi ?a) (goalPossible ?g ?gi ?gv))
((!consider ?g ?gi ?a ?gv) (!activate ?g ?gi ?a ?gv) (achieveGoals))
noGoalsPossible
()
()
)
(:method (achieveGoals)
multipleCommitments
((goal ?g1 ?gi1 ?a1) (activeG ?g1 ?gi1 ?gv1) (goal ?g2 ?gi2 ?a2) (activeG ?g2 ?gi2 ?gv2) (commitment ?c1 ?ci1 ?a1 ?a2) (commitment ?c2 ?ci2 ?a2 ?a1)
(eqGSCP ?g1 ?gv1 ?c1 ?cv1) (eqGSCP ?g2 ?gv2 ?c2 ?cv2))
( (entice ?g1 ?c1 ?a1 ?a2) (entice ?g2 ?c2 ?a2 ?a1) (detach ?c1 ?ci1 ?cv1) (detach ?c2 ?ci2 ?cv2))
)
(:method (achieveGoal ?g ?gi ?a ?gv)
genericEnticeToAchieve ;FM (2013/01/04): I'm deliberately forcing the variables of the
; commitment to be equal to those in the goal
((activeG ?g ?gi ?gv) (goal ?g ?gi ?a) (commitment ?c ?ci ?a ?d) (assign ?cv ?gv) (eqGSCP ?g ?gv ?c ?cv) (goal ?g2 ?gi2 ?a) (assign ?gv2 ?cv) (eqGSCQ ?g2 ?gv2 ?c ?cv) (call != ?g ?g2))
((entice ?g ?gi ?gv ?c ?ci ?cv ?a ?d) (detach ?c ?ci ?cv) (deliver ?g2 ?gi2 ?gv2 ?c ?ci ?cv ?a ?d) (achieveGoal ?g2 ?gi2 ?gv2 ?a))
)
;==================================
; Methods on goals and commitments
; Practical Rules
;=================================
; PT: These methods need to relate commitment's antecedent
; and consequent with goals success condition.
; If G = G(x, s, f), then C should be C(x, y, s, u) where u
; can be any condition, but "s" need to be the same.
; I am not sure how to write it in this language.
;TODO (2013/01/04) Make sure that my current equality of ?cv and ?gv for the eqGSCP is correct
(:method (entice ?g ?gi ?gv ?c ?ci ?cv ?d ?a)
((goal ?g ?gi ?d) (activeG ?g ?gi ?gv) (commitment ?c ?ci ?d ?a) (null ?c ?ci ?cv)
(eqGSCP ?g ?gv ?c ?cv) ; In theory, this axiom will ensure that the S of G is true at the same time as the P of C
)
((!create ?c ?ci ?d ?a ?cv))
)
; Suspends an offer from ?d to ?a
(:method (suspendOffer ?g ?gi ?gv ?c ?ci ?cv ?d ?a)
((goal ?g ?gi ?d) (suspendedG ?g ?gi ?gv) (commitment ?c ?ci ?d ?a) (active ?c ?ci ?cv))
((!suspend ?c ?ci ?d ?a ?cv))
)
; Revives a commitment when a goal becomes active
(:method (revive ?g ?gi ?gv ?c ?ci ?cv ?d ?a)
((goal ?g ?gi ?d) (activeG ?g ?gi ?gv) (commitment ?c ?ci ?d ?a) (pending ?c ?ci ?cv))
((!reactivate ?c ?ci ?d ?a ?cv))
)
; Withdraws a commitment when a goal has failed or terminated
(:method (withdrawOffer ?g ?gi ?gv ?c ?ci ?cv ?d ?a)
((goal ?g ?gi ?d) (or (failedG ?g ?gi ?gv) (terminatedG ?g ?gi ?gv)) (commitment ?c ?ci ?d ?a) (active ?c ?ci ?cv))
((!cancel ?c ?ci ?d ?a ?cv))
)
; Revives a commitment to withdraw it?
(:method (reviveToWithdraw ?g ?gi ?gv ?c ?ci ?cv ?d ?a)
((goal ?g ?gi ?d) (or (failedG ?g ?gi ?gv) (terminatedG ?g ?gi ?gv)) (commitment ?c ?ci ?d ?a) (pending ?c ?ci ?cv))
((!reactivate ?c ?ci ?d ?a ?cv))
)
;Axioms Added for readbility
(:- (negotiable ?g ?gi ?gv ?c ?ci ?cv) (and (or (activeG ?g ?gi ?gv) (suspendedG ?g ?gi ?gv) ) (or (expired ?c ?ci ?cv) (terminated ?c ?ci ?cv)) ) )
(:method (negotiate ?g ?gi ?gv ?c1 ?ci1 ?cv1 ?c2 ?ci2 ?cv2 ?d ?a1 ?a2)
;Replaced by this expression TODO check what we are using a1 for
((goal ?g ?gi ?d) (commitment ?c1 ?ci1 ?d ?a2) (commitment ?c2 ?ci2 ?d ?a2) (null ?c2 ?ci2 ?cv2) (negotiable ?g ?gi ?gv ?c1 ?ci1 ?cv2))
((!create ?c2 ?ci2 ?d ?a2 ?ci2)) ;check that we really want ?ci2 as the last parameter instead of cv2
)
(:method (abandonEndGoal ?g ?gi ?gv ?c ?ci ?cv ?d ?a)
; Combinations of (A v U) and (E v T): AE AT UE UT
((goal ?g ?gi ?d) (or (activeG ?g ?gi ?gv) (suspendedG ?g ?gi ?gv)) (commitment ?c ?ci ?d ?a) (or (expired ?c ?ci ?cv) (terminated ?c ?ci ?cv)))
((!drop ?g ?gi ?d ?gv))
)
;Deliver and Deliver' are encoded in a single method
(:method (deliver ?g ?gi ?gv ?c ?ci ?cv ?d ?a)
; Deliver' (debtor delivers)
((goal ?g ?gi ?d) (inactiveG ?g ?gi ?gv) (commitment ?c ?ci ?d ?a) (detached ?c ?ci ?cv))
((!activate ?g ?gi ?d ?gv))
; Deliver (debtor delivers) but considers first since it's not detached
((goal ?g ?gi ?d) (nullG ?g ?gi ?gv) (commitment ?c ?ci ?d ?a) ;(detached ?c ?ci ?cv)
)
( (!consider ?g ?gi ?d ?gv) (!activate ?g ?gi ?d ?gv) )
)
(:method (detach ?g ?gi ?gv ?c ?ci ?cv ?d ?a)
; Detach' (creditor detaches)
((goal ?g ?gi ?a) (inactiveG ?g ?gi ?gv) (commitment ?c ?ci ?d ?a) (conditional ?c ?ci ?cv))
((!activate ?g ?gi ?a ?gv))
; Detach (creditor detaches)
((goal ?g ?gi ?a) (nullG ?g ?gi ?gv) (commitment ?c ?ci ?d ?a) ;(conditional ?c ?ci ?cv) ; must not be conditional
)
((!consider ?g ?gi ?a ?gv) (!activate ?g ?gi ?a ?gv))
)
(:method (backBurner ?g ?gi ?gv ?c ?ci ?cv ?d ?a)
((goal ?g ?gi ?d) (activeG ?g ?gi ?gv) (commitment ?c ?ci ?d ?a) (pending ?c ?ci ?cv))
((!suspendG ?g ?gi ?d ?gv))
)
(:method (frontBurner ?g ?gi ?gv ?c ?ci ?cv ?d ?a)
((goal ?g ?gi ?d) (suspendedG ?g ?gi ?gv) (commitment ?c ?ci ?d ?a) (detached ?c ?ci ?cv))
((!reactivateG ?g ?gi ?d ?gv))
)
(:method (abandonMeansGoal ?g ?gi ?gv ?c ?ci ?cv ?d ?a)
((goal ?g ?gi ?d) (or (activeG ?g ?gi ?gv) (suspendedG ?g ?gi ?gv)) (commitment ?c ?ci ?d ?a)
(or (expired ?c ?ci ?cv) (terminated ?c ?ci ?cv)) )
((!drop ?g ?gi ?d ?gv))
)
(:method (persist ?g ?gi ?gv ?c ?ci ?cv ?g2 ?gi2 ?gv2 ?d ?a)
((goal ?g ?gi ?d) (or (terminatedG ?g ?gi ?gv) (failedG ?g ?gi ?gv))
(commitment ?c ?ci ?d ?a) (detached ?c ?ci ?cv) (goal ?g2 ?gi2 ?d) (nullG ?g2 ?gi2 ?gv2))
((!consider ?g2 ?gi2 ?d ?gv2) (!activate ?g2 ?gi2 ?d ?gv2))
)
(:method (giveUp ?g ?gi ?gv ?c ?ci ?cv ?d ?a)
((goal ?g ?gi ?d) (or (terminatedG ?g ?gi ?gv) (failed ?g ?gi ?gv)) (commitment ?c ?ci ?d ?a) (detached ?c ?ci ?cv))
((!cancel ?c ?ci ?d ?a ?cv))
)
;=========================
; Methods to test the rules
;=========================
(:method (testCommitment ?c ?ci ?cv ?s)
((commitment ?c ?ci ?d ?a) (call = ?s null) (null ?c ?ci ?cv))
((!!testSuccess ?c ?ci ?cv ?s))
((commitment ?c ?ci ?d ?a) (call = ?s conditional) (conditional ?c ?ci ?cv))
((!!testSuccess ?c ?ci ?cv ?s))
((commitment ?c ?ci ?d ?a) (call = ?s active) (active ?c ?ci ?cv))
((!!testSuccess ?c ?ci ?cv ?s))
((commitment ?c ?ci ?d ?a) (call = ?s nactive) (not (active ?c ?ci ?cv)))
((!!testSuccess ?c ?ci ?cv ?s))
((commitment ?c ?ci ?d ?a) (call = ?s detached) (detached ?c ?ci ?cv))
((!!testSuccess ?c ?ci ?cv ?s))
((commitment ?c ?ci ?d ?a) (call = ?s expired) (expired ?c ?ci ?cv))
((!!testSuccess ?c ?ci ?cv ?s))
((commitment ?c ?ci ?d ?a) (call = ?s pending) (pending ?c ?ci ?cv))
((!!testSuccess ?c ?ci ?cv ?s))
((commitment ?c ?ci ?d ?a) (call = ?s terminated) (terminated ?c ?ci ?cv))
((!!testSuccess ?c ?ci ?cv ?s))
((commitment ?c ?ci ?d ?a) (call = ?s violated) (violated ?c ?ci ?cv))
((!!testSuccess ?c ?ci ?cv ?s))
((commitment ?c ?ci ?d ?a) (call = ?s satisfied) (satisfied ?c ?ci ?cv))
((!!testSuccess ?c ?ci ?cv ?s))
((commitment ?c ?ci ?d ?a) (call = ?s cancelled) (cancelled ?c ?ci ?cv))
((!!testSuccess ?c ?ci ?cv ?s))
((commitment ?c ?ci ?d ?a) (call = ?s terminal) (terminal ?c ?ci ?cv))
((!!testSuccess ?c ?ci ?cv ?s))
((commitment ?c ?ci ?d ?a) (call = ?s p) (p ?c ?ci ?cv))
((!!testSuccess ?c ?ci ?cv ?s))
((commitment ?c ?ci ?d ?a) (call = ?s q) (q ?c ?ci ?cv))
((!!testSuccess ?c ?ci ?cv ?s))
failed
((commitment ?c ?ci ?d ?a) )
((!!testFailure ?c ?ci ?s))
)
(:method (testGoal ?g ?gi ?gv ?s)
((goal ?g ?gi ?a) (call = ?s null) (nullG ?g ?gi ?gv))
((!!testSuccessG ?g ?gi ?gv ?s))
((goal ?g ?gi ?a) (call = ?s inactive) (inactiveG ?g ?gi ?gv))
((!!testSuccessG ?g ?gi ?gv ?s))
((goal ?g ?gi ?a) (call = ?s ninactive) (not (inactiveG ?g ?gi ?gv)))
((!!testSuccessG ?g ?gi ?gv ?s))
((goal ?g ?gi ?a) (call = ?s active) (activeG ?g ?gi ?gv))
((!!testSuccessG ?g ?gi ?gv ?s))
((goal ?g ?gi ?a) (call = ?s nactive) (not (activeG ?g ?gi ?gv)))
((!!testSuccessG ?g ?gi ?gv ?s))
((goal ?g ?gi ?a) (call = ?s suspended) (suspendedG ?g ?gi ?gv))
((!!testSuccessG ?g ?gi ?gv ?s))
((goal ?g ?gi ?a) (call = ?s nsuspended) (not (suspendedG ?g ?gi ?gv)))
((!!testSuccessG ?g ?gi ?gv ?s))
((goal ?g ?gi ?a) (call = ?s terminated) (terminatedG ?g ?gi ?gv))
((!!testSuccessG ?g ?gi ?gv ?s))
((goal ?g ?gi ?a) (call = ?s failed) (failed ?g ?gi ?gv))
((!!testSuccessG ?g ?gi ?gv ?s))
((goal ?g ?gi ?a) (call = ?s satisfied) (satisfiedG ?g ?gi ?gv))
((!!testSuccessG ?g ?gi ?gv ?s))
((goal ?g ?gi ?a) (call = ?s nsatisfied) (not (satisfiedG ?g ?gi ?gv)))
((!!testSuccessG ?g ?gi ?gv ?s))
((goal ?g ?gi ?a) (call = ?s terminal) (terminalG ?g ?gi ?gv))
((!!testSuccessG ?g ?gi ?gv ?s))
failed
((goal ?g ?gi ?a))
((!!testFailure ?g ?gi ?s))
)
(:method (testGoalCommitmentRule ?rule ?g ?gi ?a ?c ?ci ?de ?cr)
((goal ?g ?gi ?a) (commitment ?c ?ci ?de ?cr) (call = ?rule eqGSCP) (eqGSCP ?g ?gv ?c ?cv))
((!!testRuleSuccess ?rule (?g ?gi ?gv ?c ?ci ?cv) ))
)
; Domain dependent methods
(:method (hospitalScenario)
; TODO expand to forall patients
((patient ?patient))
((seekHelp ?patient)
(processPatient ?patient))
)
(:method (testCommitments)
(
(commitment C1 ?c1 ?d1 ?a1)
(commitment C2 ?c2 ?d2 ?a2)
(commitment C3 ?c3 ?d3 ?a3)
(commitment C4 ?c4 ?d4 ?a4)
(commitment C5 ?c5 ?d5 ?a5)
(commitment C6 ?c6 ?d6 ?a6)
(commitment C7 ?c7 ?d7 ?a7)
(commitment C8 ?c8 ?d8 ?a8)
) ; Precond
(
(testCommitment C1 ?c1 ?cv1 satisfied)
(testCommitment C2 ?c2 ?cv2 satisfied)
(testCommitment C3 ?c3 ?cv3 satisfied)
(testCommitment C4 ?c4 ?cv4 satisfied)
(testCommitment C5 ?c5 ?cv5 satisfied)
(testCommitment C6 ?c6 ?cv6 satisfied)
(testCommitment C7 ?c7 ?cv7 satisfied)
(testCommitment C8 ?c8 ?cv8 satisfied)
)
)
(:method (seekHelp ?patient)
((patient ?patient) (physician ?physician) (radiologist ?radiologist)
(commitment C1 ?Ci1 ?physician ?patient)
) ; Precondition
((!create C1 ?Ci1 ?physician ?patient (?patient))
(!requestAssessment ?patient ?physician)
) ; Task Network
)
(:method (processPatient ?patient)
process-patient-healthy
((patient ?patient) (physician ?physician) (commitment C1 ?Ci ?physician ?patient)
(radiologist ?radiologist)
;(conditional C1 ?Ci ?Cv)
) ; Precondition
((performImagingTests ?patient)
(performPathologyTests ?patient)
(deliverDiagnostics ?patient)) ; Task Network
)
(:method (performImagingTests ?patient)
imaging
((patient ?patient) (physician ?physician) (commitment C1 ?Ci ?physician ?patient)
(radiologist ?radiologist)
(pathologist ?pathologist)
;(conditional C1 ?Ci ?Cv)
(commitment C2 ?Ci2 ?patient ?physician)
(commitment C5 ?Ci5 ?radiologist ?physician)
) ; Precondition
((!create C2 ?Ci2 ?patient ?physician (?radiologist))
(!create C5 ?Ci5 ?radiologist ?physician (?pathologist))
(!requestImaging ?physician ?patient ?radiologist)
(attendTest ?patient)
) ; Just request imaging
)
(:method (performPathologyTests ?patient)
biopsy-unnecessary
((patient ?patient) (physician ?physician) (commitment C1 ?Ci ?physician ?patient)
(radiologist ?radiologist))
() ; Does nothing
)
(:method (performPathologyTests ?patient)
imaging-plus-biopsy
((patient ?patient) (physician ?physician)
(radiologist ?radiologist)
(pathologist ?pathologist)
;(conditional C1 ?Ci ?Cv)
(commitment C3 ?Ci3 ?patient ?physician)
(commitment C4 ?Ci4 ?radiologist ?physician)
) ; Precondition
((!create C3 ?Ci3 ?patient ?physician (?radiologist))
(!create C4 ?Ci4 ?radiologist ?physician (?pathologist))
(!requestBiopsy ?physician ?patient ?radiologist)
(attendTest ?patient)
) ; Request
)
(:method (attendTest ?patient)
attend-imaging
((patient ?patient) (physician ?physician) (radiologist ?radiologist) (iAppointmentRequested ?patient ?radiologist) (not (iAppointmentKept ?patient ?radiologist)) )
((!performImaging ?radiologist ?patient ?physician))
attend-biopsy
((patient ?patient) (physician ?physician) (radiologist ?radiologist) (bAppointmentRequested ?patient ?radiologist) (not (bAppointmentKept ?patient ?radiologist)))
((!performBiopsy ?radiologist ?patient ?physician))
)
(:method (attendTest ?patient)
no-show-imaging
((patient ?patient) (physician ?physician) (radiologist ?radiologist) (iAppointmentRequested ?patient ?radiologist) (not (iAppointmentKept ?patient ?radiologist)) )
() ; No show
no-show-biopsy
((patient ?patient) (physician ?physician) (radiologist ?radiologist) (bAppointmentRequested ?patient ?radiologist) (not (bAppointmentKept ?patient ?radiologist)))
()
)
(:method (deliverDiagnostics ?patient)
only-imaging
((patient ?patient) (physician ?physician) (radiologist ?radiologist) (iAppointmentKept ?patient ?radiologist) (not (biopsyRequested ?physician ?patient)) )
((!requestRadiologyReport ?physician ?radiologist ?patient)
(!sendRadiologyReport ?radiologist ?physician ?patient)
(!generateTreatmentPlan ?physician ?patient) )
imaging-biopsy-integrated
((patient ?patient) (physician ?physician) (radiologist ?radiologist) (pathologist ?pathologist) (iAppointmentKept ?patient ?radiologist) (bAppointmentKept ?patient ?radiologist) )
((!requestRadiologyReport ?physician ?radiologist ?patient)
(!requestPathologyReport ?physician ?radiologist ?pathologist ?patient)
(!sendRadiologyReport ?radiologist ?physician ?patient)
(!sendPathologyReport ?radiologist ?physician ?pathologist ?patient)
(!sendIntegratedReport ?radiologist ?pathologist ?patient ?physician)
(!generateTreatmentPlan ?physician ?patient) )
)
; Domain dependent operators
(:operator (!requestAssessment ?patient ?physician)
() ; Pre
() ; Del
((diagnosisRequested ?patient ?physician)) ; Add
1 ; Cost
)
(:operator (!requestImaging ?physician ?patient ?radiologist)
(and (physician ?physician) (patient ?patient) (radiologist ?radiologist)) ;Pre
() ;Del
((iAppointmentRequested ?patient ?radiologist) (imagingRequested ?physician ?patient)) ;Add
1 ; Cost
)
(:operator (!requestBiopsy ?physician ?patient ?radiologist)
(and (physician ?physician) (patient ?patient) (radiologist ?radiologist)) ;Pre
() ;Del
((bAppointmentRequested ?patient ?radiologist) (biopsyRequested ?physician ?patient)) ;Add
1 ; Cost
)
;; PT: performImaging and sendImagingResults can be combined.
(:operator (!performImaging ?radiologist ?patient ?physician)
(and (patient ?patient) (radiologist ?radiologist) (physician ?physician) (iAppointmentRequested ?patient ?radiologist)) ; Pre
( (iAppointmentRequested ?patient ?radiologist) ) ; Del
((imagingScan ?patient ?physician) (iAppointmentKept ?patient ?radiologist)) ; Add
1 ; Cost
)
;; Change this to have the radiologist doing the biopsy
(:operator (!performBiopsy ?radiologist ?patient ?physician)
(and (patient ?patient) (radiologist ?radiologist) (physician ?physician)) ; Pre
((bAppointmentRequested ?patient ?radiologist)) ; Del
((biopsyReport ?patient ?physician) (bAppointmentKept ?patient ?radiologist) (tissueProvided ?patient) ) ; Add
1 ; Cost
)
;; Instead of performDiagnosis, we need:
;; (A) requestPathologyReport operator; radiologist requests a pathologist for pathology report
;; (B) requestRadiologyReport operator; pathologist requests a radiologist for radiology report
(:operator (!requestPathologyReport ?physician ?radiologist ?pathologist ?patient)
(and (physician ?physician) (pathologist ?pathologist) (radiologist ?radiologist) (patient ?patient) (biopsyReport ?patient ?physician) ) ; Pre
() ; Del
((pathologyRequested ?physician ?pathologist ?patient)) ; Add
1 ; Cost
)
(:operator (!requestRadiologyReport ?physician ?radiologist ?patient)
(and (physician ?physician) (radiologist ?radiologist) (patient ?patient) (imagingScan ?patient ?physician)) ; Pre
() ; Del
((radiologyRequested ?physician ?radiologist ?patient)) ; Add
1 ; Cost
)
(:operator (!sendPathologyReport ?radiologist ?physician ?pathologist ?patient)
(and (physician ?physician) (radiologist ?radiologist) (patient ?patient) (biopsyReport ?patient ?physician)
(pathologyRequested ?physician ?pathologist ?patient))
() ;Del
( (radPathResultsReported ?radiologist ?physician ?patient) (pathResultsReported ?radiologist ?physician ?patient) ) ;Add
)
(:operator (!sendRadiologyReport ?radiologist ?physician ?patient)
(and (physician ?physician) (radiologist ?radiologist) (patient ?patient)
(imagingScan ?patient ?physician) ;(biopsyReport ?patient ?physician)
(radiologyRequested ?physician ?radiologist ?patient)
)
() ;Del
( (imagingResultsReported ?radiologist ?physician ?patient) ) ;Add
)
(:operator (!sendIntegratedReport ?radiologist ?pathologist ?patient ?physician)
(and (radPathResultsReported ?radiologist ?physician ?patient)
(imagingResultsReported ?radiologist ?physician ?patient)
(radiologist ?radiologist) (physician ?physician)
(patient ?patient) (pathologist ?pathologist)) ; Pre
;((radPathResultsReported ?radiologist ?physician ?patient) (imagingResultsReported ?radiologist ?physician ?patient)) ; Del
nil
((integratedReport ?patient ?physician) (diagnosisProvided ?physician ?patient)) ; Add
1 ; Cost
)
(:operator (!generateTreatmentPlan ?physician ?patient)
(and (patient ?patient) (physician ?physician) (imagingScan ?patient ?physician) ;(integratedReport ?patient ?physician) ;<- This should not be a precondition (since only imaging may do)
) ; Pre
() ; Del
((treatmentPlan ?physician ?patient) (diagnosisProvided ?physician ?patient)) ; Add
1 ; Cost
)
(:operator (!reportPatient ?patient ?pathologist ?registrar)
(and (patient ?patient) (pathologist ?pathologist) (registrar ?registrar) (patientHasCancer ?patient)) ; Pre
() ; Del
( (patientReportedToRegistrar ?patient ?registrar) ) ; Add
1 ; Cost
)
(:operator (!addPatientToRegistry ?patient ?registrar)
(and (patient ?patient) (registrar ?registrar) (patientReportedToRegistrar ?patient ?registrar)) ; Pre
() ; Del
( (inRegistry ?patient) ) ; Add
1 ; Cost
)
;; TODO Add operators to re-assign radiologist (perhaps through appointment)
(:operator (!escalateFailure ?patient ?physician ?radiologist ?hospital)
(and (radiologist ?radiologist) (physician ?physician) (patient ?patient) (hospital ?hospital) (not (imagingScan ?patient ?radiologist)) ) ; Pre
() ; Del
( (radiologistReported ?patient ?physician ?radiologist ?hospital)) ; Add
1 ; Cost
)
;; TODO Ask Pankaj about how this works
;; Patient, Physician, Radiologist, or Pathologist can request Tumor Board (TB) for assessment of a
;; report sent to them by a counter party.
;; (A) Patient can request TB to assess Physician's report; TB either agrees or disagrees
;; with Physician's report.
;; FIXME FRM - Pankaj, so far, I had not seen a "physician's" report, I'm assuming this is the treatment plan
;; (B) Physician can request TB to assess the "integratedReport" sent by Radiologist; TB either agrees
;; or disagrees with Radiologist's report.
;; FIXME FRM - Pankaj, I'm not sure I understand that the integrated report is created by the radiologist
;; (C) Pathologist can request TB to assess Radiologist's report; TB either agrees or disagress
;; with Radiologist's report.
;;
;; (D) Radiologist can request TB to assess Pathologist's report; TB either agrees or disagress
;; with Pathologist's report.
; (:operator (!requestTumorBoardInput ?person ?patient ?physician ?hospital)
; (and (hospital ?hospital)
; (patient ?patient) (physician ?physician)
; (or (patient ?person) (radiologist ?person) (physician ?person) (pathologist ?person))
; (integratedReport ?patient ?physician)
; ) ; Pre
; () ; Del
; () ; Add
; 1 ; Cost
; )
; Patient requests assessment of physician report
(:operator (!requestPhysicianReportAssessment ?patient ?physician ?hospital)
(and (hospital ?hospital)
(patient ?patient) (physician ?physician)
(integratedReport ?patient ?physician)
) ; Pre
() ; Del
((reportNeedsReview ?patient ?physician)) ; Add # Option 1, TB disagrees
; () ; Add # Option 2, TB agrees with physician (nothing happens)
1 ; Cost
)
(:operator (!requestRadiologyReportAssessment ?pathologist ?radiologist ?patient ?hospital)
(and (hospital ?hospital)
(patient ?patient) (pathologist ?pathologist) (radiologist ?radiologist)
(radiologyReport ?patient ?radiologist)
) ; Pre
() ; Del
((reportNeedsReview ?patient ?radiologist)) ; Add # Option 1, TB disagrees
; () ; Add # Option 2, TB agrees with radiologist (nothing happens)
1 ; Cost
)
(:operator (!requestPathologyReportAssessment ?radiologist ?pathologist ?patient ?hospital)
(and (hospital ?hospital)
(patient ?patient) (pathologist ?pathologist) (radiologist ?radiologist)
(pathologyReport ?patient ?pathologist)
) ; Pre
() ; Del
((reportNeedsReview ?patient ?pathologist)) ; Add # Option 1, TB disagrees
; () ; Add # Option 2, TB agrees with pathologist (nothing happens)
1 ; Cost
)
; ---------------
(:method (step1 ?patient)
(
(patient ?patient)
(physician ?physician)
(radiologist ?radiologist)
(commitment C1 ?c1_patient ?physician ?patient)
(commitment C2 ?c2_patient ?patient ?physician)
(commitment C3 ?c3_patient ?patient ?physician)
)
(
(!consider G1 ?g1i ?physician (?patient) )
(!activate G1 ?g1i ?physician (?patient) )