no-log mode
This commit is contained in:
parent
dae6ffb6f5
commit
466d0ca575
6
agent.py
6
agent.py
@ -16,12 +16,12 @@ engine = Engine(SCREEN_SIZE, SQUARE_SIZE, kitchen, waiter, ACTION_DURATION)
|
||||
layout = LayoutController(engine, store).create_and_subscribe(COUNT_OF_OBJECTS)
|
||||
|
||||
|
||||
engine.loop()
|
||||
# engine.loop()
|
||||
|
||||
'''
|
||||
# '''
|
||||
def example_stop(action_clock: int) -> bool:
|
||||
return action_clock < 1000
|
||||
|
||||
|
||||
print(engine.train_loop(example_stop))
|
||||
'''
|
||||
# '''
|
||||
|
@ -83,12 +83,14 @@ class Engine:
|
||||
real_action_duration = self.action_duration
|
||||
self.action_duration = 0
|
||||
self.is_simulation = True
|
||||
self.predictor_c.is_simulation = True
|
||||
|
||||
while stop_condition(self.action_clock):
|
||||
self.action()
|
||||
|
||||
self.action_duration = real_action_duration
|
||||
self.is_simulation = False
|
||||
self.predictor_c.is_simulation = False
|
||||
|
||||
return self.serviced_tables
|
||||
|
||||
@ -157,7 +159,8 @@ class Engine:
|
||||
self.goal = None
|
||||
|
||||
def unattainable_goal(self):
|
||||
print(colored("Object unattainable", "red"))
|
||||
if not self.is_simulation:
|
||||
print(colored("Object unattainable", "red"))
|
||||
self.objects.remove(self.goal.parent)
|
||||
self.revoke_goal()
|
||||
|
||||
|
@ -28,6 +28,8 @@ class NeuralNetworkController:
|
||||
# STEP 5. Set up path to the folder containing test images
|
||||
self.test_images_folder = 'dataset/testset'
|
||||
|
||||
self.is_simulation = False
|
||||
|
||||
def predict(self, image_path):
|
||||
# STEP 1. Load and preprocess the test image
|
||||
test_image = keras.preprocessing.image.load_img(
|
||||
@ -44,7 +46,8 @@ class NeuralNetworkController:
|
||||
predicted_class_index = np.argmax(predictions[0])
|
||||
predicted_class = self.class_names[predicted_class_index]
|
||||
|
||||
print(colored("Predicted class: ", "yellow")+f"{predicted_class}")
|
||||
if not self.is_simulation:
|
||||
print(colored("Predicted class: ", "yellow")+f"{predicted_class}")
|
||||
return predicted_class
|
||||
|
||||
def random_path_img(self) -> str:
|
||||
|
@ -31,7 +31,8 @@ class StateController:
|
||||
self.path.append(self.path[-1].parent)
|
||||
total_cost += self.path[-1].cost
|
||||
|
||||
print(colored(f"Total path cost: ", "green")+f"{total_cost}")
|
||||
if not engine.is_simulation:
|
||||
print(colored(f"Total path cost: ", "green")+f"{total_cost}")
|
||||
return self.path
|
||||
|
||||
def graphsearch(self, engine): # A*
|
||||
@ -41,7 +42,8 @@ class StateController:
|
||||
# STEP 1. Store goal position
|
||||
self.goal = engine.goal.position
|
||||
|
||||
print(colored(f"Search path to ", "yellow")+f"{self.goal}")
|
||||
if not engine.is_simulation:
|
||||
print(colored(f"Search path to ", "yellow")+f"{self.goal}")
|
||||
|
||||
# STEP 2. Reset structures
|
||||
self.reset()
|
||||
@ -73,7 +75,8 @@ class StateController:
|
||||
# STEP 9. Reset structures
|
||||
self.reset()
|
||||
|
||||
print(colored("Not found", "red"))
|
||||
if not engine.is_simulation:
|
||||
print(colored("Not found", "red"))
|
||||
|
||||
return False
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user