include "../library-ontology"
include "../library"

sorts
  City; Airport;
  Truck; Airplane;
  Package;

inclusions
  City << Region;
  Airport << Place;
  Truck << Vehicle;
  Airplane << Vehicle;
  Package << Thing;

module LOGISTICS;

  actions
    Go(Vehicle, Place);

  fluents
    Drivable(City)     : rigid;

  variables
    p : Place;
    c : City;
    v : Vehicle;
    t : Truck;
    a : Airplane;
    pack, pack1 : Package;

  import CARRIER;
    Move(v,p) is Go(v,p);

  import MOVE_IN_REGION;
    Move(t,p) is Go(t,p);
    Movable(c) is Drivable(c);

  axioms

    -DriverRequired(v);

    constraint Location(a)=p -> Airport(p);

    Drivable(c);

    % We can't load or unload a package during transportation!
    nonexecutable Load(pack,v) & Go(v,p);
    nonexecutable (Load(pack,v) | Unload(pack)) & Go(v,p) 
                  if Holds(v,pack);


module LOGISTICS_SPECIFIC;

  import LOGISTICS;

  objects
    T1, T2                     : Truck;
    A1                         : Airplane;
    Pack1, Pack2, Pack3, Pack4 : Package;
    L1                         : Place;
    L2, L3                     : Airport;
    C1, C2                     : City;

  axioms
    At(L1, C1);
    At(L2, C1);
    At(L3, C2);
