scipplan 0.2.0a2__tar.gz → 0.2.1a0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/LICENSE +1 -1
  2. scipplan-0.2.1a0/PKG-INFO +103 -0
  3. scipplan-0.2.1a0/README.md +84 -0
  4. scipplan-0.2.1a0/scipplan/__init__.py +5 -0
  5. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan/parse_model.py +68 -24
  6. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan/plan_model.py +12 -9
  7. scipplan-0.2.1a0/scipplan.egg-info/PKG-INFO +103 -0
  8. scipplan-0.2.0a2/PKG-INFO +0 -215
  9. scipplan-0.2.0a2/README.md +0 -196
  10. scipplan-0.2.0a2/scipplan/__init__.py +0 -5
  11. scipplan-0.2.0a2/scipplan.egg-info/PKG-INFO +0 -215
  12. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/MANIFEST.in +0 -0
  13. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan/config.py +0 -0
  14. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan/helpers.py +0 -0
  15. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan/scipplan.py +0 -0
  16. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan/translation/odes_navigation_1.txt +0 -0
  17. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan/translation/odes_navigation_2.txt +0 -0
  18. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan/translation/odes_navigation_3.txt +0 -0
  19. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan/translation/solutions_navigation_1.txt +0 -0
  20. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan/translation/solutions_navigation_2.txt +0 -0
  21. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan/translation/solutions_navigation_3.txt +0 -0
  22. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan/variables.py +0 -0
  23. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan/zero_crossing.py +0 -0
  24. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan.egg-info/SOURCES.txt +0 -0
  25. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan.egg-info/dependency_links.txt +0 -0
  26. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan.egg-info/entry_points.txt +0 -0
  27. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan.egg-info/not-zip-safe +0 -0
  28. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan.egg-info/requires.txt +0 -0
  29. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/scipplan.egg-info/top_level.txt +0 -0
  30. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/setup.cfg +0 -0
  31. {scipplan-0.2.0a2 → scipplan-0.2.1a0}/setup.py +0 -0
