This repo contains the code of the unified-planning reusable component. This specific component installs all the planners and offers the operation modes as a GRPC service.
The aiplan4eu-unified-planning-server on the ai4experiments platform is created using the code in this repo.
To create a component that interfaces with the aiplan4eu-unified-planning-server follow the guidelines in the up-graphene-engine repo.
To actually on-board a new component in the platform the docker image must be created and pushed on an online platform (I used dockerhub), then a procedure very similar to the one to create a component that uses the up-graphene-engine must be followed, which is explained in these slides, from On-Boarding a component 1/4
to On-Boarding a component 4/4
. The only modification is the location of the protobuf file, that is defined in the unified-planning/unified_planning/grpc/unified_planning.proto
file.
After all desired steps are followed, the docker image must be built and pushed; an example of this can be found in the push_on_docker.sh file, that must be modified to push the image on your desired docker service.
The version of the unified-planning used by the component is the one added as a submodule in this repo, so to create another component that uses a different version it is enough to enter the unified-planning folder (cd unified-planning) and use git to move between branches and commits.
To install a different subset of engines there are 2 different paths, 1 for the default engines and one for non-default engines; the 2 procedures are not mutually exclusive so non-default engines can be installed with a subset of the default engines.
Note that the preference list of the factory can also be changed where the non-default engines are installed
In the Dockerfile there is the line RUN pip3 install ./unified-planning[engines]
; it is sufficient to modify this line with only the desired engines, for example: RUN pip3 install ./unified-planning[aries,tamer,enhsp,fast-downward]
To install non-default engines their integration must be installed in the Dockerfile (for example adding the line RUN pip3 install up-fast-downward
to install the python package that connects the engine to the unified-planning)
Then, in the server.py file, in the UnifiedPlanningServer.__init__
method, the code to add an engine to the factory must be added.
Here is an example of how to add an engine to the Factory
.
The added engine is by default at the end of the preference list, but the preference list can be set via file following this procedure or modified via python code using the Factory.preference_list
property
and setter
.
Python packages dependencies are defined in the requirements.txt
file while other dependencies must be installed in the Dockerfile (for example the installation of OpenJDK-17)
The GRPC interface of the component is the one that is inside the unified-planning/unified_planning/grpc/unified_planning.proto
; it defines both the protobuf structure used and the interface of the service exposed by this component.
The GRPC service is implemented in the server.py
file, where every method defined by the protobuf server is implemented with the same name as a method of the UnifiedPlanningServer
class.