tensai-pddl 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +53 -0
- data/.rubocop.yml +19 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +121 -0
- data/Guardfile +38 -0
- data/LICENSE.md +21 -0
- data/README.md +42 -0
- data/Rakefile +6 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/tensai/pddl.rb +13 -0
- data/lib/tensai/pddl/action.rb +3 -0
- data/lib/tensai/pddl/action/strips.rb +20 -0
- data/lib/tensai/pddl/atomic_formula.rb +33 -0
- data/lib/tensai/pddl/data_structures.rb +45 -0
- data/lib/tensai/pddl/data_types.rb +28 -0
- data/lib/tensai/pddl/data_types/base.rb +13 -0
- data/lib/tensai/pddl/data_types/terms.rb +13 -0
- data/lib/tensai/pddl/data_types/variable_list.rb +12 -0
- data/lib/tensai/pddl/domain.rb +14 -0
- data/lib/tensai/pddl/entity.rb +14 -0
- data/lib/tensai/pddl/predicate.rb +21 -0
- data/lib/tensai/pddl/variable.rb +14 -0
- data/lib/tensai/pddl/version.rb +7 -0
- data/tensai-pddl.gemspec +36 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 656de1e21b48f9cd4f08f543a560b100843d961e8b42e1de12c316e3d43fee3b
|
4
|
+
data.tar.gz: 42afe95ca8181fe9df774e9c34cff77481cb27dbbce11cd550a43a0b198aa9bf
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e21589ea710340d1b0b34186ea6883e9bf103eeae5bb595a0467254424b4ebbd5d3e25071e27eda6ee2039b5598af14e5b02fc766830df7cb0d465c0380c62de
|
7
|
+
data.tar.gz: e04e7bd5d756b14b247ebb82b92e2170837c0d783e7e522d5da4317a64d7d3354de18593822c1902636579bf9285efca7aaa43759550ad9509a2b24f09a0e16c
|
data/.gitignore
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
.ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
51
|
+
|
52
|
+
# RSpec
|
53
|
+
.rspec_status
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Style/Lambda:
|
2
|
+
Enabled: false
|
3
|
+
|
4
|
+
Metrics/LineLength:
|
5
|
+
Max: 136
|
6
|
+
|
7
|
+
Metrics/BlockLength:
|
8
|
+
Exclude:
|
9
|
+
- spec/**/*
|
10
|
+
|
11
|
+
Style/BlockDelimiters:
|
12
|
+
Exclude:
|
13
|
+
- spec/**/*
|
14
|
+
|
15
|
+
Layout/MultilineArrayLineBreaks:
|
16
|
+
Enabled: True
|
17
|
+
|
18
|
+
Style/ClassAndModuleChildren:
|
19
|
+
Enabled: False
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at kfischer_okarin@yahoo.co.jp. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in tensai-pddl.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :development do
|
7
|
+
gem 'rake', '~> 10.0'
|
8
|
+
end
|
9
|
+
|
10
|
+
group :development, :test do
|
11
|
+
gem 'rspec', '~> 3.0'
|
12
|
+
gem 'rubocop', '~> 0.74'
|
13
|
+
gem 'rubocop-rspec', '~> 1.35'
|
14
|
+
gem 'guard', '~> 2.15'
|
15
|
+
gem 'guard-rspec', '~> 4.7'
|
16
|
+
gem 'pry-byebug', '~> 3.7'
|
17
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
tensai-pddl (0.1.0)
|
5
|
+
dry-initializer (~> 3.0)
|
6
|
+
dry-types (~> 1.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
ast (2.4.0)
|
12
|
+
byebug (11.0.1)
|
13
|
+
coderay (1.1.2)
|
14
|
+
concurrent-ruby (1.1.5)
|
15
|
+
diff-lcs (1.3)
|
16
|
+
dry-configurable (0.8.3)
|
17
|
+
concurrent-ruby (~> 1.0)
|
18
|
+
dry-core (~> 0.4, >= 0.4.7)
|
19
|
+
dry-container (0.7.2)
|
20
|
+
concurrent-ruby (~> 1.0)
|
21
|
+
dry-configurable (~> 0.1, >= 0.1.3)
|
22
|
+
dry-core (0.4.9)
|
23
|
+
concurrent-ruby (~> 1.0)
|
24
|
+
dry-equalizer (0.2.2)
|
25
|
+
dry-inflector (0.1.2)
|
26
|
+
dry-initializer (3.0.1)
|
27
|
+
dry-logic (1.0.3)
|
28
|
+
concurrent-ruby (~> 1.0)
|
29
|
+
dry-core (~> 0.2)
|
30
|
+
dry-equalizer (~> 0.2)
|
31
|
+
dry-types (1.1.1)
|
32
|
+
concurrent-ruby (~> 1.0)
|
33
|
+
dry-container (~> 0.3)
|
34
|
+
dry-core (~> 0.4, >= 0.4.4)
|
35
|
+
dry-equalizer (~> 0.2, >= 0.2.2)
|
36
|
+
dry-inflector (~> 0.1, >= 0.1.2)
|
37
|
+
dry-logic (~> 1.0, >= 1.0.2)
|
38
|
+
ffi (1.11.1)
|
39
|
+
formatador (0.2.5)
|
40
|
+
guard (2.15.0)
|
41
|
+
formatador (>= 0.2.4)
|
42
|
+
listen (>= 2.7, < 4.0)
|
43
|
+
lumberjack (>= 1.0.12, < 2.0)
|
44
|
+
nenv (~> 0.1)
|
45
|
+
notiffany (~> 0.0)
|
46
|
+
pry (>= 0.9.12)
|
47
|
+
shellany (~> 0.0)
|
48
|
+
thor (>= 0.18.1)
|
49
|
+
guard-compat (1.2.1)
|
50
|
+
guard-rspec (4.7.3)
|
51
|
+
guard (~> 2.1)
|
52
|
+
guard-compat (~> 1.1)
|
53
|
+
rspec (>= 2.99.0, < 4.0)
|
54
|
+
jaro_winkler (1.5.3)
|
55
|
+
listen (3.1.5)
|
56
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
57
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
58
|
+
ruby_dep (~> 1.2)
|
59
|
+
lumberjack (1.0.13)
|
60
|
+
method_source (0.9.2)
|
61
|
+
nenv (0.3.0)
|
62
|
+
notiffany (0.1.3)
|
63
|
+
nenv (~> 0.1)
|
64
|
+
shellany (~> 0.0)
|
65
|
+
parallel (1.17.0)
|
66
|
+
parser (2.6.3.0)
|
67
|
+
ast (~> 2.4.0)
|
68
|
+
pry (0.12.2)
|
69
|
+
coderay (~> 1.1.0)
|
70
|
+
method_source (~> 0.9.0)
|
71
|
+
pry-byebug (3.7.0)
|
72
|
+
byebug (~> 11.0)
|
73
|
+
pry (~> 0.10)
|
74
|
+
rainbow (3.0.0)
|
75
|
+
rake (10.5.0)
|
76
|
+
rb-fsevent (0.10.3)
|
77
|
+
rb-inotify (0.10.0)
|
78
|
+
ffi (~> 1.0)
|
79
|
+
rspec (3.8.0)
|
80
|
+
rspec-core (~> 3.8.0)
|
81
|
+
rspec-expectations (~> 3.8.0)
|
82
|
+
rspec-mocks (~> 3.8.0)
|
83
|
+
rspec-core (3.8.2)
|
84
|
+
rspec-support (~> 3.8.0)
|
85
|
+
rspec-expectations (3.8.4)
|
86
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
87
|
+
rspec-support (~> 3.8.0)
|
88
|
+
rspec-mocks (3.8.1)
|
89
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
90
|
+
rspec-support (~> 3.8.0)
|
91
|
+
rspec-support (3.8.2)
|
92
|
+
rubocop (0.74.0)
|
93
|
+
jaro_winkler (~> 1.5.1)
|
94
|
+
parallel (~> 1.10)
|
95
|
+
parser (>= 2.6)
|
96
|
+
rainbow (>= 2.2.2, < 4.0)
|
97
|
+
ruby-progressbar (~> 1.7)
|
98
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
99
|
+
rubocop-rspec (1.35.0)
|
100
|
+
rubocop (>= 0.60.0)
|
101
|
+
ruby-progressbar (1.10.1)
|
102
|
+
ruby_dep (1.5.0)
|
103
|
+
shellany (0.0.1)
|
104
|
+
thor (0.20.3)
|
105
|
+
unicode-display_width (1.6.0)
|
106
|
+
|
107
|
+
PLATFORMS
|
108
|
+
ruby
|
109
|
+
|
110
|
+
DEPENDENCIES
|
111
|
+
guard (~> 2.15)
|
112
|
+
guard-rspec (~> 4.7)
|
113
|
+
pry-byebug (~> 3.7)
|
114
|
+
rake (~> 10.0)
|
115
|
+
rspec (~> 3.0)
|
116
|
+
rubocop (~> 0.74)
|
117
|
+
rubocop-rspec (~> 1.35)
|
118
|
+
tensai-pddl!
|
119
|
+
|
120
|
+
BUNDLED WITH
|
121
|
+
2.0.1
|
data/Guardfile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
## Uncomment and set this to only include directories you want to watch
|
4
|
+
# directories %w(app lib config test spec features) \
|
5
|
+
# .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
6
|
+
|
7
|
+
## Note: if you are using the `directories` clause above and you are not
|
8
|
+
## watching the project directory ('.'), then you will want to move
|
9
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
10
|
+
#
|
11
|
+
# $ mkdir config
|
12
|
+
# $ mv Guardfile config/
|
13
|
+
# $ ln -s config/Guardfile .
|
14
|
+
#
|
15
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
16
|
+
|
17
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
18
|
+
# rspec may be run, below are examples of the most common uses.
|
19
|
+
# * bundler: 'bundle exec rspec'
|
20
|
+
# * bundler binstubs: 'bin/rspec'
|
21
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
22
|
+
# installed the spring binstubs per the docs)
|
23
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
24
|
+
# * 'just' rspec: 'rspec'
|
25
|
+
|
26
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
27
|
+
require 'guard/rspec/dsl'
|
28
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
29
|
+
|
30
|
+
rspec = dsl.rspec
|
31
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
32
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
33
|
+
watch(rspec.spec_files)
|
34
|
+
|
35
|
+
# Ruby files
|
36
|
+
ruby = dsl.ruby
|
37
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
38
|
+
end
|
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Kevin Fischer
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Tensai PDDL
|
2
|
+
|
3
|
+
Ruby implementation and DSL for PDDL (Planning Domain Definition Language).
|
4
|
+
Part of the Tensai symbolic AI framework.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'ruby_pddl'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install ruby_pddl
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
TODO: Write usage instructions here
|
25
|
+
|
26
|
+
## Development
|
27
|
+
|
28
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
29
|
+
|
30
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kfischer-okarin/tensai-pddl. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
35
|
+
|
36
|
+
## License
|
37
|
+
|
38
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
39
|
+
|
40
|
+
## Code of Conduct
|
41
|
+
|
42
|
+
Everyone interacting in the Ruby PDDL project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/kfischer-okarin/tensai-pddl/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'ruby_pddl'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/tensai/pddl.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'tensai/pddl/action'
|
4
|
+
require 'tensai/pddl/domain'
|
5
|
+
require 'tensai/pddl/entity'
|
6
|
+
require 'tensai/pddl/predicate'
|
7
|
+
require 'tensai/pddl/variable'
|
8
|
+
require 'tensai/pddl/version'
|
9
|
+
|
10
|
+
module Tensai
|
11
|
+
module Pddl
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry-initializer'
|
4
|
+
|
5
|
+
require 'tensai/pddl/atomic_formula'
|
6
|
+
require 'tensai/pddl/data_types'
|
7
|
+
require 'tensai/pddl/data_types/variable_list'
|
8
|
+
require 'tensai/pddl/variable'
|
9
|
+
|
10
|
+
module Tensai::Pddl
|
11
|
+
module Action
|
12
|
+
# STRIPS-style action
|
13
|
+
class Strips
|
14
|
+
include Dry::Initializer.define -> do
|
15
|
+
param :name, type: DataTypes::Name
|
16
|
+
option :parameters, type: DataTypes::VariableList, default: -> { [] }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'set'
|
4
|
+
require 'dry-initializer'
|
5
|
+
|
6
|
+
require 'tensai/pddl/data_types'
|
7
|
+
require 'tensai/pddl/data_types/terms'
|
8
|
+
require 'tensai/pddl/predicate'
|
9
|
+
|
10
|
+
module Tensai::Pddl
|
11
|
+
# Atomic formula in a planning domain
|
12
|
+
class AtomicFormula
|
13
|
+
include Dry::Initializer.define -> do
|
14
|
+
param :predicate, type: DataTypes::InstanceOf(Predicate)
|
15
|
+
param :terms, type: DataTypes::Terms
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(predicate, terms)
|
19
|
+
super predicate, terms
|
20
|
+
|
21
|
+
raise ArgumentError, 'Unknown Terms' if terms.keys.any? { |k| !predicate.variables.key?(k) }
|
22
|
+
|
23
|
+
predicate.variables.each do |var|
|
24
|
+
self.terms[var.name] = var unless terms.key? var.name
|
25
|
+
end
|
26
|
+
self.terms.freeze
|
27
|
+
end
|
28
|
+
|
29
|
+
def bind(values)
|
30
|
+
AtomicFormula.new(predicate, terms.merge(values))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'forwardable'
|
4
|
+
|
5
|
+
require 'dry-types'
|
6
|
+
|
7
|
+
require 'tensai/pddl/data_types/base'
|
8
|
+
|
9
|
+
module Tensai::Pddl
|
10
|
+
# Typed collection of named elements
|
11
|
+
class NamedList
|
12
|
+
extend Forwardable
|
13
|
+
include Enumerable
|
14
|
+
|
15
|
+
def initialize(type, elements)
|
16
|
+
@type = DataTypes::Base.Instance(type)
|
17
|
+
elements.each { |el| add el }
|
18
|
+
end
|
19
|
+
|
20
|
+
include Dry::Initializer.define -> do
|
21
|
+
param :type, type: DataTypes::Base::Instance(Class)
|
22
|
+
end
|
23
|
+
|
24
|
+
def_delegators :elements, :keys, :key?, :[]
|
25
|
+
|
26
|
+
def each
|
27
|
+
elements.values.each { |el| yield el }
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
attr_accessor :type
|
33
|
+
|
34
|
+
def add(added)
|
35
|
+
type[added]
|
36
|
+
raise "Element named '#{added.name}' already contained" if elements.key? added.name
|
37
|
+
|
38
|
+
elements[added.name] = added
|
39
|
+
end
|
40
|
+
|
41
|
+
def elements
|
42
|
+
@elements ||= {}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry-types'
|
4
|
+
|
5
|
+
require 'tensai/pddl/data_types/base'
|
6
|
+
require 'tensai/pddl/data_structures'
|
7
|
+
|
8
|
+
# rubocop:disable Naming/MethodName
|
9
|
+
module Tensai::Pddl
|
10
|
+
# Types for argument validations
|
11
|
+
module DataTypes
|
12
|
+
Name = Base::String
|
13
|
+
.constrained(format: /^[a-z][a-z\d\-_]*$/)
|
14
|
+
.constructor(&:to_s)
|
15
|
+
|
16
|
+
module_function
|
17
|
+
|
18
|
+
def InstanceOf(type)
|
19
|
+
Base::Instance(type)
|
20
|
+
end
|
21
|
+
|
22
|
+
def ListOf(type)
|
23
|
+
InstanceOf(NamedList)
|
24
|
+
.constructor(->(elements) { NamedList.new(type, elements) })
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
# rubocop:enable Naming/MethodName
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry-types'
|
4
|
+
|
5
|
+
require 'tensai/pddl/entity'
|
6
|
+
require 'tensai/pddl/variable'
|
7
|
+
|
8
|
+
module Tensai::Pddl
|
9
|
+
module DataTypes
|
10
|
+
Term = Base::Instance(Entity) | Base::Instance(Variable)
|
11
|
+
Terms = Base::Hash.map(Name, Term)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry-initializer'
|
4
|
+
|
5
|
+
require 'tensai/pddl/data_types'
|
6
|
+
|
7
|
+
module Tensai::Pddl
|
8
|
+
# Planning Domain
|
9
|
+
class Domain
|
10
|
+
include Dry::Initializer.define -> do
|
11
|
+
param :name, type: DataTypes::Name
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry-initializer'
|
4
|
+
|
5
|
+
require 'tensai/pddl/data_types'
|
6
|
+
|
7
|
+
module Tensai::Pddl
|
8
|
+
# Entity in the planning domain (PDDL constant/object)
|
9
|
+
class Entity
|
10
|
+
include Dry::Initializer.define -> do
|
11
|
+
param :name, type: DataTypes::Name
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry-initializer'
|
4
|
+
|
5
|
+
require 'tensai/pddl/data_types'
|
6
|
+
require 'tensai/pddl/data_types/variable_list'
|
7
|
+
|
8
|
+
module Tensai::Pddl
|
9
|
+
# Predicate in a planning domain
|
10
|
+
class Predicate
|
11
|
+
include Dry::Initializer.define -> do
|
12
|
+
param :name, type: DataTypes::Name
|
13
|
+
option :variables, type: DataTypes::VariableList, default: -> { [] }
|
14
|
+
end
|
15
|
+
|
16
|
+
# TODO: Remove once dry-initializer fixes check of unknown positional elements
|
17
|
+
def initialize(name, **options)
|
18
|
+
super name, **options
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry-initializer'
|
4
|
+
|
5
|
+
require 'tensai/pddl/data_types'
|
6
|
+
|
7
|
+
module Tensai::Pddl
|
8
|
+
# Variable in a atomic formula skeleton
|
9
|
+
class Variable
|
10
|
+
include Dry::Initializer.define -> do
|
11
|
+
param :name, type: DataTypes::Name
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/tensai-pddl.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'tensai/pddl/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'tensai-pddl'
|
9
|
+
spec.version = Tensai::Pddl::VERSION
|
10
|
+
spec.authors = ['Kevin Fischer']
|
11
|
+
spec.email = ['kfischer_okarin@yahoo.co.jp']
|
12
|
+
|
13
|
+
spec.summary = 'Ruby implementation and DSL for PDDL (Planning Domain Definition Language)'
|
14
|
+
spec.homepage = 'https://github.com/kfischer-okarin/tensai-pddl'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
if spec.respond_to?(:metadata)
|
18
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
19
|
+
spec.metadata['source_code_uri'] = 'https://github.com/kfischer-okarin/tensai-pddl'
|
20
|
+
# spec.metadata['changelog_uri'] = 'https://github.com/kfischer-okarin/tensai-pddl/CHANGELOG.md'
|
21
|
+
else
|
22
|
+
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
|
23
|
+
end
|
24
|
+
|
25
|
+
# Specify which files should be added to the gem when it is released.
|
26
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
27
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
28
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
29
|
+
end
|
30
|
+
spec.bindir = 'exe'
|
31
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ['lib']
|
33
|
+
|
34
|
+
spec.add_dependency 'dry-initializer', '~> 3.0'
|
35
|
+
spec.add_dependency 'dry-types', '~> 1.1'
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tensai-pddl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kevin Fischer
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-08-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: dry-initializer
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dry-types
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.1'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- kfischer_okarin@yahoo.co.jp
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- ".rubocop.yml"
|
50
|
+
- CODE_OF_CONDUCT.md
|
51
|
+
- Gemfile
|
52
|
+
- Gemfile.lock
|
53
|
+
- Guardfile
|
54
|
+
- LICENSE.md
|
55
|
+
- README.md
|
56
|
+
- Rakefile
|
57
|
+
- bin/console
|
58
|
+
- bin/setup
|
59
|
+
- lib/tensai/pddl.rb
|
60
|
+
- lib/tensai/pddl/action.rb
|
61
|
+
- lib/tensai/pddl/action/strips.rb
|
62
|
+
- lib/tensai/pddl/atomic_formula.rb
|
63
|
+
- lib/tensai/pddl/data_structures.rb
|
64
|
+
- lib/tensai/pddl/data_types.rb
|
65
|
+
- lib/tensai/pddl/data_types/base.rb
|
66
|
+
- lib/tensai/pddl/data_types/terms.rb
|
67
|
+
- lib/tensai/pddl/data_types/variable_list.rb
|
68
|
+
- lib/tensai/pddl/domain.rb
|
69
|
+
- lib/tensai/pddl/entity.rb
|
70
|
+
- lib/tensai/pddl/predicate.rb
|
71
|
+
- lib/tensai/pddl/variable.rb
|
72
|
+
- lib/tensai/pddl/version.rb
|
73
|
+
- tensai-pddl.gemspec
|
74
|
+
homepage: https://github.com/kfischer-okarin/tensai-pddl
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata:
|
78
|
+
homepage_uri: https://github.com/kfischer-okarin/tensai-pddl
|
79
|
+
source_code_uri: https://github.com/kfischer-okarin/tensai-pddl
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 2.7.6
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: Ruby implementation and DSL for PDDL (Planning Domain Definition Language)
|
100
|
+
test_files: []
|