maumagnaguagno / hypertension_u Goto Github PK
View Code? Open in Web Editor NEW:fleur_de_lis: HTN planning with uncertainty in Ruby
:fleur_de_lis: HTN planning with uncertainty in Ruby
Hello, under what license is this project released under ? Thank-you.
I'm getting errors of the type:
hype.sh healthcare.ujshop pbhealthcare-test.ujshop
Script at /Users/meneguzzi/Documents/workspace-planning/HyperTension_U
Axiom p parameters redefined, from ["?c", "c1", ["?t"]] to ["?c", "c2", ["?t"]]
/Users/meneguzzi/Documents/workspace-planning/HyperTension_U/UJSHOP_Parser.rb:157:in `parse_domain'
/Users/meneguzzi/Documents/workspace-planning/HyperTension_U/Hype.rb:32:in `parse'
/Users/meneguzzi/Documents/workspace-planning/HyperTension_U/Hype.rb:81:in `<main>'
But I simply cannot find where exactly in the files these errors are coming from. It's sort of urgent to sort it out.
Best,
Felipe
Both operators suspendG
and reactivateG
have a free variable ?g
.
(:operator (!suspendG ?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 (!reactivateG ?gi ?a ?gv)
( (goal ?g ?gi ?a) (suspendedG ?g ?gi ?gv) (not (terminalG ?g ?gi ?gv)) (not (nullG ?g ?gi ?gv)) )
( (suspendedG ?g ?gi ?gv) )
( (activatedG ?g ?gi ?gv) )
1
)
Each operator is applied once by methods that already have ?g
, we could propagate this value.
(: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 ?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 ?gi ?d ?gv))
)
Other goal related operators already have a parameter ?g
.
Is there any reason to keep ?g
a free variable?
Even without the entire domain converted we have our first plan for Healthcare.
EDIT: now emulating lists, so we can see parentheses around terms.
> ruby pbhealthcare.ujshop.rb -d
----------------------Tasks-----------------------
0: hospitalScenario()
1: testCommitments()
---------------------Planning---------------------
hospitalScenario_case0()
seekHelp_case0(alice)
create(C1,C1,bob,alice,(nil))
requestAssessment(alice,bob)
processPatient_process_patient_healthy(alice)
performImagingTests_imaging(alice)
create(C2,C2,alice,bob,(clyde))
create(C5,C5,clyde,bob,(doug))
requestImaging(bob,alice,clyde)
attendTest_attend_imaging(alice)
performImaging(clyde,alice,bob)
performPathologyTests_biopsy_unnecessary(alice)
deliverDiagnostics_only_imaging(alice)
requestRadiologyReport(bob,clyde,alice)
sendRadiologyReport(clyde,bob,alice)
generateTreatmentPlan(bob,alice)
testCommitments_case0()
testCommitment_case0(C1,C1,nil,satisfied)
invisible_testFailure(C1,satisfied)
testCommitment_case0(C2,C2,nil,satisfied)
invisible_testFailure(C2,satisfied)
testCommitment_case0(C3,C3,nil,satisfied)
invisible_testFailure(C3,satisfied)
testCommitment_case0(C4,C4,nil,satisfied)
invisible_testFailure(C4,satisfied)
testCommitment_case0(C5,C5,nil,satisfied)
invisible_testFailure(C5,satisfied)
testCommitment_case0(C6,C6,nil,satisfied)
invisible_testFailure(C6,satisfied)
testCommitment_case0(C7,C7,nil,satisfied)
invisible_testFailure(C7,satisfied)
testCommitment_case0(C8,C8,nil,satisfied)
invisible_testFailure(C8,satisfied)
Time: 0.04680013656616211s
Plans found: 1
----------------------Plan 1----------------------
Valuation: 0
Probability: 1
0: create(C1, C1, bob, alice, (nil))
1: requestAssessment(alice, bob)
2: create(C2, C2, alice, bob, (clyde))
3: create(C5, C5, clyde, bob, (doug))
4: requestImaging(bob, alice, clyde)
5: performImaging(clyde, alice, bob)
6: requestRadiologyReport(bob, clyde, alice)
7: sendRadiologyReport(clyde, bob, alice)
8: generateTreatmentPlan(bob, alice)
Unexpected behavior is appearing in this problem:
seekHelp
propagates (nil)
in the original version, and is visible as the empty last term of the first action in the plan.testCommitments
propagates unbounded variables cvN
, as a workaround I set them to nil
.The issue is how to deal with such behavior and if it is resulting in an incorrect plan.
May I suggest you comment out lines 30,34 and 35 of Hype.rb so that it accepts files named .jshop too? It's a bit pointless to just check for filenames.
Operator requestBiopsy
receives a ?pathologist
instead of a ?radiologist
as specified by method performPathologyTests
.
(:operator (!requestBiopsy ?physician ?patient ?pathologist)
(and (physician ?physician) (patient ?patient) (radiologist ?radiologist)) ;Pre
() ;Del
((bAppointmentRequested ?patient ?radiologist) (biopsyRequested ?physician ?patient)) ;Add
1 ; Cost
)
(: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)
)
(
(!create C3 ?Ci3 ?patient ?physician (?radiologist))
(!create C4 ?Ci4 ?radiologist ?physician (?pathologist))
(!requestBiopsy ?physician ?patient ?radiologist) ; <= HERE
(attendTest ?patient)
)
)
As a feature request, I'd like for the planner to handle logic rules, as shown in the healthcare domain.
Operators manufactureGoods
, sendGoods
and sendPayment
appear in subtasks for methods that achieve agent goals, but are not defined in the domain. The variable ?t
is also not bounded by any precondition.
;; Redo from here on before testing.
(:method (achieveGoal g2 ?gi c)
((activeG g2 ?gi ) (goal g2 ?gi c) )
((!manufactureGoods c ?t))
)
(:method (achieveGoal g3 ?gi m)
((activeG g3 ?gi ) (goal g3 ?gi m))
((!sendGoods m c ?t))
)
(:method (achieveGoal g4 ?gi c)
((activeG g4 ?gi ) (goal g4 ?gi c))
((!sendPayment c m ?t))
)
(:method (detach ?c ?ci )
((call = ?c c1) (active ?c ?ci ) (commitment ?c ?ci ?a ?d)) ;FM (2013/01/17) Changed the precondition to be more generic
((!sendPayment ?d ?a ?t)) ;FM Was ((!sendPayment c m ?t))
((call = ?c c5) (active ?c ?ci ) (commitment ?c ?ci ?a ?d)) ;FM (2013/01/17) Changed the precondition to be more generic
((!sendGoods ?d ?a ?t)) ; FM Was ((!sendGoods m c ?t))
)
Healthcare domain is currently deterministic and does not consider rewards and costs.
Some common mistakes can be avoided by checking the amount of terms in an axiom or attachment.
Axiom satisfied
calls axiom q
with 3 instead of 2 terms, which always evaluates to false.
(:- (satisfied ?c ?ci ?cv)
(and (not (null ?c ?ci ?cv)) (not (terminal ?c ?ci ?cv)) (q ?c ?ci ?cv))
)
Axiom q
is defined by one variable and one constant parameter, the version with 3 terms appear commented in other places.
(:- (q ?c C1)
(and (commitment ?c ?ci ?d ?a) (var ?c ?ci ) (and (diagnosisProvided ?d ?a)) )
)
Method testCommitment
presents the same problem for axiom p
:
(:method (testCommitment ?c ?ci ?cv ?s)
; ...
((commitment ?c ?ci ?d ?a) (call = ?s p) (p ?c ?ci ?cv)) ; <= HERE
((!!testSuccess ?c ?ci ?cv ?s))
((commitment ?c ?ci ?d ?a) (call = ?s q) (q ?c ?ci))
((!!testSuccess ?c ?ci ?cv ?s))
failed
((commitment ?c ?ci ?d ?a))
((!!testFailure ?c ?s))
)
Rewards are currently only triggered from false
to true
, and vice-versa with the use of not
.
We need to expand the concept to support maintenance rewards.
To differentiate the two types new keywords (trigger|achieve
, maintain
) would be required, an example would be:
(:rewards
(achieve (not (pre 1)) 1) ; Get one valuation when (pre 1) becomes false
(maintain (not (pre 1)) 10) ; Get 10 valuation for each operation that does not change it
)
In the future the reward value could support formulas with a time variable or be limited to win such rewards a limited amount of times.
Alas, my co-authors think we should also have goals here, so we may need to get that working too.
I asked Pankaj to help me with this, let's see how long he takes to reply.
Shared preconditions can be optimized to be evaluated only once, which may require modifications in both UHyper_Compiler#compile_domain
and Hypertension_U#planning
.
This process can be done by:
N + 1
methods)May be slower when evaluating a complex precondition before minimum probability!
See Hypertension_U#execute
.
Some problems may require a different usage of rewards and attachments, currently defined in the domain file. Instead of creating a new domain for such cases the user should be able to overwrite or add to each set in the problem file.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.