Planner branching with member/2 not explored?

13 views
Skip to first unread message

Daniel Leone

unread,
Aug 22, 2025, 12:22:52 PMAug 22
to Picat

Hello,

I’ve been experimenting with the planner module in Picat, and I’m running into an issue where my planning problem doesn’t seem to branch as I expect.

In my model, the state is [Timers, Phases, Occs, Time], and I want phase transitions to branch nondeterministically when a timer expires. I wrote update_phase/5 like this:

update_phase(Rem, Phase, Jump, NewRem, NewPhase) ?=> Rem == Jump, next(Phase, NextPhases), % candidates as a list member(NewPhase, NextPhases), % nondet choice duration(NewPhase, NewRem). update_phase(Rem, Phase, Jump, NewRem, NewPhase) => Rem > Jump, NewRem = Rem - Jump, NewPhase = Phase.

My next/2 facts return lists of possible successors, e.g.:

next(green_1, [red_1_long, red_1_short]). next(red_1_long, [green_1]). next(red_1_short, [green_1]).

And duration/2 is defined as:

duration(green_1, 1). duration(red_1_long, 10). duration(red_1_short, 1). ...

When I run plan or best_plan

from the initial state:

Init = [[1,2], [green_1, red_2], [10,1,5], 0],

I only ever see plans going through red_1_long. I expected the planner to also explore the red_1_short branch (and produce a different plan with a lower cost).

It looks like the member/2 nondeterminism is not being explored, or perhaps the planner’s search strategy prunes it too aggressively. Am I misunderstanding how branching in the planner works when member/2 is used inside action/4?

  Thanks a lot for your help!  

traffic_extended.pi

Neng-Fa Zhou

unread,
Aug 22, 2025, 2:02:26 PMAug 22
to Daniel Leone, Picat
All the predicates in the planner module, except best_plan_nondet, are deterministic, and cannot return multiple answers. For your program, you can try 

best_plan_nondet(Init, Plan, Cost),

in order to have all answers returned through backtracking. Nevertheless, you need to be aware that best_plan_nondet only works for problems with a small search space.

Cheers,
NF

--
You received this message because you are subscribed to the Google Groups "Picat" group.
To unsubscribe from this group and stop receiving emails from it, send an email to picat-lang+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/picat-lang/895f8445-8796-4b77-8dc8-f31433f6ae31n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages