plaans / aries

Toolbox for automated planning and combinatorial solving.
MIT License
43 stars 7 forks source link

Strange behavior in scheduling problems with activities parameters (UP) #140

Closed nicola-gigante closed 2 months ago

nicola-gigante commented 3 months ago

Hi,

consider this example:

from unified_planning.shortcuts import *
import unified_planning.model.scheduling as sched

problem = sched.SchedulingProblem()

a = problem.add_activity('a', 10)

a.add_parameter('p', BoolType())

print(problem)

with OneshotPlanner(name='aries') as planner:
    solution = planner.solve(problem)
    print(solution)

It prints the following:

fluents = [
]

initial fluents default = [
]

initial values = [
]

BASE: {
  }

Activities:
  a(bool a.p) {
    duration = [10, 10]
  }

status: INTERNAL_ERROR
engine: aries
plan: None

Why does it give INTERNAL_ERROR?

If I comment the add_parameter() line, it works.

Best, Nicola

nicola-gigante commented 2 months ago

@arbimo sorry to bother you, any news here?

arbimo commented 2 months ago

Hi, thanks for stress testing so much the UP and Aries! You should consider adding test cases to the upstream UP ;) There are many combination of features and there are indeed some holes in the coverage.

To help you debug, you probably should probably redirect the output stream of Aries:

solution = planner.solve(problem, output_stream=sys.stdout)

Your problem seems to be a corner case that has not been handled yet, namely non-symbolic parameters in activities. If you look at the output of Aries, you would see that the solver does find a solution to your problem, but fails when trying to convert it into the format expected by the UP -_-'

It should be a fairly trivial fix, I'll try to have a look at it tomorrow.

nicola-gigante commented 2 months ago

Thanks to you for developing such a great tool!

I'll try to bundle up some test cases at the end, that's a good suggestion!

Do you think the problem is fixable with a parameter of integer type as well? I reduced the example to booleans but my initial use case used integers.

nicola-gigante commented 1 month ago

Hi @arbimo, I've come back at this project after a while. Have this fix come up in some release of up-aries? I've run pip install --upgrade --pre up-aries but I did not receive any update.

arbimo commented 1 month ago

Hi, I haven't made a new release yet (and do not push pre-release artifacts to pip) but you can get the latest development build as indicated here : https://github.com/plaans/aries/tree/master/planning/unified/plugin

nicola-gigante commented 1 month ago

Thanks, that's enough already!