Basic Usage of the System - PlanX-Universe/sh GitHub Wiki

SH offers a suite of 14 planning services that can be categorized into four main types: parsing services, object-oriented services, data services, and solving services. Solving services can be instance-based and name-based solving services. This section highlights the usage of a name-based and an instance-based solving service.

Using Name-based Solving Service

To utilize a name-based solving service, it is presumed that both the domain model and problem instance already exist in the SH's repository. We assume using the SH's client (Client) to access the following service:

PlanningServices.planWithGivenDomainAndProblemNamePrintPlans(domainName, problemName, numberOfPlans)

Example

PlanningServices.planWithGivenDomainAndProblemNamePrintPlans("deployment", "p-dashboard", 1)

Ensure the domain and problem names match exactly those within the repository.

The service outputs a plan similar to the following:

Plan 1:
1. createinstance(dashboard)
2. createinstance(apache2)
3. start(1.0)
4. bind(httpd,0.0,1.0)
5. start(0.0)
6. createinstance(cassandra)
7. start(2.0)
8. run(2.0)
9. bind(cass-up,0.0,2.0)
10. run(0.0)

Using Instance-based Solving Service

For the instance-based solving service, it is presumed a domain model exists in the SH's repository, while a problem instance is provided as input. This is particularly useful when SH needs to be invoked for dynamically generated problem instances. The service invocation is again performed through the Client interface:

PlanningServices.planWithProvidedProblemInStringReturnPlan(problemToBeSolved, numberOfPlans)

Example

Assuming a problem instance specified in HPDL is stored in a String object called generatedProblem, the service can be invoked as follows:

PlanningServices.planWithProvidedProblemInStringReturnPlan(generatedProblem)

It's important to ensure that generatedProblem includes the correct domain name following the :domain keyword.

Back Home