forked from SeAIPalette/SeAIPalette
Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
p73692015 | d32a163e98 | |
p73692015 | d76a53e8ef | |
p73692015 | 8c5af7ccf1 | |
p73692015 | a697ec5e01 |
|
@ -1,3 +0,0 @@
|
||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="PYTHON_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
<component name="PyDocumentationSettings">
|
|
||||||
<option name="format" value="PLAIN" />
|
|
||||||
<option name="myDocStringFormat" value="Plain" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<profile version="1.0">
|
|
||||||
<option name="myName" value="Project Default" />
|
|
||||||
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
|
||||||
<option name="ignoredIdentifiers">
|
|
||||||
<list>
|
|
||||||
<option value="runtest.ImageEditorPage" />
|
|
||||||
<option value="ImageEditorPage" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</inspection_tool>
|
|
||||||
</profile>
|
|
||||||
</component>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<settings>
|
|
||||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
|
||||||
<version value="1.0" />
|
|
||||||
</settings>
|
|
||||||
</component>
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (Palette)" project-jdk-type="Python SDK" />
|
|
||||||
</project>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/SeAIPalette.iml" filepath="$PROJECT_DIR$/.idea/SeAIPalette.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -2,8 +2,10 @@
|
||||||
|
|
||||||
# Form implementation generated from reading ui file 'MainWindow_map.ui'
|
# Form implementation generated from reading ui file 'MainWindow_map.ui'
|
||||||
#
|
#
|
||||||
# Created by: PyQt5 UI code generator 5.12.3
|
# Created by: PyQt5 UI code generator 5.15.1
|
||||||
# WARNING! All changes made in this file will be lost!
|
#
|
||||||
|
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||||
|
# run again. Do not edit this file unless you know what you are doing.
|
||||||
|
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
@ -94,9 +96,6 @@ class Ui_MainWindow(object):
|
||||||
self.horizontalLayout.addLayout(self.formLayout_2)
|
self.horizontalLayout.addLayout(self.formLayout_2)
|
||||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
|
||||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
|
|
||||||
self.pushButton_2.setObjectName("pushButton_2")
|
|
||||||
self.verticalLayout_2.addWidget(self.pushButton_2)
|
|
||||||
self.pushButton_run = QtWidgets.QPushButton(self.centralwidget)
|
self.pushButton_run = QtWidgets.QPushButton(self.centralwidget)
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily("宋体")
|
font.setFamily("宋体")
|
||||||
|
@ -111,13 +110,6 @@ class Ui_MainWindow(object):
|
||||||
self.pushButton_stop.setFont(font)
|
self.pushButton_stop.setFont(font)
|
||||||
self.pushButton_stop.setObjectName("pushButton_stop")
|
self.pushButton_stop.setObjectName("pushButton_stop")
|
||||||
self.verticalLayout_2.addWidget(self.pushButton_stop)
|
self.verticalLayout_2.addWidget(self.pushButton_stop)
|
||||||
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
|
|
||||||
font = QtGui.QFont()
|
|
||||||
font.setFamily("宋体")
|
|
||||||
font.setPointSize(12)
|
|
||||||
self.pushButton.setFont(font)
|
|
||||||
self.pushButton.setObjectName("pushButton")
|
|
||||||
self.verticalLayout_2.addWidget(self.pushButton)
|
|
||||||
self.horizontalLayout.addLayout(self.verticalLayout_2)
|
self.horizontalLayout.addLayout(self.verticalLayout_2)
|
||||||
self.horizontalLayout.setStretch(0, 1)
|
self.horizontalLayout.setStretch(0, 1)
|
||||||
self.horizontalLayout.setStretch(1, 1)
|
self.horizontalLayout.setStretch(1, 1)
|
||||||
|
@ -157,8 +149,6 @@ class Ui_MainWindow(object):
|
||||||
self.label_9.setText(_translate("MainWindow", "移动节点电池容量"))
|
self.label_9.setText(_translate("MainWindow", "移动节点电池容量"))
|
||||||
self.lineEdit_bettery.setText(_translate("MainWindow", "100"))
|
self.lineEdit_bettery.setText(_translate("MainWindow", "100"))
|
||||||
self.label_4.setText(_translate("MainWindow", "算法选择"))
|
self.label_4.setText(_translate("MainWindow", "算法选择"))
|
||||||
self.pushButton_2.setText(_translate("MainWindow", "关于我们"))
|
|
||||||
self.pushButton_run.setText(_translate("MainWindow", "运行"))
|
self.pushButton_run.setText(_translate("MainWindow", "运行"))
|
||||||
self.pushButton_stop.setText(_translate("MainWindow", "停止"))
|
self.pushButton_stop.setText(_translate("MainWindow", "停止"))
|
||||||
self.pushButton.setText(_translate("MainWindow", "退出程序"))
|
|
||||||
self.label_show.setText(_translate("MainWindow", "<html><head/><body><p><br/></p></body></html>"))
|
self.label_show.setText(_translate("MainWindow", "<html><head/><body><p><br/></p></body></html>"))
|
||||||
|
|
|
@ -157,13 +157,6 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>关于我们</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_run">
|
<widget class="QPushButton" name="pushButton_run">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
|
@ -190,19 +183,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>宋体</family>
|
|
||||||
<pointsize>12</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>退出程序</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -12,6 +12,7 @@ class Charge(WildFire):
|
||||||
|
|
||||||
def step(self, state, info):
|
def step(self, state, info):
|
||||||
if not self.empty():
|
if not self.empty():
|
||||||
|
# if there're actions to do
|
||||||
action = self.actions_to_do[0]
|
action = self.actions_to_do[0]
|
||||||
del self.actions_to_do[0]
|
del self.actions_to_do[0]
|
||||||
return action, None
|
return action, None
|
||||||
|
|
|
@ -23,6 +23,9 @@ class MultiBoustrophedon(Boustrophedon):
|
||||||
self.charges = charges
|
self.charges = charges
|
||||||
self.finished_idx = [False for _ in range(ship_num)]
|
self.finished_idx = [False for _ in range(ship_num)]
|
||||||
|
|
||||||
|
#self.ship_energy = ship_energy
|
||||||
|
#self.current_ship_energy = [ship_energy for _ in range(self.ship_num)]
|
||||||
|
|
||||||
self.delta_x = (0, 0, 1, -1, ) # 1, 1, -1, -1)
|
self.delta_x = (0, 0, 1, -1, ) # 1, 1, -1, -1)
|
||||||
self.delta_y = (1, -1, 0, 0, ) # 1, -1, 1, -1)
|
self.delta_y = (1, -1, 0, 0, ) # 1, -1, 1, -1)
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,8 @@ class MultiGreedy(Boustrophedon):
|
||||||
if self.charges[i].empty():
|
if self.charges[i].empty():
|
||||||
redecide_directions[i] = True
|
redecide_directions[i] = True
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Decide whether charge or not
|
||||||
first_charge_act, charge_len = self.charges.step(state, info, i)
|
first_charge_act, charge_len = self.charges.step(state, info, i)
|
||||||
if first_charge_act == FINISHED:
|
if first_charge_act == FINISHED:
|
||||||
self.finished_idx[i] = True
|
self.finished_idx[i] = True
|
||||||
|
|
|
@ -18,10 +18,13 @@ class MultiSpiral(Spiral):
|
||||||
):
|
):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.ship_num = ship_num
|
self.ship_num = ship_num
|
||||||
|
# self.dest_direction = [None for _ in range(ship_num)]
|
||||||
self.wildfires = wildfires
|
self.wildfires = wildfires
|
||||||
self.charges = charges
|
self.charges = charges
|
||||||
self.finished_idx = [False for _ in range(ship_num)]
|
self.finished_idx = [False for _ in range(ship_num)]
|
||||||
|
|
||||||
|
#self.ship_energy = ship_energy
|
||||||
|
#self.current_ship_energy = [ship_energy for _ in range(self.ship_num)]
|
||||||
|
|
||||||
self.delta_x = [0, 0, 1, -1, 1, 1, -1, -1]
|
self.delta_x = [0, 0, 1, -1, 1, 1, -1, -1]
|
||||||
self.delta_y = [1, -1, 0, 0, 1, -1, 1, -1]
|
self.delta_y = [1, -1, 0, 0, 1, -1, 1, -1]
|
||||||
|
|
|
@ -149,6 +149,7 @@ class Spiral(object):
|
||||||
"""
|
"""
|
||||||
return _turn(direction)
|
return _turn(direction)
|
||||||
else:
|
else:
|
||||||
|
# print(f'not turn')
|
||||||
return direction
|
return direction
|
||||||
|
|
||||||
def step(self, state, info):
|
def step(self, state, info):
|
||||||
|
|
|
@ -7,8 +7,8 @@ class WildFire(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.actions_to_do = []
|
self.actions_to_do = []
|
||||||
self.delta_x = (0, 0, 1, -1, )
|
self.delta_x = (0, 0, 1, -1, ) # 1, 1, -1, -1)
|
||||||
self.delta_y = (1, -1, 0, 0, )
|
self.delta_y = (1, -1, 0, 0, ) # 1, -1, 1, -1)
|
||||||
|
|
||||||
@ staticmethod
|
@ staticmethod
|
||||||
def _is_valid_index(index, an_array):
|
def _is_valid_index(index, an_array):
|
||||||
|
@ -23,9 +23,12 @@ class WildFire(object):
|
||||||
|
|
||||||
def step(self, state, info):
|
def step(self, state, info):
|
||||||
if not self.empty():
|
if not self.empty():
|
||||||
|
# if there're actions to do
|
||||||
action = self.actions_to_do[0]
|
action = self.actions_to_do[0]
|
||||||
del self.actions_to_do[0]
|
del self.actions_to_do[0]
|
||||||
return [action]
|
return [action]
|
||||||
|
|
||||||
|
# print(state)
|
||||||
x, y, _ = state
|
x, y, _ = state
|
||||||
fields = info['fields']
|
fields = info['fields']
|
||||||
|
|
||||||
|
@ -46,6 +49,7 @@ class WildFire(object):
|
||||||
visited[next_x, next_y] = True
|
visited[next_x, next_y] = True
|
||||||
next_node = Node(next_x, next_y, cur_node)
|
next_node = Node(next_x, next_y, cur_node)
|
||||||
if fields[next_x, next_y] == 0:
|
if fields[next_x, next_y] == 0:
|
||||||
|
# not visited
|
||||||
node = next_node
|
node = next_node
|
||||||
while node.direction is not None:
|
while node.direction is not None:
|
||||||
self.actions_to_do.append(node.direction)
|
self.actions_to_do.append(node.direction)
|
||||||
|
|
|
@ -38,7 +38,7 @@ class SeaEnvEngine(object):
|
||||||
show_fields: bool = True,
|
show_fields: bool = True,
|
||||||
|
|
||||||
init_ships: bool = True,
|
init_ships: bool = True,
|
||||||
start_position=None,
|
start_position=None, # [start_x, start_y]
|
||||||
start_r=None,
|
start_r=None,
|
||||||
|
|
||||||
time_click: float = 1.0/10.0,
|
time_click: float = 1.0/10.0,
|
||||||
|
@ -57,8 +57,8 @@ class SeaEnvEngine(object):
|
||||||
|
|
||||||
self.max_angle, self.min_angle = None, None
|
self.max_angle, self.min_angle = None, None
|
||||||
|
|
||||||
|
# basic params
|
||||||
self.crashed = False
|
self.crashed = False # whether or not crash into an obstacle or bound
|
||||||
self.finished = False
|
self.finished = False
|
||||||
self.terminate = False
|
self.terminate = False
|
||||||
|
|
||||||
|
@ -100,9 +100,12 @@ class SeaEnvEngine(object):
|
||||||
self.ship_img = pygame.transform.scale(
|
self.ship_img = pygame.transform.scale(
|
||||||
self.ship_img, (self.ship_radius * 4, self.ship_radius * 4))
|
self.ship_img, (self.ship_radius * 4, self.ship_radius * 4))
|
||||||
""" 2. init gymunk """
|
""" 2. init gymunk """
|
||||||
|
# physics stuff
|
||||||
self.space = pymunk.Space()
|
self.space = pymunk.Space()
|
||||||
self.space.gravity = pymunk.Vec2d(0., 0.)
|
self.space.gravity = pymunk.Vec2d(0., 0.)
|
||||||
|
# create bounds
|
||||||
|
# self.create_bounds(window_height, window_width)
|
||||||
|
# create ship
|
||||||
self.finished_idx = None
|
self.finished_idx = None
|
||||||
self.init_ships = init_ships
|
self.init_ships = init_ships
|
||||||
self.battery_capacity = None
|
self.battery_capacity = None
|
||||||
|
@ -197,6 +200,7 @@ class SeaEnvEngine(object):
|
||||||
for s in static:
|
for s in static:
|
||||||
s.friction = 1.
|
s.friction = 1.
|
||||||
s.group = 1
|
s.group = 1
|
||||||
|
# bound is the same as obstacle for collision
|
||||||
s.collision_type = COLLISION_OBSTACLE
|
s.collision_type = COLLISION_OBSTACLE
|
||||||
s.color = THECOLORS['blue']
|
s.color = THECOLORS['blue']
|
||||||
self.space.add(*static)
|
self.space.add(*static)
|
||||||
|
@ -226,8 +230,10 @@ class SeaEnvEngine(object):
|
||||||
self._ship_charging_time_left = [0 for _ in range(self.ship_num)]
|
self._ship_charging_time_left = [0 for _ in range(self.ship_num)]
|
||||||
|
|
||||||
def create_rectangle_obstacle(self, x, y, width, height):
|
def create_rectangle_obstacle(self, x, y, width, height):
|
||||||
|
# points = [(0, 0), (0, height), (width, height), (width, 0)]
|
||||||
points = [(-width/2, -height/2), (-width/2, height/2),
|
points = [(-width/2, -height/2), (-width/2, height/2),
|
||||||
(width/2, height/2), (width/2, -height/2)]
|
(width/2, height/2), (width/2, -height/2)]
|
||||||
|
# points = [(-width, -height), (-width, 0), (0, 0), (0, -height)]
|
||||||
mass = 9999999999
|
mass = 9999999999
|
||||||
moment = pymunk.moment_for_poly(mass, points, (0, 0))
|
moment = pymunk.moment_for_poly(mass, points, (0, 0))
|
||||||
obstacle_body = pymunk.Body(mass=mass, moment=moment)
|
obstacle_body = pymunk.Body(mass=mass, moment=moment)
|
||||||
|
|
|
@ -112,8 +112,9 @@ def make(
|
||||||
"""
|
"""
|
||||||
if not render:
|
if not render:
|
||||||
os.environ["SDL_VIDEODRIVER"] = "dummy"
|
os.environ["SDL_VIDEODRIVER"] = "dummy"
|
||||||
|
else:
|
||||||
|
os.environ["DISPLAY"] = os.popen(
|
||||||
|
'printenv grep DISPLAY').read().strip()
|
||||||
"""
|
"""
|
||||||
|
|
||||||
with open(os.path.join('Palette', 'maps', f'{env_config}.yaml'), 'r') as f:
|
with open(os.path.join('Palette', 'maps', f'{env_config}.yaml'), 'r') as f:
|
||||||
|
@ -159,5 +160,5 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
if t:
|
if t:
|
||||||
break
|
break
|
||||||
|
# sea_env.reset()
|
||||||
print(steps)
|
print(steps)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import random
|
||||||
|
|
||||||
from math import acos, asin
|
from math import acos, asin
|
||||||
|
|
||||||
|
@ -17,9 +18,12 @@ def process_angle(_angle):
|
||||||
|
|
||||||
def asincos(sin_value, cos_value):
|
def asincos(sin_value, cos_value):
|
||||||
if sin_value >= 0:
|
if sin_value >= 0:
|
||||||
|
# 第一象限和第二象限
|
||||||
return acos(cos_value)
|
return acos(cos_value)
|
||||||
else:
|
else:
|
||||||
if cos_value >= 0:
|
if cos_value >= 0:
|
||||||
|
# 第四象限
|
||||||
return asin(sin_value)
|
return asin(sin_value)
|
||||||
else:
|
else:
|
||||||
|
# 第三象限
|
||||||
return 2*np.pi - acos(cos_value)
|
return 2*np.pi - acos(cos_value)
|
||||||
|
|
|
@ -17,6 +17,7 @@ def generate_agent_fields(fields, ship_num, splited_areas):
|
||||||
for _ in range(ship_num)], axis=0)
|
for _ in range(ship_num)], axis=0)
|
||||||
for ship_id in range(1, ship_num+1):
|
for ship_id in range(1, ship_num+1):
|
||||||
cur_fields = agents_fields[ship_id-1]
|
cur_fields = agents_fields[ship_id-1]
|
||||||
|
# print((splited_areas != ship_id) * (splited_areas != -1))
|
||||||
cur_fields[(splited_areas != ship_id) * (splited_areas != -1)] += 1
|
cur_fields[(splited_areas != ship_id) * (splited_areas != -1)] += 1
|
||||||
return agents_fields
|
return agents_fields
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ def generate_agent_fields(fields, ship_num, splited_areas):
|
||||||
for _ in range(ship_num)], axis=0)
|
for _ in range(ship_num)], axis=0)
|
||||||
for ship_id in range(1, ship_num+1):
|
for ship_id in range(1, ship_num+1):
|
||||||
cur_fields = agents_fields[ship_id-1]
|
cur_fields = agents_fields[ship_id-1]
|
||||||
|
# print((splited_areas != ship_id) * (splited_areas != -1))
|
||||||
cur_fields[(splited_areas != ship_id) * (splited_areas != -1)] += 1
|
cur_fields[(splited_areas != ship_id) * (splited_areas != -1)] += 1
|
||||||
return agents_fields
|
return agents_fields
|
||||||
|
|
||||||
|
@ -28,6 +29,7 @@ def main(env: SeaEnv, agent: MultiGreedy):
|
||||||
while True:
|
while True:
|
||||||
steps += 1
|
steps += 1
|
||||||
info['redecide_direction'] = redecide_direction
|
info['redecide_direction'] = redecide_direction
|
||||||
|
# print(np.sum(info['fields'] == 0))
|
||||||
agents_fields = generate_agent_fields(
|
agents_fields = generate_agent_fields(
|
||||||
info['fields'], env.ship_num, env.splited_areas)
|
info['fields'], env.ship_num, env.splited_areas)
|
||||||
agent_info = deepcopy(info)
|
agent_info = deepcopy(info)
|
||||||
|
|
|
@ -17,6 +17,7 @@ def generate_agent_fields(fields, ship_num, splited_areas):
|
||||||
for _ in range(ship_num)], axis=0)
|
for _ in range(ship_num)], axis=0)
|
||||||
for ship_id in range(1, ship_num+1):
|
for ship_id in range(1, ship_num+1):
|
||||||
cur_fields = agents_fields[ship_id-1]
|
cur_fields = agents_fields[ship_id-1]
|
||||||
|
# print((splited_areas != ship_id) * (splited_areas != -1))
|
||||||
cur_fields[(splited_areas != ship_id) * (splited_areas != -1)] += 1
|
cur_fields[(splited_areas != ship_id) * (splited_areas != -1)] += 1
|
||||||
return agents_fields
|
return agents_fields
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ def generate_agent_fields(fields, ship_num, splited_areas):
|
||||||
for _ in range(ship_num)], axis=0)
|
for _ in range(ship_num)], axis=0)
|
||||||
for ship_id in range(1, ship_num+1):
|
for ship_id in range(1, ship_num+1):
|
||||||
cur_fields = agents_fields[ship_id-1]
|
cur_fields = agents_fields[ship_id-1]
|
||||||
|
# print((splited_areas != ship_id) * (splited_areas != -1))
|
||||||
cur_fields[(splited_areas != ship_id) * (splited_areas != -1)] += 1
|
cur_fields[(splited_areas != ship_id) * (splited_areas != -1)] += 1
|
||||||
return agents_fields
|
return agents_fields
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@ def main(env: SeaEnv, agent: Union[Boustrophedon, Spiral], wildfire: WildFire):
|
||||||
redecide_direction = True
|
redecide_direction = True
|
||||||
cur_area_terminate = False
|
cur_area_terminate = False
|
||||||
while True:
|
while True:
|
||||||
|
# for _ in range(9999999):
|
||||||
|
# continue
|
||||||
info['redecide_direction'] = redecide_direction
|
info['redecide_direction'] = redecide_direction
|
||||||
modified_fields = deepcopy(info['fields'])
|
modified_fields = deepcopy(info['fields'])
|
||||||
modified_fields += ((splited_area != area_id)
|
modified_fields += ((splited_area != area_id)
|
||||||
|
|
|
@ -7,7 +7,7 @@ env:
|
||||||
ship_radius: !!int 5
|
ship_radius: !!int 5
|
||||||
ship_velocity: 200
|
ship_velocity: 200
|
||||||
sonar_spread_times: !!int 40
|
sonar_spread_times: !!int 40
|
||||||
obstacles:
|
obstacles: # name: [x of the left bottom, y of the left bottom, width, height]
|
||||||
obstacle0: [100, 100, 100, 200]
|
obstacle0: [100, 100, 100, 200]
|
||||||
obstacle1: [300, 160, 120, 120]
|
obstacle1: [300, 160, 120, 120]
|
||||||
obstacle2: [460, 460, 120, 120]
|
obstacle2: [460, 460, 120, 120]
|
||||||
|
|
|
@ -7,7 +7,7 @@ env:
|
||||||
ship_radius: !!int 5
|
ship_radius: !!int 5
|
||||||
ship_velocity: 200
|
ship_velocity: 200
|
||||||
sonar_spread_times: !!int 40
|
sonar_spread_times: !!int 40
|
||||||
obstacles:
|
obstacles: # name: [x of the left bottom, y of the left bottom, width, height]
|
||||||
obstacle0: [100, 600, 100, 200]
|
obstacle0: [100, 600, 100, 200]
|
||||||
obstacle1: [300, 360, 120, 120]
|
obstacle1: [300, 360, 120, 120]
|
||||||
obstacle2: [660, 460, 120, 120]
|
obstacle2: [660, 460, 120, 120]
|
||||||
|
|
|
@ -7,7 +7,7 @@ env:
|
||||||
ship_radius: !!int 5
|
ship_radius: !!int 5
|
||||||
ship_velocity: 200
|
ship_velocity: 200
|
||||||
sonar_spread_times: !!int 40
|
sonar_spread_times: !!int 40
|
||||||
obstacles:
|
obstacles: # name: [x of the left bottom, y of the left bottom, width, height]
|
||||||
obstacle0: [100, 600, 100, 200]
|
obstacle0: [100, 600, 100, 200]
|
||||||
obstacle1: [300, 260, 120, 320]
|
obstacle1: [300, 260, 120, 320]
|
||||||
obstacle2: [660, 460, 120, 120]
|
obstacle2: [660, 460, 120, 120]
|
||||||
|
|
|
@ -7,7 +7,7 @@ env:
|
||||||
ship_radius: !!int 1
|
ship_radius: !!int 1
|
||||||
ship_velocity: 40
|
ship_velocity: 40
|
||||||
sonar_spread_times: !!int 40
|
sonar_spread_times: !!int 40
|
||||||
obstacles:
|
obstacles: # name: [x of the left bottom, y of the left bottom, width, height]
|
||||||
obstacle0: [40, 440, 340, 220]
|
obstacle0: [40, 440, 340, 220]
|
||||||
obstacle1: [100, 160, 300, 180]
|
obstacle1: [100, 160, 300, 180]
|
||||||
obstacle2: [300, 40, 100, 60]
|
obstacle2: [300, 40, 100, 60]
|
||||||
|
|
|
@ -7,7 +7,7 @@ env:
|
||||||
ship_radius: !!int 5
|
ship_radius: !!int 5
|
||||||
ship_velocity: 200
|
ship_velocity: 200
|
||||||
sonar_spread_times: !!int 40
|
sonar_spread_times: !!int 40
|
||||||
obstacles:
|
obstacles: # name: [x of the left bottom, y of the left bottom, width, height]
|
||||||
obstacle0: [40, 440, 340, 220]
|
obstacle0: [40, 440, 340, 220]
|
||||||
obstacle1: [100, 160, 300, 180]
|
obstacle1: [100, 160, 300, 180]
|
||||||
obstacle2: [300, 40, 100, 60]
|
obstacle2: [300, 40, 100, 60]
|
||||||
|
|
|
@ -7,7 +7,7 @@ env:
|
||||||
ship_radius: !!int 1
|
ship_radius: !!int 1
|
||||||
ship_velocity: 40
|
ship_velocity: 40
|
||||||
sonar_spread_times: !!int 40
|
sonar_spread_times: !!int 40
|
||||||
obstacles:
|
obstacles: # name: [x of the left bottom, y of the left bottom, width, height]
|
||||||
obstacle0: [40, 440, 340, 220]
|
obstacle0: [40, 440, 340, 220]
|
||||||
obstacle1: [100, 160, 300, 180]
|
obstacle1: [100, 160, 300, 180]
|
||||||
obstacle2: [300, 40, 100, 60]
|
obstacle2: [300, 40, 100, 60]
|
||||||
|
|
|
@ -7,7 +7,7 @@ env:
|
||||||
ship_radius: !!int 5
|
ship_radius: !!int 5
|
||||||
ship_velocity: 200
|
ship_velocity: 200
|
||||||
sonar_spread_times: !!int 40
|
sonar_spread_times: !!int 40
|
||||||
obstacles:
|
obstacles: # name: [x of the left bottom, y of the left bottom, width, height]
|
||||||
obstacle0: [40, 440, 340, 220]
|
obstacle0: [40, 440, 340, 220]
|
||||||
obstacle1: [100, 160, 300, 180]
|
obstacle1: [100, 160, 300, 180]
|
||||||
obstacle2: [300, 40, 100, 60]
|
obstacle2: [300, 40, 100, 60]
|
||||||
|
|
|
@ -3,11 +3,16 @@ env:
|
||||||
window_width: !!int 1000
|
window_width: !!int 1000
|
||||||
window_height: !!int 1000
|
window_height: !!int 1000
|
||||||
field_size: [20, 20]
|
field_size: [20, 20]
|
||||||
|
#start_position:
|
||||||
|
# ship0: [10, 10]
|
||||||
|
# ship1: [990, 990]
|
||||||
|
#start_r:
|
||||||
|
# ship0: !!float 0.0 # pi
|
||||||
|
# ship1: !!float 1.0 # pi
|
||||||
ship_radius: !!int 5
|
ship_radius: !!int 5
|
||||||
ship_velocity: 200
|
ship_velocity: 200
|
||||||
sonar_spread_times: !!int 40
|
sonar_spread_times: !!int 40
|
||||||
obstacles:
|
obstacles: # name: [x of the left bottom, y of the left bottom, width, height]
|
||||||
obstacle0: [100, 100, 100, 200]
|
obstacle0: [100, 100, 100, 200]
|
||||||
obstacle1: [300, 160, 120, 120]
|
obstacle1: [300, 160, 120, 120]
|
||||||
obstacle2: [460, 460, 120, 120]
|
obstacle2: [460, 460, 120, 120]
|
||||||
|
|
|
@ -4,16 +4,16 @@ SeAI Palette集智调色板是面向集群网络的多节点智能协同路径
|
||||||
|
|
||||||
集智调色板软件设计了参数输入模块、算法运行模块及信息输出模块,在不同节点数量要求的前提下划分区域方向,按区域进行算法的运行。并可以综合考虑固定节点、覆盖率、电池容量等条件下,给出运行步数、重复步数和重复率等等性能指标。
|
集智调色板软件设计了参数输入模块、算法运行模块及信息输出模块,在不同节点数量要求的前提下划分区域方向,按区域进行算法的运行。并可以综合考虑固定节点、覆盖率、电池容量等条件下,给出运行步数、重复步数和重复率等等性能指标。
|
||||||
|
|
||||||
软件界面简单,易学易用,包含参数的输入选择,程序的运行,算法结果的展示等,源代码公开,算法可修改。
|
软件界面简单,易学已用,包含参数的输入选择,程序的运行,算法结果的展示等,源代码公开,算法可修改。
|
||||||
|
|
||||||
开发人员:王凯、于化鹏、李晶、王兆琦、李慧涛、赵志允、张乐飞、陈光
|
开发人员:H.P. Yu、K. Wang、J. Li、Z.Y. Zhao、L.F. Zhang、G. Chen、D.L.Liang、H.T. Li、Z.Q. Wan
|
||||||
|
|
||||||
## 1. 开发环境配置
|
## 1. 开发环境配置
|
||||||
运行以下命令:
|
运行以下命令:
|
||||||
```bash
|
```bash
|
||||||
conda env create -f create_env.yaml
|
conda env create -f create_env.yaml
|
||||||
```
|
```
|
||||||
该命令会根据create_env.yaml配置文件创建一个名为`Palette`的conda虚拟环境,继续输入`conda activate Palette`即可激活该虚拟环境。
|
该命令会创建一个名为`Palette`的conda虚拟环境,用`conda activate Palette`即可激活该虚拟环境。
|
||||||
|
|
||||||
|
|
||||||
## 2. 软件运行
|
## 2. 软件运行
|
||||||
|
@ -21,8 +21,9 @@ conda env create -f create_env.yaml
|
||||||
```python
|
```python
|
||||||
python main_tt.py
|
python main_tt.py
|
||||||
```
|
```
|
||||||
|
|
||||||
## 3. 一些说明
|
## 3. 一些说明
|
||||||
1. 关于程序输出的说明
|
1. 程序输出的说明
|
||||||
|
|
||||||
程序运行结束后会在命令行输出类似于下面的结果:
|
程序运行结束后会在命令行输出类似于下面的结果:
|
||||||
```
|
```
|
||||||
|
|
|
@ -3,6 +3,7 @@ from MainWindow_map import Ui_MainWindow
|
||||||
from PyQt5 import QtWidgets, QtCore, QtSql, QtGui
|
from PyQt5 import QtWidgets, QtCore, QtSql, QtGui
|
||||||
from PyQt5.QtWidgets import *
|
from PyQt5.QtWidgets import *
|
||||||
from PyQt5.QtCore import *
|
from PyQt5.QtCore import *
|
||||||
|
from PyQt5.QtGui import QPixmap
|
||||||
|
|
||||||
import threading, time, subprocess
|
import threading, time, subprocess
|
||||||
|
|
||||||
|
@ -121,5 +122,6 @@ class mywindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
window = mywindow()
|
window = mywindow()
|
||||||
|
# window.showMaximized()
|
||||||
window.show()
|
window.show()
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
||||||
|
|
Loading…
Reference in New Issue