title: Increase / Decrease Battery amount PDDL
body: <p>I am a beginner in PDDL and currently want to build a Project, that allows a rover to autonomously act on mars. Basically, the rover should have a battery.</p>
  <p>Eg. rover can increase the amount by charging at a waypoint (+10 per action) and the percentage will be decreased <code>a -&gt; b</code> (-15).
  It should be modeled rather simple so there has to be no decrease over time, I just want to define in the <code>init</code> sth. like:
  when it travels from a to b amount decreased by 10, from b to c by -10 and from a to c -25...
  this is my <strong>domain</strong> file currently:</p>
  <pre><code>(define (domain rover)
  
      (:requirements :fluents)
      (:types     LOCATION - Obj
                  ROVER - Obj)
      (:constants )
      (:predicates    (path           ?r - ROVER  ?l1 ?l2 - LOCATION)
                      (at             ?r - ROVER  ?l - LOCATION)
  
      )
      (:functions
              (battery-amount)
              ;(battery-capacity)
      )
      (:action move
              :parameters (?r - ROVER    ?from - LOCATION    ?to - LOCATION)
              :precondition (and (at ?r ?from) (path ?r ?from ?to) (&gt; (battery-amount) 90)) 
              :effect (and (at ?r ?to) (not (at ?r ?from))
                      (decrease (battery-amount) 10)
              )
      )
  )
  </code></pre>
  <p>this is the Problem:</p>
  <pre><code>(define (problem      roverprob1)
      (:domain    rover)
      (:objects 
          r0              - ROVER
          l0 l1 l2 l3 l4   - LOCATION)
          
      (:init  (at r0 l1) (= (battery-amount) 100)
              (path r0 l3 l0) (path r0 l0 l3) (path r0 l3 l1) 
              (path r0 l1 l3) (path r0 l1 l2) (path r0 l2 l1)
              (path r0 l3 l4) (path r0 l4 l3)
      )
      (:goal  (and (at r0 l4)))    
  )
  </code></pre>
  <p>My idea was that my <code>battery-amount</code> should be a function in the domain, Its initial value is set in Problem with 100 and to start with every action <code>move</code> should decrease the amount by 10.</p>
  <p>to verify the results I implemented a precondition to the action move which should check if the amount is greater than 90.</p>
  <p>My rover has to move in two steps in order to get to Location l4. so he should not be able to make it to l4.</p>
  <p>Interestingly enough the <a href="http://editor.planning.domains/" rel="nofollow noreferrer">Editor</a> still finds a way to solve the problem. It is the same solution that I would get without the battery amount.
  It seems to me, that he does not update the value and I have no idea why ^^</p>
  <p>thank you in advance for any help or suggestions!</p>
  <p><strong>UPDATE</strong></p>
  <p>I dug further into the problem and got myself the <code>PDDL</code> expansion for <code>VSCode</code>.
  You can view the current state here: <a href="http://editor.planning.domains/#read_session=OhB4I30QRs" rel="nofollow noreferrer">current state</a>
  If I take a look at the visual output that vs code provides I noticed the following:</p>
  <pre><code>(:init
  (at r0 l1)
  (= (fuel-level r0) 90)...)
  </code></pre>
  <p>when the rover has enough energy to drive along the path, the graph for the fuel level shows the following:</p>
  <p><img src="https://i.stack.imgur.com/TBrdB.png" alt="fuel_used_01" /></p>
  <p>but when I change the init value, so the rover should not be able to get to the goal waypoint</p>
  <pre><code>(:init
  (at r0 l1)
  (= (fuel-level r0) 50)...)
  </code></pre>
  <p>the fuel used graph does look very different:</p>
  <p><img src="https://i.stack.imgur.com/v8VAI.png" alt="fuel_used_02" /></p>
  <p>the graph is now a line that seems to be at 0 the whole time.
  So I am thinking, that the planer knows that the fuel is not enough and therefore treats it as 0 but the precondition does not trigger.
  I would expect an output like: <em>Goal can be simplified to false</em> or sth. like that.</p>
  <p>I need this precondition to be working because eventually, I want the rover to recharge its battery when he determines that he cant make a path with his fuel level...</p>