A Simple Demonstration of the Basic Problem Solver Debugger

Introduction

The Basic Problem Solver is acccompanied by a tool to support debugging the problem solving process. The debugging tool is an interactive command loop allowing a user to interact with the problem solver to better understand the problem solving process.

The debugger is invoked in the LISP context.

KM: (ps-debug)
---------------------------------------------
A debugger for the Basic Problem Solver v0.01
---------------------------------------------
(ps-debug)

This note demonstrates the debugger  using the CPL output for the following 15July05 Physics demo question.
An object is thrown from the top of a cliff.
The initial horizontal velocity of the object is 20 m/s.
The initial vertical velocity of the object is 0 m/s.
The height of the cliff is 125 m.
The object falls from the top of the cliff to the level ground.
What is the duration of the fall?
The CPL output for version 1.33b is available in question.triples .

The following two snippets demonstrate the basic features of the debugger.
A section briefly describing other commands supported by the debugger tool is also included.

Snippet #1

Demonstrates the interaction capability allowing the user to crank the problem solver in a stepwise manner.

Commands used in demo.

Command
Remarks
begin <scenario> <question>
Initializes the problem solver context and loads up the necessary CPL outputs for the question.
The <scenario> and <question> arguments refer to the LISP objects created by CPL.
next
Attempts problem solving on next Viewpoint and reverts control back to user.
continue
Revert control to problem solver to investigate all Viewpoints without further interaction from user.
ls
Returns a listing of the Viewpoints investigated by the problem solver.

The following trace demonstrates the use of the above commands.
KM(9): (load "question.triples")
T
KM(10): (ps-debug)
---------------------------------------------
A debugger for the Basic Problem Solver v0.01
---------------------------------------------
(ps-debug) begin *scenario* *compute-questions*
Basic Problem Solver is reset.
---------------------------------------------------------
The following triples were contributed by the rule-engine
---------------------------------------------------------

(|_Velocity-Value189| |instance-of| |Velocity-Value|)
(|_Velocity-Value189| |value| (:|pair| 0 |*meter-per-second|))
(|_Fall2331_c184| |velocity| |_Velocity-Value189|)

T
(ps-debug) next
Trying _Viewpoint191 => NIL
T
(ps-debug) continue
Unifying _Object2305_c274 with _Physical-Object240_c281.
Unifying _Fall2331_c270 with _Fall235_c283.
Unifying _Velocity-Value189_c267 with _Velocity-Value237_c286.
Unifying _Top2306_c277 with _Spatial-Entity239_c285.
Unifying _Ground2335_c269 with _Spatial-Entity238_c280.
Unifying _Duration2339_c268 with _Duration-Value241_c282.
Unifying NIL with NIL.
Unifying _Height2328_c271 with _Height-Value242_c284.
Trying _Viewpoint274 => (_Viewpoint274)
_Viewpoint274
(ps-debug) ls
-------------------
Viewpoint hierarchy
-------------------
_Viewpoint191
_Viewpoint274
_Viewpoint275 ...
_Viewpoint276 ...
_Viewpoint277 ...

--------------------------------------------------
Viewpoints were examined in the following sequence
--------------------------------------------------
(_Viewpoint191 _Viewpoint274)

T
(ps-debug)


Snippet #2

Demonstrates the adhoc mode which allows fine-grained interaction between the user and the problem solver.

Commands use in demo.

Command
Remarks
begin <scenario> <question>
Initializes the problem solver context and loads up the necessary CPL outputs for the question.
The <scenario> and <question> arguments refer to the LISP objects created by CPL.
adhoc
For entering and exiting adhoc mode.
try <concept1> <concept2> ...
Query problem solver if given concepts can be used as potential Viewpoints.
try all
Queries problem solver for all potential Viewpoints.
pick
User selects a potential Viewpoint to attempt problem solving.
unpick
User unselects current Viewpoint and returns to previous Viewpoint to attempt problem solving.
why
Queries problem solver on circumstances for current Viewpoint.

The following trace demonstrates the use of the above commands.
KM(37): (load "question.triples")
T
KM(38): (ps-debug)
---------------------------------------------
A debugger for the Basic Problem Solver v0.01
---------------------------------------------
(ps-debug) begin *scenario* *compute-questions*
Basic Problem Solver is reset.
---------------------------------------------------------
The following triples were contributed by the rule-engine
---------------------------------------------------------
(|_Velocity-Value1363| |instance-of| |Velocity-Value|)
(|_Velocity-Value1363| |value| (:|pair| 0 |*meter-per-second|))
(|_Fall2331_c2415| |velocity| |_Velocity-Value1363|)

T
(ps-debug) adhoc
Entering adhoc mode
(ps-debug) try Metal-Nonmetal-Reaction
NIL
(ps-debug) try all
_Viewpoint1449 is mapped to Fall-From-Rest-System
_Viewpoint1450 is mapped to Uniform-Acceleration-System
_Viewpoint1451 is mapped to Uniform-Motion-System
_Viewpoint1452 is mapped to Cell
T
(ps-debug) pick _Viewpoint1451
Unifying _Object2305_c2482 with _Physical-Object1398_c2488.
Unifying _Fall2331_c2478 with _Move1400_c2491.
Unifying _Velocity-Value1363_c2475 with _Velocity-Value1401_c2489.
Unifying _Duration2339_c2476 with _Duration-Value1402_c2490.
Picking _Viewpoint1451 as the next Viewpoint
_Viewpoint1451 has viewpoint-answer => (There is a duration.)
The current Viewpoint is _Viewpoint1451

