File tree Expand file tree Collapse file tree 4 files changed +19
-3
lines changed
src/main/kotlin/no/uio/tobiajoh Expand file tree Collapse file tree 4 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 2
2
(:domain suave)
3
3
4
4
(:objects
5
- f_generate_search_path f_follow_pipeline f_maintain_motion fd_spiral_low fd_spiral_medium fd_spiral_high fd_all_thrusters fd_recover_thrusters fd_follow_pipeline 0 .25_decimal 0 .5_decimal 0 .75_decimal 1 .0_decimal 1 .25_decimal 2 .25_decimal 3 .25_decimal < _string battery_level c_thruster_1 c_thruster_2 c_thruster_3 c_thruster_4 c_thruster_5 c_thruster_6 energy obs_water_visibility performance qa_inspect_efficiency_high qa_motion_efficiency_degraded qa_motion_efficiency_normal qa_search_efficiency_high qa_search_efficiency_low qa_search_efficiency_medium qa_water_visibility_high qa_water_visibility_low qa_water_visibility_medium safety - object
5
+ f_generate_search_path f_follow_pipeline f_maintain_motion fd_spiral_low fd_spiral_medium fd_spiral_high fd_all_thrusters fd_recover_thrusters fd_follow_pipeline < _string battery_level c_thruster_1 c_thruster_2 c_thruster_3 c_thruster_4 c_thruster_5 c_thruster_6 energy obs_water_visibility performance qa_inspect_efficiency_high qa_motion_efficiency_degraded qa_motion_efficiency_normal qa_search_efficiency_high qa_search_efficiency_low qa_search_efficiency_medium qa_water_visibility_high qa_water_visibility_low qa_water_visibility_medium safety - object
6
6
a_search_pipeline a_inspect_pipeline - action
7
7
pipeline - pipeline
8
8
bluerov - robot
9
+ 0 .25_decimal 0 .5_decimal 0 .75_decimal 1 .0_decimal 1 .25_decimal 2 .25_decimal 3 .25_decimal - number
9
10
)
10
11
11
12
(:init
Original file line number Diff line number Diff line change 1
1
package no.uio.tobiajoh.owl
2
2
3
3
// owl constant, representing a number
4
- class OwlNumber (val number : Double , name : String ) : OwlAssertionConstant(name) {
4
+ class OwlNumber (private val number : Double , name : String ) : OwlAssertionConstant(name) {
5
+
6
+ companion object {
7
+ // the type that is used for numbers in pddl files
8
+ const val PDDLTYPE = " number"
9
+ }
5
10
6
11
// operator to compare two numbers
7
12
// note: only indicates, which number is larger, not by how much
Original file line number Diff line number Diff line change @@ -74,7 +74,8 @@ class PDDLInjector(val addNumComparisons: Boolean = false) {
74
74
75
75
sP.addInitialAssertions(assertions)
76
76
77
- sP.addObjects(objects)
77
+ sP.addObjects(objects.minus(numbers))
78
+ sP.addNumbers(numbers)
78
79
79
80
sP.outputToFile(newProblem)
80
81
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package no.uio.tobiajoh.pddl
2
2
3
3
import no.uio.tobiajoh.owl.OwlAssertion
4
4
import no.uio.tobiajoh.owl.OwlAssertionConstant
5
+ import no.uio.tobiajoh.owl.OwlNumber
5
6
import java.io.File
6
7
7
8
@@ -93,6 +94,14 @@ class SplitProgram(val problem : File) {
93
94
}
94
95
}
95
96
97
+ fun addNumbers (newNumbers : Set <OwlNumber >) {
98
+ val sortedNumbers = newNumbers.map { it.toString() }.sorted()
99
+ sortedNumbers.forEach { n ->
100
+ if (! objects.containsKey(n))
101
+ objects[n] = OwlNumber .PDDLTYPE
102
+ }
103
+ }
104
+
96
105
fun outputToFile (outFile : File ) {
97
106
outFile.printWriter().use { out ->
98
107
out .println (" (define (problem ${problemName} )" )
You can’t perform that action at this time.
0 commit comments