In the system, a ship arriving at a harbor is allocated a vacant berth that fits for the ship. If no such a berth available,
In the system, a ship arriving at a harbor is allocated a vacant berth that fits for the ship. If no such a berth available, the ship has to wait in the pool until a suitable berth is available. The system provides the following functions to allow the harbor master to control the movement of ships in and out of the harbor:
arrive: to register the arrival of a ship
dock: to register a ship docking in a berth
leave: to register a ship leaving a berth
We assume that all ships will have to arrive and be waiting (perhaps only notionally) in the pool before they can dock
consistent: Harbor Bool
consistent(h)
Define a predicate expression for the following constraints:
1. A ship cannot be in two different places (i.e., both the pool and a berth) at once
2. A ship can be docked in only one berth
3. A ship can only be in a berth it fits
is_docked: ShipHarbor Bool
is_docked(s,h)
Define a predicate expression for the following constraint:
1. There exists a berth that is occupied by the ship s.
Guard functions expressing preconditions for the generator functions which are partial. These functions are derived from the observer functions.
can_arrive: ShipHarbor Bool
can_arrive(s,h)
Define a predicate expression for the following constraint:
1. The ship s is in neither the waiting pool nor a dock
can_dock: ShipBerthHarbor Bool
can_dock(s,b,h)
Define predicate expressions for the following constraints:
1. The ship s is in the waiting pool.
2. The ship s is not docked.
3. The berth b is vacant.
4. The ship s fits in the berth b.
can_leave: ShipBerthHarbor Bool
can_leave(s,b,h)
Define predicate expressions for the following constraint:
1. The ship s is the one that occupies the berth b
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started