aiplan4eu / unified-planning

The AIPlan4EU Unified Planning Library
Apache License 2.0
191 stars 41 forks source link

Refine problem kind to express different classes of optimization planning problems #133

Closed alvalentini closed 2 years ago

alvalentini commented 2 years ago

We started collecting requirements here: https://docs.google.com/spreadsheets/d/1PHq8QQRVM8PXBNdgZO_uOCCJL8tfvo7WovZY057ivLM/edit?usp=sharing

mikand commented 2 years ago

@hstairs I would start this issue by adding simple numeric planning to the problem kind as a first item.

We need to add a check for the following condition.

Only constant increase/decrease effects in action effects (e.g., x=x+1), and linear numeric conditions. Objective function can be a minimisation function of a linear combination of fluents. Actions can only have an increasing effects on such a function. For instance, min wx+wy, actions can only increase x or y.

@hstairs question for you: is it possible to have actions that do not increase any fluent in the minimization objective?

hstairs commented 2 years ago

@mikand Thanks! Yes you can have actions that do not affect the objective function in any way

Framba-Luca commented 2 years ago

Hi @hstairs and @roeger I have some questions for you about the SNP.

For now it is mainly in the case when the "Objective function is a minimisation function of a linear combination of fluents".

  1. Is it the same (reversed) if we have a maximization instead?
  2. Using the same terminology of @mikand , he said that actions can only increase x or y; how does this affect decrease effects? Like, can we have a x -= -3, a decrease of a negative value, and still be in the SNP domain? (for now I considered increases of negative values like decreases, but not decreases of negative values like increases)
  3. If we have an assignment that is an "increase-wannabe", like x := x + 1, I am considering it as an increase (same for decreases), is that the right assumption?
  4. Is it possible to have a problem that lifted is not SNP and grounded is SNP or vice-versa? I am struggling to understand what to do when we have a grounded fluent in the objective function and it's lifted version decreased in an action.
  5. Same case of point 4 but in the action preconditions we also have that the lifted fluent called on the action parameter must be different from the grounded fluent in the objective function (so the grounder can see the contraddiction in the action preconditions, discard the action that does not fit the SNP paradigm and so the grounded problem is a SNP problem while the lifted one is not)
  6. How should we handle a case where a fluent in the objective function is set to a given value, like an odometer that we can set to zero? We don't know if it is an increase or a decrease

Thank you very much for your time and attention!

mikand commented 2 years ago

@roeger FYK

mikand commented 2 years ago

Let me reprase/answer quickly. @hstairs @roeger Any comment is welcome!

  1. I assume that minimize an expression is equivalent to maximize the same expression multiplied by -1, so it should not be a problem.
  2. Here the question is: can we consider a (decrease (x) -2) as an (increase (x) 2)? Is this accepted as a SNP?
  3. Here the question is: can we consider an (assign (x) (+ (x) 2)) as an (increase (x) 2)? Is this accepted as a SNP?
  4. I think that the predicate we can write in this issue is purely syntactical, so if we check on a lifted problem we disregard the objects passed as arguement to the functions, otherwise the check becomes too semantic IMHO
  5. Same as above
  6. Here the question is: can we have an (assign (x) 2) where (x) is part of the objective function in a SNP problem?
hstairs commented 2 years ago

Hi Andrea and Luca. The message by Luca was clear, just need to find some time to write :)

  1. Yes
  2. It is. dec inc of a variable by a constant. The constant can also be negative.
  3. As for formal definition of SNP, the assignment will be seen as such and so will ENHSP. There is an obvious translation of course, super obvious, but for safety reason I will leave it out. Meaning that if I see an asgn that means that the problem is not SNP. On this note, can we have this translation done at UP level somehow? Like, do you see a clean way of doing that?
  4. This is a good question, as SNPs are defined only for grounded representations. We can check on the lifted problem as Andrea is suggesting, but on the other hand I see many actual SNP problems not recognized as such. Consider the case where you have an increase x+=distance(l1,l2) and distance is trivially static. As for your comment, this is not going to be considered as an SNP. Right?
  5. No you can't.

Enrico

Framba-Luca commented 2 years ago

So, brief answers summary:

  1. OK!
  2. OK!
  3. OK! part 1; part 2: it is a perfect idea for a compiler!
  4. TL;DR -> now we consider static fluents as constants for the SNP kind. Long version -> As the first draft, the one presented at yesterday's meeting, I was not checking for static fluents; but the current implementation does, so yes, x+= distance(l1, l2) will be seen as a constant increase. (Side note on this: at the moment we consider a fluent static at a lifted level, we never check on which parameters is actually instantiated in the problem; example: if x(o_1) is static, and x(o_2) is not, in the UP we consider the whole fluent x as non static)
  5. OK!

Thank you for your answer!