@@ -1,4 +1,4 @@
1
- Copyright (c) 2024 Ari Gestetner
1
+ Copyright (c) 2025 Buser Say
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.1
2
+ Name: scipplan
3
+ Version: 0.2.1a0
4
+ Summary: Metric Hybrid Factored Planning in Nonlinear Domains with Constraint Generation in Python.
5
+ Author: Ari Gestetner, Buser Say
6
+ Author-email: ari.gestetner@monash.edu, buser.say@monash.edu
7
+ License: MIT License
8
+ Keywords: scip,automated planner
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Natural Language :: English
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+
20
+ # SCIPPlan
21
+
22
+ SCIPPlan [1,2,3] is a SCIP-based [4] hybrid planner for domains with i) mixed (i.e., real and/or discrete valued) state and action spaces, ii) nonlinear state transitions (which can be specified as ODEs or directly as solution equations) that are functions of time, and iii) general reward functions. SCIPPlan iteratively i) finds violated constraints (i.e., zero-crossings) by simulating the state transitions, and ii) adds the violated (symbolic) constraints back to its underlying optimisation model, until a valid plan is found.
23
+
24
+ ## Example Domain: Navigation
25
+
26
+ <img src=./visualisation/scipplan_navigation_1.gif width="32%" height="32%"> <img src=./visualisation/scipplan_navigation_2.gif width="32%" height="32%"> <img src=./visualisation/scipplan_navigation_3.gif width="32%" height="32%">
27
+
28
+
29
+ Figure 1: Visualisation of different plans generated by SCIPPlan [1,2,3] for example navigation domains where the red square represents the agent, the blue shapes represent the obstacles, the gold star represents the goal location and the delta represents time. The agent can control its acceleration and the duration of its control input to modify its speed and location in order to navigate in a two-dimensional maze. The purpose of the domain is to find a path for the agent with minimum makespan such that the agent reaches its the goal without colliding with the obstacles.
30
+
31
+ Note that SCIPPlan does not linearise or discretise the domain to find a valid plan.
32
+
33
+ ## Dependencies
34
+
35
+ i) Solver: SCIP (the current implementation uses the python interface to the SCIP solver, i.e., PySCIPOpt [5]). This version of SCIPPlan has only been tested on PySCIOpt>=4.0.0 using earlier an version of pyscipopt may result in unintended behaviour.
36
+
37
+ ii) Symbolic Mathematics: SymPy [6].
38
+
39
+ ## Installing and Running SCIPPlan
40
+ In order to Install SCIPPlan you need to ensure you have a working version of the SCIP optimisation suite on your system which can be installed from [the SCIP website](https://www.scipopt.org). For more information about SCIP and PySCIPOpt refer to this [installation guide](https://github.com/scipopt/PySCIPOpt/blob/master/INSTALL.md).
41
+
42
+ After installing SCIP you will be able to install SCIPPlan using
43
+ ```bash
44
+ pip install scipplan
45
+ ```
46
+ Now you will be able to run some of the example domains which include
47
+ - Navigation (3 instances)
48
+
49
+ To run one of these examples all you need to do is run
50
+ ```bash
51
+ scipplan -D navigation -I 1
52
+ ```
53
+ which will run the 1st instance of the navigation domain using the ODEs as the transition function with the help of SymPy [6]. Similarly, the command
54
+ ```bash
55
+ scipplan -D navigation -I 1 --provide-sols
56
+ ```
57
+ will run the the 1st instance of the navigation domain using the solution equations as the transition function. For more information regarding the available tags and what they mean run `scipplan --help`.
58
+
59
+ Alternatively you can import scipplan classes to run it using python.
60
+ ```py
61
+ from scipplan.scipplan import SCIPPlan
62
+ from scipplan.config import Config
63
+ from scipplan.helpers import write_to_csv
64
+ ```
65
+ this will import the only two classes and function needed to run SCIPPlan. Then to set the configuration either create an instance of the Config class by setting the params or by retrieving the cli input
66
+ ```py
67
+ # Set params
68
+ config = Config(domain="navigation", instance=1)
69
+ # Retrieve cli args
70
+ config = Config.get_config()
71
+ ```
72
+ after which you are able to solve problem by either using the solve or optimize methods
73
+ ```py
74
+ # The optimize method just optimises the problem for the given horizon
75
+ plan = SCIPPlan(config)
76
+ plan.optimize()
77
+ # Class method which takes input the config, solves the problem
78
+ # with auto incrementing the horizon until a solution is found then
79
+ # returns the plan as well as the time taken to solve the problem
80
+ plan, solve_time = SCIPPlan.solve(config)
81
+ ```
82
+ In order to save the generated constraints for the horizon solved as well as the results, use the following code
83
+ ```py
84
+ write_to_csv("new_constraints", plan.new_constraints, config)
85
+ write_to_csv("results", plan.results_table, config)
86
+ ```
87
+
88
+ ## Citation
89
+
90
+ If you are using SCIPPlan, please cite the papers [1,2,3] and the underlying SCIP solver [4].
91
+
92
+ ## References
93
+ [1] Buser Say and Scott Sanner. [Metric Nonlinear Hybrid Planning with Constraint Generation](http://icaps18.icaps-conference.org/fileadmin/alg/conferences/icaps18/workshops/workshop06/docs/proceedings.pdf#page=23). In PlanSOpt, pages 19-25, 2018.
94
+
95
+ [2] Buser Say and Scott Sanner. [Metric Hybrid Factored Planning in Nonlinear Domains with Constraint Generation](https://link.springer.com/chapter/10.1007/978-3-030-19212-9_33). In CPAIOR, pages 502-518, 2019.
96
+
97
+ [3] Buser Say. [Robust Metric Hybrid Planning in Stochastic Nonlinear Domains Using Mathematical Optimization](https://ojs.aaai.org/index.php/ICAPS/article/view/27216). In ICAPS, pages 375-383, 2023.
98
+
99
+ [4] [SCIP](https://www.scipopt.org/)
100
+
101
+ [5] [PySCIPOpt](https://github.com/SCIP-Interfaces/PySCIPOpt)
102
+
103
+ [6] [SymPy](https://www.sympy.org/en/index.html)
@@ -0,0 +1,84 @@
1
+ # SCIPPlan
2
+
3
+ SCIPPlan [1,2,3] is a SCIP-based [4] hybrid planner for domains with i) mixed (i.e., real and/or discrete valued) state and action spaces, ii) nonlinear state transitions (which can be specified as ODEs or directly as solution equations) that are functions of time, and iii) general reward functions. SCIPPlan iteratively i) finds violated constraints (i.e., zero-crossings) by simulating the state transitions, and ii) adds the violated (symbolic) constraints back to its underlying optimisation model, until a valid plan is found.
4
+
5
+ ## Example Domain: Navigation
6
+
7
+ <img src=./visualisation/scipplan_navigation_1.gif width="32%" height="32%"> <img src=./visualisation/scipplan_navigation_2.gif width="32%" height="32%"> <img src=./visualisation/scipplan_navigation_3.gif width="32%" height="32%">
8
+
9
+
10
+ Figure 1: Visualisation of different plans generated by SCIPPlan [1,2,3] for example navigation domains where the red square represents the agent, the blue shapes represent the obstacles, the gold star represents the goal location and the delta represents time. The agent can control its acceleration and the duration of its control input to modify its speed and location in order to navigate in a two-dimensional maze. The purpose of the domain is to find a path for the agent with minimum makespan such that the agent reaches its the goal without colliding with the obstacles.
11
+
12
+ Note that SCIPPlan does not linearise or discretise the domain to find a valid plan.
13
+
14
+ ## Dependencies
15
+
16
+ i) Solver: SCIP (the current implementation uses the python interface to the SCIP solver, i.e., PySCIPOpt [5]). This version of SCIPPlan has only been tested on PySCIOpt>=4.0.0 using earlier an version of pyscipopt may result in unintended behaviour.
17
+
18
+ ii) Symbolic Mathematics: SymPy [6].
19
+
20
+ ## Installing and Running SCIPPlan
21
+ In order to Install SCIPPlan you need to ensure you have a working version of the SCIP optimisation suite on your system which can be installed from [the SCIP website](https://www.scipopt.org). For more information about SCIP and PySCIPOpt refer to this [installation guide](https://github.com/scipopt/PySCIPOpt/blob/master/INSTALL.md).
22
+
23
+ After installing SCIP you will be able to install SCIPPlan using
24
+ ```bash
25
+ pip install scipplan
26
+ ```
27
+ Now you will be able to run some of the example domains which include
28
+ - Navigation (3 instances)
29
+
30
+ To run one of these examples all you need to do is run
31
+ ```bash
32
+ scipplan -D navigation -I 1
33
+ ```
34
+ which will run the 1st instance of the navigation domain using the ODEs as the transition function with the help of SymPy [6]. Similarly, the command
35
+ ```bash
36
+ scipplan -D navigation -I 1 --provide-sols
37
+ ```
38
+ will run the the 1st instance of the navigation domain using the solution equations as the transition function. For more information regarding the available tags and what they mean run `scipplan --help`.
39
+
40
+ Alternatively you can import scipplan classes to run it using python.
41
+ ```py
42
+ from scipplan.scipplan import SCIPPlan
43
+ from scipplan.config import Config
44
+ from scipplan.helpers import write_to_csv
45
+ ```
46
+ this will import the only two classes and function needed to run SCIPPlan. Then to set the configuration either create an instance of the Config class by setting the params or by retrieving the cli input
47
+ ```py
48
+ # Set params
49
+ config = Config(domain="navigation", instance=1)
50
+ # Retrieve cli args
51
+ config = Config.get_config()
52
+ ```
53
+ after which you are able to solve problem by either using the solve or optimize methods
54
+ ```py
55
+ # The optimize method just optimises the problem for the given horizon
56
+ plan = SCIPPlan(config)
57
+ plan.optimize()
58
+ # Class method which takes input the config, solves the problem
59
+ # with auto incrementing the horizon until a solution is found then
60
+ # returns the plan as well as the time taken to solve the problem
61
+ plan, solve_time = SCIPPlan.solve(config)
62
+ ```
63
+ In order to save the generated constraints for the horizon solved as well as the results, use the following code
64
+ ```py
65
+ write_to_csv("new_constraints", plan.new_constraints, config)
66
+ write_to_csv("results", plan.results_table, config)
67
+ ```
68
+
69
+ ## Citation
70
+
71
+ If you are using SCIPPlan, please cite the papers [1,2,3] and the underlying SCIP solver [4].
72
+
73
+ ## References
74
+ [1] Buser Say and Scott Sanner. [Metric Nonlinear Hybrid Planning with Constraint Generation](http://icaps18.icaps-conference.org/fileadmin/alg/conferences/icaps18/workshops/workshop06/docs/proceedings.pdf#page=23). In PlanSOpt, pages 19-25, 2018.
75
+
76
+ [2] Buser Say and Scott Sanner. [Metric Hybrid Factored Planning in Nonlinear Domains with Constraint Generation](https://link.springer.com/chapter/10.1007/978-3-030-19212-9_33). In CPAIOR, pages 502-518, 2019.
77
+
78
+ [3] Buser Say. [Robust Metric Hybrid Planning in Stochastic Nonlinear Domains Using Mathematical Optimization](https://ojs.aaai.org/index.php/ICAPS/article/view/27216). In ICAPS, pages 375-383, 2023.
79
+
80
+ [4] [SCIP](https://www.scipopt.org/)
81
+
82
+ [5] [PySCIPOpt](https://github.com/SCIP-Interfaces/PySCIPOpt)
83
+
84
+ [6] [SymPy](https://www.sympy.org/en/index.html)
@@ -0,0 +1,5 @@
1
+ __version__ = "0.2.1alpha0"
2
+ print(f"SCIPPlan Version: {__version__}")
3
+ __release__ = "v0.2.1a0"
4
+ __author__ = "Ari Gestetner, Buser Say"
5
+ __email__ = "ari.gestetner@monash.edu, buser.say@monash.edu"
@@ -10,13 +10,68 @@ from math import exp, log, sqrt, sin, cos, isclose
10
10
 
11
11
  from pyscipopt.scip import Model, SumExpr
12
12
 
13
- def switch_comparator(comparator):
14
- if isinstance(comparator, ast.Eq): return ast.NotEq()
15
- if isinstance(comparator, ast.NotEq): return ast.Eq()
16
- if isinstance(comparator, ast.Lt): return ast.Gt()
17
- if isinstance(comparator, ast.LtE): return ast.GtE()
18
- if isinstance(comparator, ast.Gt): return ast.Lt()
19
- if isinstance(comparator, ast.GtE): return ast.LtE()
13
+
14
+ def linearise(expr: ast.Compare, aux_var: Variable) -> tuple[ast.Compare, ast.Compare]:
15
+ """linearise
16
+ This function linearises an inequality using an auxilary variable
17
+
18
+ The linearisation process is as follows.
19
+ If the expression is of the form of E1 <= E2, then we linearise by using the following expressions.
20
+ z=0 ==> E1 <= E2 and z=1 ==> E1 > E2 (equivalent to E1 >= E2 + feastol). This is then equivalent to,
21
+ E2 + feastol - M + z*M <= E1 <= E2 + zM.
22
+
23
+ Similarly, for E1 < E2 we have z=0 ==> E1 < E2 which is equivalent to E1 <= E2 - feastol + z*M
24
+ and z=1 ==> E1 >= E2.
25
+ Thus for E1 < E2 we have,
26
+ E2 + z*M - M <= E1 <= E2 + z*M - feastol.
27
+
28
+ If, however, the inequality is of the form of E1 >= E2 then we evaluate the expression, E2 <= E1.
29
+ Similarly, if the expression is E1 > E2 then we evaluate the expression E2 < E1.
30
+
31
+ :param expr: An inequality expression which is linearised.
32
+ :type expr: ast.Compare
33
+ :param aux_var: An auxiliary variable used when linearising the inequality to determine if the expression is true or false.
34
+ :type aux_var: Variable
35
+ :raises ValueError: If expr is not a valid inequality (i.e. doesn't use <, <=, > and >=)
36
+ :return: both the linearised inequalities
37
+ :rtype: tuple[ast.Compare, ast.Compare]
38
+ """
39
+ if not isinstance(expr.ops[0], (ast.Lt, ast.LtE, ast.Gt, ast.GtE)):
40
+ raise ValueError("Only <, <=, > or >= are allowed")
41
+ if isinstance(expr.ops[0], ast.GtE):
42
+ expr.left, expr.comparators[0] = expr.comparators[0], expr.left
43
+ expr.ops[0] = ast.LtE()
44
+ if isinstance(expr.ops[0], ast.Gt):
45
+ expr.left, expr.comparators[0] = expr.comparators[0], expr.left
46
+ expr.ops[0] = ast.Lt()
47
+
48
+ if isinstance(expr.ops[0], ast.LtE):
49
+ lhs = ast.BinOp(
50
+ left=expr.comparators[0],
51
+ op=ast.Add(),
52
+ right=ast.parse(f"feastol - bigM + {aux_var.name} * bigM").body[0].value
53
+ )
54
+ rhs = ast.BinOp(
55
+ left=expr.comparators[0],
56
+ op=ast.Add(),
57
+ right=ast.parse(f"{aux_var.name} * bigM").body[0].value
58
+ )
59
+ if isinstance(expr.ops[0], ast.Lt):
60
+ lhs = ast.BinOp(
61
+ left=expr.comparators[0],
62
+ op=ast.Add(),
63
+ right=ast.parse(f"{aux_var.name} * bigM - bigM").body[0].value
64
+ )
65
+ rhs = ast.BinOp(
66
+ left=expr.comparators[0],
67
+ op=ast.Add(),
68
+ right=ast.parse(f"{aux_var.name} * bigM - feastol").body[0].value
69
+ )
70
+ expr1 = ast.Compare(lhs, [ast.LtE()], [expr.left])
71
+ expr2 = ast.Compare(expr.left, [ast.LtE()], [rhs])
72
+ return expr1, expr2
73
+
74
+
20
75
 
21
76
  @dataclass
22
77
  class Expressions:
@@ -37,8 +92,8 @@ class Expressions:
37
92
 
38
93
  class ParserType(Enum):
39
94
  """ParserType
40
- "enum type CALCULATOR: Used to calculate using feastol
41
- "enum type PARSER: Used to parse an expression and create the correct minlp constraints
95
+ enum type CALCULATOR: Used to calculate using feastol
96
+ enum type PARSER: Used to parse an expression and create the correct minlp constraints
42
97
  """
43
98
  CALCULATOR = "calculator"
44
99
  PARSER = "parser"
@@ -152,22 +207,11 @@ class ParseModel:
152
207
  aux_vars.append(aux_var)
153
208
  self.variables[aux_var.name] = aux_var.model_var
154
209
 
155
- expr.left = ast.BinOp(
156
- left=expr.left,
157
- op=(ast.Add() if isinstance(expr.ops[0], (ast.Gt, ast.GtE)) else ast.Sub()),
158
- right=ast.parse(f"bigM * {aux_var.name}").body[0].value
159
- )
160
- self.expressions.add_expressions(self.evaluate(expr))
210
+ expr1, expr2 = linearise(expr, aux_var)
161
211
 
162
- expr.ops[0] = switch_comparator(expr.ops[0])
163
-
164
- expr.comparators[0] = ast.BinOp(
165
- left=expr.comparators[0],
166
- op=(ast.Add() if isinstance(expr.ops[0], (ast.Gt, ast.GtE)) else ast.Sub()),
167
- right=ast.parse(f"feastol - bigM").body[0].value
168
- )
169
-
170
- self.expressions.add_expressions(self.evaluate(expr))
212
+ self.expressions.add_expressions(self.evaluate(expr1))
213
+ self.expressions.add_expressions(self.evaluate(expr2))
214
+
171
215
  else:
172
216
  raise Exception("or expressions may only be made up of inequalities")
173
217
  lhs = SumExpr()
@@ -116,12 +116,17 @@ class PlanModel:
116
116
 
117
117
  self.var_names.add(name)
118
118
 
119
- for t in range(self.config.horizon):
120
- variables[(name, t)] = Variable.create_var(self.model, name, vtype, t, self.constants)
121
- var_type = variables[(name, t)].var_type
122
- if var_type is VarType.STATE:
123
- variables[(name, self.config.horizon)] = Variable.create_var(self.model, name, vtype, self.config.horizon, self.constants)
124
-
119
+ if vtype.startswith("global"):
120
+ var = Variable.create_var(self.model, name, vtype, "global", self.constants)
121
+ for t in range(self.config.horizon + 1):
122
+ variables[(name, t)] = var
123
+ else:
124
+ for t in range(self.config.horizon):
125
+ variables[(name, t)] = Variable.create_var(self.model, name, vtype, t, self.constants)
126
+ var_type = variables[(name, t)].var_type
127
+ if var_type is VarType.STATE:
128
+ variables[(name, self.config.horizon)] = Variable.create_var(self.model, name, vtype, self.config.horizon, self.constants)
129
+
125
130
  return variables
126
131
 
127
132
 
@@ -160,8 +165,6 @@ class PlanModel:
160
165
  for cons_idx, (translation, constraints) in enumerate(translations.items()):
161
166
  for idx, constraint in enumerate(constraints):
162
167
  if (self.config.provide_sols is False) and (translation == "temporal_constraints"):
163
- # for func_name, func in self.ode_functions.items():
164
- # constraint = constraint.replace(func_name, func)
165
168
  pattern = r"|".join(f"({func_name})" for func_name, func in self.ode_functions.items())
166
169
  constraint = re.sub(pattern, lambda x: self.ode_functions[x.group(0)], constraint)
167
170
  constraints[idx] = constraint
@@ -297,7 +300,7 @@ class PlanModel:
297
300
 
298
301
  dt = Symbol(dt_var)
299
302
  # Used to represent constant variables
300
- temp_var = Symbol("TEMP_VAR")
303
+ temp_var = Symbol("ODES_TEMP_VAR")
301
304
 
302
305
  variables = {}
303
306
  states = []
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.1
2
+ Name: scipplan
3
+ Version: 0.2.1a0
4
+ Summary: Metric Hybrid Factored Planning in Nonlinear Domains with Constraint Generation in Python.
5
+ Author: Ari Gestetner, Buser Say
6
+ Author-email: ari.gestetner@monash.edu, buser.say@monash.edu
7
+ License: MIT License
8
+ Keywords: scip,automated planner
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Natural Language :: English
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+
20
+ # SCIPPlan
21
+
22
+ SCIPPlan [1,2,3] is a SCIP-based [4] hybrid planner for domains with i) mixed (i.e., real and/or discrete valued) state and action spaces, ii) nonlinear state transitions (which can be specified as ODEs or directly as solution equations) that are functions of time, and iii) general reward functions. SCIPPlan iteratively i) finds violated constraints (i.e., zero-crossings) by simulating the state transitions, and ii) adds the violated (symbolic) constraints back to its underlying optimisation model, until a valid plan is found.
23
+
24
+ ## Example Domain: Navigation
25
+
26
+ <img src=./visualisation/scipplan_navigation_1.gif width="32%" height="32%"> <img src=./visualisation/scipplan_navigation_2.gif width="32%" height="32%"> <img src=./visualisation/scipplan_navigation_3.gif width="32%" height="32%">
27
+
28
+
29
+ Figure 1: Visualisation of different plans generated by SCIPPlan [1,2,3] for example navigation domains where the red square represents the agent, the blue shapes represent the obstacles, the gold star represents the goal location and the delta represents time. The agent can control its acceleration and the duration of its control input to modify its speed and location in order to navigate in a two-dimensional maze. The purpose of the domain is to find a path for the agent with minimum makespan such that the agent reaches its the goal without colliding with the obstacles.
30
+
31
+ Note that SCIPPlan does not linearise or discretise the domain to find a valid plan.
32
+
33
+ ## Dependencies
34
+
35
+ i) Solver: SCIP (the current implementation uses the python interface to the SCIP solver, i.e., PySCIPOpt [5]). This version of SCIPPlan has only been tested on PySCIOpt>=4.0.0 using earlier an version of pyscipopt may result in unintended behaviour.
36
+
37
+ ii) Symbolic Mathematics: SymPy [6].
38
+
39
+ ## Installing and Running SCIPPlan
40
+ In order to Install SCIPPlan you need to ensure you have a working version of the SCIP optimisation suite on your system which can be installed from [the SCIP website](https://www.scipopt.org). For more information about SCIP and PySCIPOpt refer to this [installation guide](https://github.com/scipopt/PySCIPOpt/blob/master/INSTALL.md).
41
+
42
+ After installing SCIP you will be able to install SCIPPlan using
43
+ ```bash
44
+ pip install scipplan
45
+ ```
46
+ Now you will be able to run some of the example domains which include
47
+ - Navigation (3 instances)
48
+
49
+ To run one of these examples all you need to do is run
50
+ ```bash
51
+ scipplan -D navigation -I 1
52
+ ```
53
+ which will run the 1st instance of the navigation domain using the ODEs as the transition function with the help of SymPy [6]. Similarly, the command
54
+ ```bash
55
+ scipplan -D navigation -I 1 --provide-sols
56
+ ```
57
+ will run the the 1st instance of the navigation domain using the solution equations as the transition function. For more information regarding the available tags and what they mean run `scipplan --help`.
58
+
59
+ Alternatively you can import scipplan classes to run it using python.
60
+ ```py
61
+ from scipplan.scipplan import SCIPPlan
62
+ from scipplan.config import Config
63
+ from scipplan.helpers import write_to_csv
64
+ ```
65
+ this will import the only two classes and function needed to run SCIPPlan. Then to set the configuration either create an instance of the Config class by setting the params or by retrieving the cli input
66
+ ```py
67
+ # Set params
68
+ config = Config(domain="navigation", instance=1)
69
+ # Retrieve cli args
70
+ config = Config.get_config()
71
+ ```
72
+ after which you are able to solve problem by either using the solve or optimize methods
73
+ ```py
74
+ # The optimize method just optimises the problem for the given horizon
75
+ plan = SCIPPlan(config)
76
+ plan.optimize()
77
+ # Class method which takes input the config, solves the problem
78
+ # with auto incrementing the horizon until a solution is found then
79
+ # returns the plan as well as the time taken to solve the problem
80
+ plan, solve_time = SCIPPlan.solve(config)
81
+ ```
82
+ In order to save the generated constraints for the horizon solved as well as the results, use the following code
83
+ ```py
84
+ write_to_csv("new_constraints", plan.new_constraints, config)
85
+ write_to_csv("results", plan.results_table, config)
86
+ ```
87
+
88
+ ## Citation
89
+
90
+ If you are using SCIPPlan, please cite the papers [1,2,3] and the underlying SCIP solver [4].
91
+
92
+ ## References
93
+ [1] Buser Say and Scott Sanner. [Metric Nonlinear Hybrid Planning with Constraint Generation](http://icaps18.icaps-conference.org/fileadmin/alg/conferences/icaps18/workshops/workshop06/docs/proceedings.pdf#page=23). In PlanSOpt, pages 19-25, 2018.
94
+
95
+ [2] Buser Say and Scott Sanner. [Metric Hybrid Factored Planning in Nonlinear Domains with Constraint Generation](https://link.springer.com/chapter/10.1007/978-3-030-19212-9_33). In CPAIOR, pages 502-518, 2019.
96
+
97
+ [3] Buser Say. [Robust Metric Hybrid Planning in Stochastic Nonlinear Domains Using Mathematical Optimization](https://ojs.aaai.org/index.php/ICAPS/article/view/27216). In ICAPS, pages 375-383, 2023.
98
+
99
+ [4] [SCIP](https://www.scipopt.org/)
100
+
101
+ [5] [PySCIPOpt](https://github.com/SCIP-Interfaces/PySCIPOpt)
102
+
103
+ [6] [SymPy](https://www.sympy.org/en/index.html)
scipplan-0.2.0a2/PKG-INFO DELETED
@@ -1,215 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: scipplan
3
- Version: 0.2.0a2
4
- Summary: Metric Hybrid Factored Planning in Nonlinear Domains with Constraint Generation in Python.
5
- Author: Ari Gestetner, Buser Say
6
- Author-email: ari.gestetner@monash.edu, buser.say@monash.edu
7
- License: MIT License
8
- Keywords: scip,automated planner
9
- Classifier: Development Status :: 3 - Alpha
10
- Classifier: Environment :: Console
11
- Classifier: Intended Audience :: Science/Research
12
- Classifier: License :: OSI Approved :: MIT License
13
- Classifier: Natural Language :: English
14
- Classifier: Operating System :: OS Independent
15
- Classifier: Programming Language :: Python :: 3
16
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
- Description-Content-Type: text/markdown
18
- License-File: LICENSE
19
-
20
- # SCIPPlan
21
-
22
- SCIPPlan [1,2,3] is a SCIP-based [4] hybrid planner for domains with i) mixed (i.e., real and/or discrete valued) state and action spaces, ii) nonlinear state transitions that are functions of time, and iii) general reward functions. SCIPPlan iteratively i) finds violated constraints (i.e., zero-crossings) by simulating the state transitions, and ii) adds the violated (symbolic) constraints back to its underlying optimisation model, until a valid plan is found.
23
-
24
- ## Example Domain: Navigation
25
-
26
- <img src=./visualisation/scipplan_navigation_1.gif width="32%" height="32%"> <img src=./visualisation/scipplan_navigation_2.gif width="32%" height="32%"> <img src=./visualisation/scipplan_navigation_3.gif width="32%" height="32%">
27
-
28
-
29
- Figure 1: Visualisation of different plans generated by SCIPPlan [1,2,3] for example navigation domains where the red square represents the agent, the blue shapes represent the obstacles, the gold star represents the goal location and the delta represents time. The agent can control its acceleration and the duration of its control input to modify its speed and location in order to navigate in a two-dimensional maze. The purpose of the domain is to find a path for the agent with minimum makespan such that the agent reaches its the goal without colliding with the obstacles.
30
-
31
- Note that SCIPPlan does not linearise or discretise the domain to find a valid plan.
32
-
33
- ## Dependencies
34
-
35
- i) Solver: SCIP (the current implementation uses the python interface to the SCIP solver, i.e., PySCIPOpt [5]). This version of SCIPPlan has only been tested on PySCIOpt>=4.0.0 using earlier an version of pyscipopt may result in unintended behaviour.
36
-
37
- ## Installing and Running SCIPPlan
38
- In order to Install SCIPPlan you need to ensure you have a working version of the SCIP optimisation suite on your system which can be installed from [the SCIP website](https://www.scipopt.org). For more information about SCIP and PySCIPOpt refer to this [installation guide](https://github.com/scipopt/PySCIPOpt/blob/master/INSTALL.md).
39
-
40
- After installing SCIP you will be able to install SCIPPlan using
41
- ```bash
42
- pip install scipplan
43
- ```
44
- Now you will be able to run some of the example domains which include
45
- - Navigation (3 instances)
46
-
47
- To run one of these examples all you need to do is run
48
- ```bash
49
- scipplan -D navigation -I 1
50
- ```
51
- which will run the 1st instance of the navigation domain. For more information regarding the available tags and what they mean run `scipplan --help`.
52
-
53
- Alternatively you can import scipplan classes to run it using python.
54
- ```py
55
- from scipplan.scipplan import SCIPPlan
56
- from scipplan.config import Config
57
- from scipplan.helpers import write_to_csv
58
- ```
59
- this will import the only 2 classes and function needed to run SCIPPlan. Then to set the configuration either create an instance of the Config class by setting the params or by retrieving the cli input
60
- ```py
61
- # Set params
62
- config = Config(domain="navigation", instance=1)
63
- # Retrieve cli args
64
- config = Config.get_config()
65
- ```
66
- after which you are able to solve problem by either using the solve or optimize methods
67
- ```py
68
- # The optimize method just optimises the problem for the given horizon
69
- plan = SCIPPlan(config)
70
- plan.optimize()
71
- # Class method which takes input the config, solves the problem
72
- # with auto incrementing the horizon until a solution is found then
73
- # returns the plan as well as the time taken to solve the problem
74
- plan, solve_time = SCIPPlan.solve(config)
75
- ```
76
- In order to save the generated constraints for the horizon solved as well as the results, use the following code
77
- ```py
78
- write_to_csv("new_constraints", plan.new_constraints, config)
79
- write_to_csv("results", plan.results_table, config)
80
- ```
81
-
82
-
83
-
84
- ## Custom Domains
85
- If you would like to create your own domain you will need to create a directory named "translation" in the directory which scipplan is run from with txt files of the format "{translation type}\_{domain name}\_{instance number}.txt" (e.g. "pvariables_navigation_1.txt"). Note that the files in the translation directory will override any example files if they share domain name and instance number (e.g. navigation 1 would override the example).
86
-
87
- For each domain instance the following translation files are required
88
- - constants
89
- - pvariables
90
- - initials
91
- - goals
92
- - instantaneous_constraints
93
- - temporal_constraints
94
- - transitions
95
- - reward
96
-
97
- As a part of SCIPPlan, all the constraint files allow for the use of "and" and "or" expressions, polynomials and `exp`, `log`, `sqrt`, `sin` and `cos` functions (Note: `sin` and `cos` are only available in PySCIPOpt>=4.3.0 so if your version is below that you will not be able to use the trig functions unless you update).
98
-
99
- ### Constants
100
- The constants file allows for constant values to be defined as a variable to be used in other files in the model. To use add constants as follows
101
- ```txt
102
- HalfVal = 0.5
103
- Epsilon = config_epsilon
104
- bigM = config_bigM
105
- ```
106
-
107
- Some config values can be accessed in the constants file to be used in other files and are available as
108
- - `config_epsilon`
109
- - `config_gap`
110
- - `config_bigM`
111
- Note that these variables are only accessible in the constants file and you will need to define a new constants variable to store the value
112
-
113
- ### Pvariables
114
- When creating the pvariables file, the variables should be listed in the following format
115
- ```txt
116
- action_continuous: Accelerate_x
117
- action_continuous: Accelerate_y
118
- action_continuous: Dt
119
- action_boolean: Mode
120
- state_continuous: Location_x
121
- state_continuous: Location_y
122
- state_continuous: Speed_x
123
- state_continuous: Speed_y
124
- ```
125
- where the variable and value type of the variable is set in the format "{variable type}_{value type}" and the variable itself has to be in a Python compatible format (e.g. variables can't use - sign like `some-var` but can use _ like `some_var` as well as the dash sign ' cannot be used). The use of next state variables which is often written using the dash symbol will be explained further in the Transitions section.
126
- Additionally a variable for Dt has to be defined and has to be the same as the dt_var in the config object so if you would like to use a different variable name for Dt (e.g. dt) please also ensure you add it to the config via the `--dt-var` tag or the `dt_var` parameter.
127
- The available variable types are
128
- - state
129
- - action
130
- - auxiliary
131
-
132
- The available value types are
133
- - continuos
134
- - integer
135
- - boolean
136
-
137
- Please note that constants don't need to have their variable names defined in pvariables as they are defined in constants.
138
-
139
- ### Initials
140
- The initials file defines the initial state values for time t=0, for example
141
- ```txt
142
- Location_x == 0.0
143
- Location_y == 0.0
144
- Speed_x == 0.0
145
- Speed_y == 0.0
146
- ```
147
- notice te use of teh constant value defined earlier in the constants file.
148
- ### Goals
149
- The goals file should encode the final state values such that t=H+1, for example
150
- ```txt
151
- Location_x == 8.0
152
- Location_y == 8.0
153
- ```
154
- ### Instantaneous Constraints
155
- This is where the instantaneous constraints go.
156
- An example is as follows
157
- ```txt
158
- Location_x <= 10.0
159
- Location_y <= 10.0
160
- Location_x >= 0.0
161
- Location_y >= 0.0
162
- Accelerate_x <= 0.5
163
- Accelerate_y <= 0.5
164
- Accelerate_x >= -0.5
165
- Accelerate_y >= -0.5
166
- (Location_x <= 4.0) or (Location_x >= 6.0) or (Location_y <= 4.0) or (Location_y >= 6.0)
167
- ```
168
- ### Temporal Constraints
169
- The temporal constraints are the constraints which SCIPPlan will ensure that the solution never violates by iterating through every epsilon value of Dt and checking for zero crossings. An example of a temporal constraint is as follows
170
- ```txt
171
- Location_x + Speed_x*(Dt + Epsilon*Mode) + 0.5*Accelerate_x*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) <= 10.0
172
- Location_y + Speed_y*(Dt + Epsilon*Mode) + 0.5*Accelerate_y*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) <= 10.0
173
- Location_x + Speed_x*(Dt + Epsilon*Mode) + 0.5*Accelerate_x*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) >= 0.0
174
- Location_y + Speed_y*(Dt + Epsilon*Mode) + 0.5*Accelerate_y*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) >= 0.0
175
-
176
- ((Location_x + Speed_x*(Dt + Epsilon*Mode) + 0.5*Accelerate_x*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) <= 4.0) or
177
- (Location_x + Speed_x*(Dt + Epsilon*Mode) + 0.5*Accelerate_x*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) >= 6.0) or
178
- (Location_y + Speed_y*(Dt + Epsilon*Mode) + 0.5*Accelerate_y*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) <= 4.0) or
179
- (Location_y + Speed_y*(Dt + Epsilon*Mode) + 0.5*Accelerate_y*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) >= 6.0))
180
- ```
181
-
182
- The use of mode switches are used in these constraints (`Dt + Epsilon*Mode`). Please note that the or expression is enclosed in round brackets which allows the constraints to be parsed as a singular expression
183
- ### Transitions
184
- Transitions are to be added here with the following syntax.
185
- For example $S_{t+1} = \frac 12 A_t\cdot t^2 + V_t\cdot t + S_t$.
186
- Alternatively this can be written as $S' = \frac 12 A\cdot t^2 + V\cdot t + S$.
187
- Since Python doesn't allow variables to use the ' symbol it should be replaced with `_dash`, for example
188
- ```txt
189
- Location_x_dash - 1.0*Location_x - 1.0*Speed_x*(Dt + Epsilon*Mode) - 0.5*Accelerate_x*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) == 0.0
190
- Location_y_dash - 1.0*Location_y - 1.0*Speed_y*(Dt + Epsilon*Mode) - 0.5*Accelerate_y*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) == 0.0
191
- Speed_x_dash - 1.0*Speed_x - 1.0*Accelerate_x*(Dt + Epsilon*Mode) == 0.0
192
- Speed_y_dash - 1.0*Speed_y - 1.0*Accelerate_y*(Dt + Epsilon*Mode) == 0.0
193
- ```
194
-
195
- ### Reward
196
- As for the reward function, SCIPPlan maximises the reward thus if using a cost function it should be negated as per the example
197
- ```txt
198
- -1.0*(Dt + Mode * Epsilon)
199
- ```
200
- Only one reward function is able to be optimised for in SCIPPlan
201
-
202
- ## Citation
203
-
204
- If you are using SCIPPlan, please cite the papers [1,2,3] and the underlying SCIP solver [4].
205
-
206
- ## References
207
- [1] Buser Say and Scott Sanner. [Metric Nonlinear Hybrid Planning with Constraint Generation](http://icaps18.icaps-conference.org/fileadmin/alg/conferences/icaps18/workshops/workshop06/docs/proceedings.pdf#page=23). In PlanSOpt, pages 19-25, 2018.
208
-
209
- [2] Buser Say and Scott Sanner. [Metric Hybrid Factored Planning in Nonlinear Domains with Constraint Generation](https://link.springer.com/chapter/10.1007/978-3-030-19212-9_33). In CPAIOR, pages 502-518, 2019.
210
-
211
- [3] Buser Say. [Robust Metric Hybrid Planning in Stochastic Nonlinear Domains Using Mathematical Optimization](https://ojs.aaai.org/index.php/ICAPS/article/view/27216). In ICAPS, pages 375-383, 2023.
212
-
213
- [4] [SCIP](https://www.scipopt.org/)
214
-
215
- [5] [PySCIPOpt](https://github.com/SCIP-Interfaces/PySCIPOpt)
@@ -1,196 +0,0 @@
1
- # SCIPPlan
2
-
3
- SCIPPlan [1,2,3] is a SCIP-based [4] hybrid planner for domains with i) mixed (i.e., real and/or discrete valued) state and action spaces, ii) nonlinear state transitions that are functions of time, and iii) general reward functions. SCIPPlan iteratively i) finds violated constraints (i.e., zero-crossings) by simulating the state transitions, and ii) adds the violated (symbolic) constraints back to its underlying optimisation model, until a valid plan is found.
4
-
5
- ## Example Domain: Navigation
6
-
7
- <img src=./visualisation/scipplan_navigation_1.gif width="32%" height="32%"> <img src=./visualisation/scipplan_navigation_2.gif width="32%" height="32%"> <img src=./visualisation/scipplan_navigation_3.gif width="32%" height="32%">
8
-
9
-
10
- Figure 1: Visualisation of different plans generated by SCIPPlan [1,2,3] for example navigation domains where the red square represents the agent, the blue shapes represent the obstacles, the gold star represents the goal location and the delta represents time. The agent can control its acceleration and the duration of its control input to modify its speed and location in order to navigate in a two-dimensional maze. The purpose of the domain is to find a path for the agent with minimum makespan such that the agent reaches its the goal without colliding with the obstacles.
11
-
12
- Note that SCIPPlan does not linearise or discretise the domain to find a valid plan.
13
-
14
- ## Dependencies
15
-
16
- i) Solver: SCIP (the current implementation uses the python interface to the SCIP solver, i.e., PySCIPOpt [5]). This version of SCIPPlan has only been tested on PySCIOpt>=4.0.0 using earlier an version of pyscipopt may result in unintended behaviour.
17
-
18
- ## Installing and Running SCIPPlan
19
- In order to Install SCIPPlan you need to ensure you have a working version of the SCIP optimisation suite on your system which can be installed from [the SCIP website](https://www.scipopt.org). For more information about SCIP and PySCIPOpt refer to this [installation guide](https://github.com/scipopt/PySCIPOpt/blob/master/INSTALL.md).
20
-
21
- After installing SCIP you will be able to install SCIPPlan using
22
- ```bash
23
- pip install scipplan
24
- ```
25
- Now you will be able to run some of the example domains which include
26
- - Navigation (3 instances)
27
-
28
- To run one of these examples all you need to do is run
29
- ```bash
30
- scipplan -D navigation -I 1
31
- ```
32
- which will run the 1st instance of the navigation domain. For more information regarding the available tags and what they mean run `scipplan --help`.
33
-
34
- Alternatively you can import scipplan classes to run it using python.
35
- ```py
36
- from scipplan.scipplan import SCIPPlan
37
- from scipplan.config import Config
38
- from scipplan.helpers import write_to_csv
39
- ```
40
- this will import the only 2 classes and function needed to run SCIPPlan. Then to set the configuration either create an instance of the Config class by setting the params or by retrieving the cli input
41
- ```py
42
- # Set params
43
- config = Config(domain="navigation", instance=1)
44
- # Retrieve cli args
45
- config = Config.get_config()
46
- ```
47
- after which you are able to solve problem by either using the solve or optimize methods
48
- ```py
49
- # The optimize method just optimises the problem for the given horizon
50
- plan = SCIPPlan(config)
51
- plan.optimize()
52
- # Class method which takes input the config, solves the problem
53
- # with auto incrementing the horizon until a solution is found then
54
- # returns the plan as well as the time taken to solve the problem
55
- plan, solve_time = SCIPPlan.solve(config)
56
- ```
57
- In order to save the generated constraints for the horizon solved as well as the results, use the following code
58
- ```py
59
- write_to_csv("new_constraints", plan.new_constraints, config)
60
- write_to_csv("results", plan.results_table, config)
61
- ```
62
-
63
-
64
-
65
- ## Custom Domains
66
- If you would like to create your own domain you will need to create a directory named "translation" in the directory which scipplan is run from with txt files of the format "{translation type}\_{domain name}\_{instance number}.txt" (e.g. "pvariables_navigation_1.txt"). Note that the files in the translation directory will override any example files if they share domain name and instance number (e.g. navigation 1 would override the example).
67
-
68
- For each domain instance the following translation files are required
69
- - constants
70
- - pvariables
71
- - initials
72
- - goals
73
- - instantaneous_constraints
74
- - temporal_constraints
75
- - transitions
76
- - reward
77
-
78
- As a part of SCIPPlan, all the constraint files allow for the use of "and" and "or" expressions, polynomials and `exp`, `log`, `sqrt`, `sin` and `cos` functions (Note: `sin` and `cos` are only available in PySCIPOpt>=4.3.0 so if your version is below that you will not be able to use the trig functions unless you update).
79
-
80
- ### Constants
81
- The constants file allows for constant values to be defined as a variable to be used in other files in the model. To use add constants as follows
82
- ```txt
83
- HalfVal = 0.5
84
- Epsilon = config_epsilon
85
- bigM = config_bigM
86
- ```
87
-
88
- Some config values can be accessed in the constants file to be used in other files and are available as
89
- - `config_epsilon`
90
- - `config_gap`
91
- - `config_bigM`
92
- Note that these variables are only accessible in the constants file and you will need to define a new constants variable to store the value
93
-
94
- ### Pvariables
95
- When creating the pvariables file, the variables should be listed in the following format
96
- ```txt
97
- action_continuous: Accelerate_x
98
- action_continuous: Accelerate_y
99
- action_continuous: Dt
100
- action_boolean: Mode
101
- state_continuous: Location_x
102
- state_continuous: Location_y
103
- state_continuous: Speed_x
104
- state_continuous: Speed_y
105
- ```
106
- where the variable and value type of the variable is set in the format "{variable type}_{value type}" and the variable itself has to be in a Python compatible format (e.g. variables can't use - sign like `some-var` but can use _ like `some_var` as well as the dash sign ' cannot be used). The use of next state variables which is often written using the dash symbol will be explained further in the Transitions section.
107
- Additionally a variable for Dt has to be defined and has to be the same as the dt_var in the config object so if you would like to use a different variable name for Dt (e.g. dt) please also ensure you add it to the config via the `--dt-var` tag or the `dt_var` parameter.
108
- The available variable types are
109
- - state
110
- - action
111
- - auxiliary
112
-
113
- The available value types are
114
- - continuos
115
- - integer
116
- - boolean
117
-
118
- Please note that constants don't need to have their variable names defined in pvariables as they are defined in constants.
119
-
120
- ### Initials
121
- The initials file defines the initial state values for time t=0, for example
122
- ```txt
123
- Location_x == 0.0
124
- Location_y == 0.0
125
- Speed_x == 0.0
126
- Speed_y == 0.0
127
- ```
128
- notice te use of teh constant value defined earlier in the constants file.
129
- ### Goals
130
- The goals file should encode the final state values such that t=H+1, for example
131
- ```txt
132
- Location_x == 8.0
133
- Location_y == 8.0
134
- ```
135
- ### Instantaneous Constraints
136
- This is where the instantaneous constraints go.
137
- An example is as follows
138
- ```txt
139
- Location_x <= 10.0
140
- Location_y <= 10.0
141
- Location_x >= 0.0
142
- Location_y >= 0.0
143
- Accelerate_x <= 0.5
144
- Accelerate_y <= 0.5
145
- Accelerate_x >= -0.5
146
- Accelerate_y >= -0.5
147
- (Location_x <= 4.0) or (Location_x >= 6.0) or (Location_y <= 4.0) or (Location_y >= 6.0)
148
- ```
149
- ### Temporal Constraints
150
- The temporal constraints are the constraints which SCIPPlan will ensure that the solution never violates by iterating through every epsilon value of Dt and checking for zero crossings. An example of a temporal constraint is as follows
151
- ```txt
152
- Location_x + Speed_x*(Dt + Epsilon*Mode) + 0.5*Accelerate_x*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) <= 10.0
153
- Location_y + Speed_y*(Dt + Epsilon*Mode) + 0.5*Accelerate_y*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) <= 10.0
154
- Location_x + Speed_x*(Dt + Epsilon*Mode) + 0.5*Accelerate_x*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) >= 0.0
155
- Location_y + Speed_y*(Dt + Epsilon*Mode) + 0.5*Accelerate_y*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) >= 0.0
156
-
157
- ((Location_x + Speed_x*(Dt + Epsilon*Mode) + 0.5*Accelerate_x*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) <= 4.0) or
158
- (Location_x + Speed_x*(Dt + Epsilon*Mode) + 0.5*Accelerate_x*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) >= 6.0) or
159
- (Location_y + Speed_y*(Dt + Epsilon*Mode) + 0.5*Accelerate_y*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) <= 4.0) or
160
- (Location_y + Speed_y*(Dt + Epsilon*Mode) + 0.5*Accelerate_y*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) >= 6.0))
161
- ```
162
-
163
- The use of mode switches are used in these constraints (`Dt + Epsilon*Mode`). Please note that the or expression is enclosed in round brackets which allows the constraints to be parsed as a singular expression
164
- ### Transitions
165
- Transitions are to be added here with the following syntax.
166
- For example $S_{t+1} = \frac 12 A_t\cdot t^2 + V_t\cdot t + S_t$.
167
- Alternatively this can be written as $S' = \frac 12 A\cdot t^2 + V\cdot t + S$.
168
- Since Python doesn't allow variables to use the ' symbol it should be replaced with `_dash`, for example
169
- ```txt
170
- Location_x_dash - 1.0*Location_x - 1.0*Speed_x*(Dt + Epsilon*Mode) - 0.5*Accelerate_x*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) == 0.0
171
- Location_y_dash - 1.0*Location_y - 1.0*Speed_y*(Dt + Epsilon*Mode) - 0.5*Accelerate_y*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) == 0.0
172
- Speed_x_dash - 1.0*Speed_x - 1.0*Accelerate_x*(Dt + Epsilon*Mode) == 0.0
173
- Speed_y_dash - 1.0*Speed_y - 1.0*Accelerate_y*(Dt + Epsilon*Mode) == 0.0
174
- ```
175
-
176
- ### Reward
177
- As for the reward function, SCIPPlan maximises the reward thus if using a cost function it should be negated as per the example
178
- ```txt
179
- -1.0*(Dt + Mode * Epsilon)
180
- ```
181
- Only one reward function is able to be optimised for in SCIPPlan
182
-
183
- ## Citation
184
-
185
- If you are using SCIPPlan, please cite the papers [1,2,3] and the underlying SCIP solver [4].
186
-
187
- ## References
188
- [1] Buser Say and Scott Sanner. [Metric Nonlinear Hybrid Planning with Constraint Generation](http://icaps18.icaps-conference.org/fileadmin/alg/conferences/icaps18/workshops/workshop06/docs/proceedings.pdf#page=23). In PlanSOpt, pages 19-25, 2018.
189
-
190
- [2] Buser Say and Scott Sanner. [Metric Hybrid Factored Planning in Nonlinear Domains with Constraint Generation](https://link.springer.com/chapter/10.1007/978-3-030-19212-9_33). In CPAIOR, pages 502-518, 2019.
191
-
192
- [3] Buser Say. [Robust Metric Hybrid Planning in Stochastic Nonlinear Domains Using Mathematical Optimization](https://ojs.aaai.org/index.php/ICAPS/article/view/27216). In ICAPS, pages 375-383, 2023.
193
-
194
- [4] [SCIP](https://www.scipopt.org/)
195
-
196
- [5] [PySCIPOpt](https://github.com/SCIP-Interfaces/PySCIPOpt)
@@ -1,5 +0,0 @@
1
- __version__ = "0.2.0alpha2"
2
- print(f"SCIPPlan Version: {__version__}")
3
- __release__ = "v0.2.0a2"
4
- __author__ = "Ari Gestetner, Buser Say"
5
- __email__ = "ari.gestetner@monash.edu, buser.say@monash.edu"
@@ -1,215 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: scipplan
3
- Version: 0.2.0a2
4
- Summary: Metric Hybrid Factored Planning in Nonlinear Domains with Constraint Generation in Python.
5
- Author: Ari Gestetner, Buser Say
6
- Author-email: ari.gestetner@monash.edu, buser.say@monash.edu
7
- License: MIT License
8
- Keywords: scip,automated planner
9
- Classifier: Development Status :: 3 - Alpha
10
- Classifier: Environment :: Console
11
- Classifier: Intended Audience :: Science/Research
12
- Classifier: License :: OSI Approved :: MIT License
13
- Classifier: Natural Language :: English
14
- Classifier: Operating System :: OS Independent
15
- Classifier: Programming Language :: Python :: 3
16
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
- Description-Content-Type: text/markdown
18
- License-File: LICENSE
19
-
20
- # SCIPPlan
21
-
22
- SCIPPlan [1,2,3] is a SCIP-based [4] hybrid planner for domains with i) mixed (i.e., real and/or discrete valued) state and action spaces, ii) nonlinear state transitions that are functions of time, and iii) general reward functions. SCIPPlan iteratively i) finds violated constraints (i.e., zero-crossings) by simulating the state transitions, and ii) adds the violated (symbolic) constraints back to its underlying optimisation model, until a valid plan is found.
23
-
24
- ## Example Domain: Navigation
25
-
26
- <img src=./visualisation/scipplan_navigation_1.gif width="32%" height="32%"> <img src=./visualisation/scipplan_navigation_2.gif width="32%" height="32%"> <img src=./visualisation/scipplan_navigation_3.gif width="32%" height="32%">
27
-
28
-
29
- Figure 1: Visualisation of different plans generated by SCIPPlan [1,2,3] for example navigation domains where the red square represents the agent, the blue shapes represent the obstacles, the gold star represents the goal location and the delta represents time. The agent can control its acceleration and the duration of its control input to modify its speed and location in order to navigate in a two-dimensional maze. The purpose of the domain is to find a path for the agent with minimum makespan such that the agent reaches its the goal without colliding with the obstacles.
30
-
31
- Note that SCIPPlan does not linearise or discretise the domain to find a valid plan.
32
-
33
- ## Dependencies
34
-
35
- i) Solver: SCIP (the current implementation uses the python interface to the SCIP solver, i.e., PySCIPOpt [5]). This version of SCIPPlan has only been tested on PySCIOpt>=4.0.0 using earlier an version of pyscipopt may result in unintended behaviour.
36
-
37
- ## Installing and Running SCIPPlan
38
- In order to Install SCIPPlan you need to ensure you have a working version of the SCIP optimisation suite on your system which can be installed from [the SCIP website](https://www.scipopt.org). For more information about SCIP and PySCIPOpt refer to this [installation guide](https://github.com/scipopt/PySCIPOpt/blob/master/INSTALL.md).
39
-
40
- After installing SCIP you will be able to install SCIPPlan using
41
- ```bash
42
- pip install scipplan
43
- ```
44
- Now you will be able to run some of the example domains which include
45
- - Navigation (3 instances)
46
-
47
- To run one of these examples all you need to do is run
48
- ```bash
49
- scipplan -D navigation -I 1
50
- ```
51
- which will run the 1st instance of the navigation domain. For more information regarding the available tags and what they mean run `scipplan --help`.
52
-
53
- Alternatively you can import scipplan classes to run it using python.
54
- ```py
55
- from scipplan.scipplan import SCIPPlan
56
- from scipplan.config import Config
57
- from scipplan.helpers import write_to_csv
58
- ```
59
- this will import the only 2 classes and function needed to run SCIPPlan. Then to set the configuration either create an instance of the Config class by setting the params or by retrieving the cli input
60
- ```py
61
- # Set params
62
- config = Config(domain="navigation", instance=1)
63
- # Retrieve cli args
64
- config = Config.get_config()
65
- ```
66
- after which you are able to solve problem by either using the solve or optimize methods
67
- ```py
68
- # The optimize method just optimises the problem for the given horizon
69
- plan = SCIPPlan(config)
70
- plan.optimize()
71
- # Class method which takes input the config, solves the problem
72
- # with auto incrementing the horizon until a solution is found then
73
- # returns the plan as well as the time taken to solve the problem
74
- plan, solve_time = SCIPPlan.solve(config)
75
- ```
76
- In order to save the generated constraints for the horizon solved as well as the results, use the following code
77
- ```py
78
- write_to_csv("new_constraints", plan.new_constraints, config)
79
- write_to_csv("results", plan.results_table, config)
80
- ```
81
-
82
-
83
-
84
- ## Custom Domains
85
- If you would like to create your own domain you will need to create a directory named "translation" in the directory which scipplan is run from with txt files of the format "{translation type}\_{domain name}\_{instance number}.txt" (e.g. "pvariables_navigation_1.txt"). Note that the files in the translation directory will override any example files if they share domain name and instance number (e.g. navigation 1 would override the example).
86
-
87
- For each domain instance the following translation files are required
88
- - constants
89
- - pvariables
90
- - initials
91
- - goals
92
- - instantaneous_constraints
93
- - temporal_constraints
94
- - transitions
95
- - reward
96
-
97
- As a part of SCIPPlan, all the constraint files allow for the use of "and" and "or" expressions, polynomials and `exp`, `log`, `sqrt`, `sin` and `cos` functions (Note: `sin` and `cos` are only available in PySCIPOpt>=4.3.0 so if your version is below that you will not be able to use the trig functions unless you update).
98
-
99
- ### Constants
100
- The constants file allows for constant values to be defined as a variable to be used in other files in the model. To use add constants as follows
101
- ```txt
102
- HalfVal = 0.5
103
- Epsilon = config_epsilon
104
- bigM = config_bigM
105
- ```
106
-
107
- Some config values can be accessed in the constants file to be used in other files and are available as
108
- - `config_epsilon`
109
- - `config_gap`
110
- - `config_bigM`
111
- Note that these variables are only accessible in the constants file and you will need to define a new constants variable to store the value
112
-
113
- ### Pvariables
114
- When creating the pvariables file, the variables should be listed in the following format
115
- ```txt
116
- action_continuous: Accelerate_x
117
- action_continuous: Accelerate_y
118
- action_continuous: Dt
119
- action_boolean: Mode
120
- state_continuous: Location_x
121
- state_continuous: Location_y
122
- state_continuous: Speed_x
123
- state_continuous: Speed_y
124
- ```
125
- where the variable and value type of the variable is set in the format "{variable type}_{value type}" and the variable itself has to be in a Python compatible format (e.g. variables can't use - sign like `some-var` but can use _ like `some_var` as well as the dash sign ' cannot be used). The use of next state variables which is often written using the dash symbol will be explained further in the Transitions section.
126
- Additionally a variable for Dt has to be defined and has to be the same as the dt_var in the config object so if you would like to use a different variable name for Dt (e.g. dt) please also ensure you add it to the config via the `--dt-var` tag or the `dt_var` parameter.
127
- The available variable types are
128
- - state
129
- - action
130
- - auxiliary
131
-
132
- The available value types are
133
- - continuos
134
- - integer
135
- - boolean
136
-
137
- Please note that constants don't need to have their variable names defined in pvariables as they are defined in constants.
138
-
139
- ### Initials
140
- The initials file defines the initial state values for time t=0, for example
141
- ```txt
142
- Location_x == 0.0
143
- Location_y == 0.0
144
- Speed_x == 0.0
145
- Speed_y == 0.0
146
- ```
147
- notice te use of teh constant value defined earlier in the constants file.
148
- ### Goals
149
- The goals file should encode the final state values such that t=H+1, for example
150
- ```txt
151
- Location_x == 8.0
152
- Location_y == 8.0
153
- ```
154
- ### Instantaneous Constraints
155
- This is where the instantaneous constraints go.
156
- An example is as follows
157
- ```txt
158
- Location_x <= 10.0
159
- Location_y <= 10.0
160
- Location_x >= 0.0
161
- Location_y >= 0.0
162
- Accelerate_x <= 0.5
163
- Accelerate_y <= 0.5
164
- Accelerate_x >= -0.5
165
- Accelerate_y >= -0.5
166
- (Location_x <= 4.0) or (Location_x >= 6.0) or (Location_y <= 4.0) or (Location_y >= 6.0)
167
- ```
168
- ### Temporal Constraints
169
- The temporal constraints are the constraints which SCIPPlan will ensure that the solution never violates by iterating through every epsilon value of Dt and checking for zero crossings. An example of a temporal constraint is as follows
170
- ```txt
171
- Location_x + Speed_x*(Dt + Epsilon*Mode) + 0.5*Accelerate_x*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) <= 10.0
172
- Location_y + Speed_y*(Dt + Epsilon*Mode) + 0.5*Accelerate_y*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) <= 10.0
173
- Location_x + Speed_x*(Dt + Epsilon*Mode) + 0.5*Accelerate_x*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) >= 0.0
174
- Location_y + Speed_y*(Dt + Epsilon*Mode) + 0.5*Accelerate_y*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) >= 0.0
175
-
176
- ((Location_x + Speed_x*(Dt + Epsilon*Mode) + 0.5*Accelerate_x*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) <= 4.0) or
177
- (Location_x + Speed_x*(Dt + Epsilon*Mode) + 0.5*Accelerate_x*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) >= 6.0) or
178
- (Location_y + Speed_y*(Dt + Epsilon*Mode) + 0.5*Accelerate_y*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) <= 4.0) or
179
- (Location_y + Speed_y*(Dt + Epsilon*Mode) + 0.5*Accelerate_y*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) >= 6.0))
180
- ```
181
-
182
- The use of mode switches are used in these constraints (`Dt + Epsilon*Mode`). Please note that the or expression is enclosed in round brackets which allows the constraints to be parsed as a singular expression
183
- ### Transitions
184
- Transitions are to be added here with the following syntax.
185
- For example $S_{t+1} = \frac 12 A_t\cdot t^2 + V_t\cdot t + S_t$.
186
- Alternatively this can be written as $S' = \frac 12 A\cdot t^2 + V\cdot t + S$.
187
- Since Python doesn't allow variables to use the ' symbol it should be replaced with `_dash`, for example
188
- ```txt
189
- Location_x_dash - 1.0*Location_x - 1.0*Speed_x*(Dt + Epsilon*Mode) - 0.5*Accelerate_x*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) == 0.0
190
- Location_y_dash - 1.0*Location_y - 1.0*Speed_y*(Dt + Epsilon*Mode) - 0.5*Accelerate_y*(Dt + Epsilon*Mode)*(Dt + Epsilon*Mode) == 0.0
191
- Speed_x_dash - 1.0*Speed_x - 1.0*Accelerate_x*(Dt + Epsilon*Mode) == 0.0
192
- Speed_y_dash - 1.0*Speed_y - 1.0*Accelerate_y*(Dt + Epsilon*Mode) == 0.0
193
- ```
194
-
195
- ### Reward
196
- As for the reward function, SCIPPlan maximises the reward thus if using a cost function it should be negated as per the example
197
- ```txt
198
- -1.0*(Dt + Mode * Epsilon)
199
- ```
200
- Only one reward function is able to be optimised for in SCIPPlan
201
-
202
- ## Citation
203
-
204
- If you are using SCIPPlan, please cite the papers [1,2,3] and the underlying SCIP solver [4].
205
-
206
- ## References
207
- [1] Buser Say and Scott Sanner. [Metric Nonlinear Hybrid Planning with Constraint Generation](http://icaps18.icaps-conference.org/fileadmin/alg/conferences/icaps18/workshops/workshop06/docs/proceedings.pdf#page=23). In PlanSOpt, pages 19-25, 2018.
208
-
209
- [2] Buser Say and Scott Sanner. [Metric Hybrid Factored Planning in Nonlinear Domains with Constraint Generation](https://link.springer.com/chapter/10.1007/978-3-030-19212-9_33). In CPAIOR, pages 502-518, 2019.
210
-
211
- [3] Buser Say. [Robust Metric Hybrid Planning in Stochastic Nonlinear Domains Using Mathematical Optimization](https://ojs.aaai.org/index.php/ICAPS/article/view/27216). In ICAPS, pages 375-383, 2023.
212
-
213
- [4] [SCIP](https://www.scipopt.org/)
214
-
215
- [5] [PySCIPOpt](https://github.com/SCIP-Interfaces/PySCIPOpt)
File without changes
File without changes
File without changes