(ps-debug) why
(
Equation-Set used : Uniform-Motion-Equation-Set
Known variable bindings : |v| = (0 (/ |*meter| |*second|))
Solved variable bindings : Not appliable
Unsolved variable bindings : (|d| |t|)
Equation expressions : (= |d| (* |v| |t|))

)
(ps-debug) unpick
The current Viewpoint is _Viewpoint1365.

(ps-debug) try all
_Viewpoint1541 is mapped to Fall-From-Rest-System
_Viewpoint1542 is mapped to Uniform-Acceleration-System
_Viewpoint1543 is mapped to Uniform-Motion-System
_Viewpoint1544 is mapped to Cell
T
(ps-debug) pick _Viewpoint1541
Unifying _Object2305_c2677 with _Physical-Object1507_c2684.
Unifying _Fall2331_c2673 with _Fall1502_c2686.
Unifying _Velocity-Value1363_c2670 with _Velocity-Value1504_c2689.
Unifying _Top2306_c2680 with _Spatial-Entity1506_c2688.
Unifying _Ground2335_c2672 with _Spatial-Entity1505_c2683.
Unifying _Duration2339_c2671 with _Duration-Value1508_c2685.
Unifying NIL with NIL.
Unifying _Height2328_c2674 with _Height-Value1509_c2687.
Picking _Viewpoint1541 as the next Viewpoint
_Viewpoint1541 has viewpoint-answer => (The duration of the fall = 5.05 second.)
The current Viewpoint is _Viewpoint1541

(ps-debug) why
(
Equation-Set used : Fall-From-Rest-Equation-Set
Known variable bindings : |g| = (9.8 (/ |*meter| (* |*second| |*second|)))
: |y| = (125 |*meter|)
Solved variable bindings : |t| = (5.0507627 |*second|)
Unsolved variable bindings : (|v| |v0|)
Equation expressions : (= |v| (+ |v0| (* |g| |t|)))
: (= |y| (* (* 0.5 |g|) (|expt| |t| 2)))
: (= |v| (|sqrt| (+ (|expt| |v0| 2) (* (* 2 |g|) |y|))))

)
(ps-debug) adhoc
Exiting adhoc mode

Other interesting commands

The following table lists other commands supported by the basic problem solver debugger.
Command
Remarks
Examples
see <km object>
Inspect KM objects
see _Viewpoint1234
see Metal-Nonmetal-Reaction
see <state-variable>
see all
Inspect the state of the problem solver
see openlist
see closedlist
see current-node
see current-vp-inst
see current-step
see pruning-condition
see queue_fn
see clock
see heuristic
see user viewpoint-query
see user viewpoint-result-query
see all
watch <state-variable>
watch all
Watches certain or all states of the problem solver. Whenever a state mutates, it will be reported.
watch openlist
watch closedlist
watch current-node
watch current-vp-inst
watch current-step
watch pruning-condition
watch queue_fn
watch clock
watch all
step
Finer-grained version of the next command.
Each next command moving from a Viewpoint to the next involves 4 steps.
step
sieve <pruning-condition>
Applies pruning condition to all Viewpoint instances known to problem solver and returns a listing depicting instances satisfying pruning condition
sieve physics-solvep
query viewpoint model <viewpoint>
query viewpoint model all
Returns the model used
query viewpoint model _Viewpoint1234
query viewpoint model all
query viewpoint answer <viewpoint>
query viewpoint answer all
Returns the viewpoint-answer
query viewpoint answer _Viewpoint1234
query viewpoint answer all
query viewpoint answer detail <viewpoint>
query viewpoint answer detail all
Returns the viewpoint-answer-detail
query viewpoint answer detail _Viewpoint1234
query viewpoint answer detail all
query viewpoint answer page <viewpoint>
query viewpoint answer page all
Returns the viewpoint-answer-page
query viewpoint answer page _Viewpoint1234
query viewpoint answer page all
query viewpoint answer <viewpoint>
query viewpoint answer all
Returns the viewpoint-answer
query viewpoint answer _Viewpoint1234
query viewpoint answer all
query result <viewpoint>
query result all
Returns answer value of Viewpoint
query result _Viewpoint1234
query result all
query result type <viewpoint>
query result type all
Returns the KM type for answer value of Viewpoint
query result type _Viewpoint1234
query result type all
push user viewpoint query <prefix>
Constructs a query by including another outer-most query.
The query will be applied on Viewpoint instances.
push user viewpoint query (the instance-of of)
push user viewpoint-result query <prefix> Constructs a query by including another outer-most query.
The query will be applied on the result slot of Viewpoint instances.
push user viewpoint-result query (the value of)
pop user viewpoint query
Deconstructs query by removing outer-most query.
This query will be applied on Viewpoint instances.
pop user viewpoint query
pop user viewpoint-result query Deconstructs query by removing outer-most query.
This query will be applied on the result slot of Viewpoint instances.
pop user viewpoint-result query
apply user viewpoint query <viewpoint>
apply user viewpoint query all
Applies user query on Viewpoint instances
apply user viewpoint query _Viewpoint1234
apply user viewpoint query all
apply user viewpoint-result query <viewpoint>
apply user viewpoint-result query all
Applies user query on the result slot of Viewpoint instances
apply user viewpoint-result query _Viewpoint1234
apply user viewpoint-result query all


Last Updated by Jason Chaw on 30Sept05