-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
73 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ __pycache__ | |
public | ||
.coverage | ||
build/ | ||
|
||
outputs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[submodule "commonroad-search"] | ||
path = commonroad-search | ||
url = git@gitlab.lrz.de:tum-cps/commonroad-search.git | ||
url = https://gitlab.lrz.de/tum-cps/commonroad-search.git |
Submodule commonroad-search
updated
from 154ade to dd3ee6
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import math | ||
import copy | ||
import os | ||
|
||
from commonroad.scenario.scenario import Scenario | ||
from commonroad.planning.planning_problem import PlanningProblemSet | ||
|
||
from drplanner.utils.config import DrPlannerConfiguration | ||
from drplanner.prompter.prompter import Prompter | ||
|
||
|
||
class DrPlannerBase: | ||
def __init__( | ||
self, | ||
scenario: Scenario, | ||
planning_problem_set: PlanningProblemSet, | ||
config: DrPlannerConfiguration): | ||
|
||
self.scenario = scenario | ||
self.planning_problem_set = planning_problem_set | ||
# otherwise the planning problem might be changed during the initialization of the planner | ||
self.planning_problem = copy.deepcopy( | ||
list(self.planning_problem_set.planning_problem_dict.values())[0] | ||
) | ||
self.config = config | ||
|
||
self._visualize = self.config.visualize | ||
self._save_solution = self.config.save_solution | ||
|
||
self.THRESHOLD = config.cost_threshold | ||
self.TOKEN_LIMIT = config.token_limit | ||
self.ITERATION_MAX = config.iteration_max | ||
|
||
# todo: load from solution file | ||
self.desired_cost = self.config.desired_cost | ||
self.initial_cost = math.inf | ||
self.current_cost = None | ||
|
||
self.token_count = 0 | ||
self.cost_list = [] | ||
|
||
self.dir_output = os.path.join(os.path.dirname(__file__), "../../outputs/solutions/") | ||
os.makedirs(os.path.dirname(self.dir_output), exist_ok=True) # Ensure the directory exists | ||
|
||
self.prompter = Prompter( | ||
self.scenario, self.planning_problem, self.config.openai_api_key, self.config.gpt_version | ||
) | ||
self.prompter.LLM.temperature = self.config.temperature | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters