Skip to content

Commit

Permalink
Merge pull request #3 from aldebaran/github
Browse files Browse the repository at this point in the history
Quick merge, with no review, sorry.
  • Loading branch information
Victor Paléologue authored Jun 30, 2021
2 parents e0a3e68 + e47e422 commit c056585
Show file tree
Hide file tree
Showing 44 changed files with 2,157 additions and 537 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ At the same time, it is hoped that the UI helps beginners to more quickly unders
Finally, by virtue of having the planner as a remote service, callable dynamically, the user is free to test out different variations of the problem with the click of a button, without the need to compile or write unit tests.
Note that this application works with PDDL (short for Planning Domain Definition Language), which is a planning language used by the International Conference on Autonomous Planning and Scheduling ([ICAPS](http://www.icaps-conference.org/)).

## What is it **not** for?
## What is it *not* for?
This application is not meant to be a general interface for PDDL planning, but rather a *playground* for people to learn the basics of PDDL interactively. Please don't expect to use this application to [plan inter-planetary exploration](https://github.com/nasa/OpenSPIFe/wiki)!

## Requirement:
Expand All @@ -23,7 +23,7 @@ Conversely, the problem describes the concrete situation of the problem, such as

Under the domain group there are 4 components: object types, constants, predicates, and actions.
Object types define the type of objects that can exist in the world.
Constants are objects that present in all instances of the problem.
Constants are objects that are present in all instances of the problem.
Predicates describe some aspect of the state of the world, optionally using objects as parameters.
An action defines a transformation on the state of the world, taking objects as parameters, and predicates as preconditions and effects.

Expand Down Expand Up @@ -53,11 +53,17 @@ When reproducing the example, make sure to fill in the components from top to bo
![Sample Domain](screenshots/domain.png)
![Sample Problem](screenshots/problem.png)

## Limitations
As this application is meant to be a PDDL primer for novice users, it lacks a great deal of features that are essential for complex planning scenarios.
Listed below are some notable limitations:
- all the available features are based on PDDL1.2
- no support for `exists`, `or`, `forall` in action preconditions
- no support for `when` in action effects
- limited support for operators in goals

## Further Reading
The explanations of the PDDL components provided in this file and in the application is adapted from [The AI Planning & PDDL Wiki](https://planning.wiki/).
This excellent source provides in-depth information about the different versions of PDDL over the years, and a long list of planners that are designed to work with PDDL.

## TODO
* use ppdl-planning library for parsing PDDL expressions
* improve pop-up for editing goals
* enable subtyping
* use ppdl-planning library for parsing PDDL expressions
6 changes: 4 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<activity android:name=".MainActivity">
Expand All @@ -19,7 +19,9 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".service.LoadExpressionsService"/>
<service android:name=".service.LoadExpressionsService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="false"/>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.fragment.app.FragmentActivity
import com.softbankrobotics.pddlplanning.IPDDLPlannerService
import com.softbankrobotics.pddlplanning.PlanSearchFunction
import com.softbankrobotics.pddlplanning.createPlanSearchFunctionFromService
import com.softbankrobotics.pddlplayground.ui.fragment.AlertFragment
import com.softbankrobotics.pddlplayground.ui.fragment.InfoFragment
import com.softbankrobotics.pddlplayground.ui.main.MainFragment
import kotlinx.coroutines.GlobalScope
Expand Down Expand Up @@ -55,6 +56,18 @@ class MainActivity : AppCompatActivity() {
showInfoFragment(this, R.string.info_help_title, R.string.info_help_summary)
true
}
R.id.action_attribution -> {
showInfoFragment(this, R.string.info_attribution_title, R.string.info_attribution_summary)
true
}
R.id.action_import -> {
showAlertFragment(this, R.string.import_sample, R.string.alert_import_sample_summary, true)
true
}
R.id.action_clear -> {
showAlertFragment(this, R.string.clear_data, R.string.alert_clear_data_summary)
true
}
else -> {
super.onOptionsItemSelected(item)
}
Expand All @@ -64,10 +77,16 @@ class MainActivity : AppCompatActivity() {
companion object {
lateinit var planSearchFunction: PlanSearchFunction
private const val PROVIDE_INFO = "provide_info"
private const val ALERT_USER = "alert_user"

fun showInfoFragment(activity: FragmentActivity, title: Int, message: Int) {
InfoFragment.newInstance(activity.getString(title), activity.getText(message))
.show(activity.supportFragmentManager, PROVIDE_INFO)
}

fun showAlertFragment(activity: FragmentActivity, title: Int, message: Int, import: Boolean = false) {
AlertFragment.newInstance(activity.getString(title), activity.getText(message), import)
.show(activity.supportFragmentManager, ALERT_USER)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class ExpressionAdapter : RecyclerView.Adapter<ExpressionAdapter.ExpressionViewH
}
holder.delete.setOnClickListener {view ->
val context = view.context
//TODO: delete item from dialog fragment instead?
val rowsDeleted: Int = DatabaseHelper.getInstance(context!!).deleteExpression(expression)
if (rowsDeleted == 1)
LoadExpressionsService.launchLoadExpressionsService(context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class DatabaseHelper private constructor(context: Context) : SQLiteOpenHelper(co
.update(TABLE_NAME, ExpressionUtil.toContentValues(expression), where, whereArgs)
}

fun deleteAllExpressions(): Int {
return writableDatabase.delete(TABLE_NAME, null, null)
}

fun deleteExpression(expression: Expression): Int {
return deleteExpression(expression.getId())
}
Expand Down
Loading

0 comments on commit c056585

Please sign in to comment.