Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Geting more than one top plan with different costs

48 views
Skip to first unread message

Yurii Rashkovskii

unread,
Feb 6, 2025, 7:06:40 PMFeb 6
to Picat
Hi,

With `best_plan_nondet,` I can get multiple equally costly best solutions. But I want to retrieve all solutions in a certain cost band. Is this feasible at all?

Thank you,
Yurii

Neng-Fa Zhou

unread,
Feb 7, 2025, 10:32:04 AMFeb 7
to Yurii Rashkovskii, Picat
For example, you could write something like this:

table
plan_range(S,Limit,Plan,Cost) ?=>
    final(S),
    Cost = 0,
    Plan = [].
plan_range(S,Limit,Plan,Cost) =>
    action(S,S1,Action,ThisCost),
    Plan = [Action|Plan1],
    plan_range(S1,Limit,Plan1,Cost1),
    Cost = Cost1+ThisCost,
    Cost =< Limit.

If you define your own planner, you should not import Picat's planner. I have to say that this only works for problems with small search spaces.

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/68d4b38e-66a6-4568-9ddc-2815cbdf4be3n%40googlegroups.com.

Yurii Rashkovskii

unread,
Feb 9, 2025, 9:04:38 AMFeb 9
to Neng-Fa Zhou, Picat
Thank you so much – I am still learning Picat and its approach to planning. From the looks of it, this approach will not be very efficient (as you alluded to the size search space) because it effectively brute-forces through solutions under the Limit. I am trying to understand how the original Picat's planner is doing its job in a more efficient way – but I am still trying to understand how `bp` is implemented :)
--
Y.

Nartoo Meon

unread,
Apr 27, 2025, 8:41:44 AMApr 27
to Picat
Original code of the planner module can be found on the official site on the Modules page(here). Perhaps it's outdated, but maybe it will help to understand how it works (in general).

неділя, 9 лютого 2025 р. о 16:04:38 UTC+2 Yurii Rashkovskii пише:
Reply all
Reply to author
Forward
0 new messages