Commit 94053c2f authored by Bryson Howell's avatar Bryson Howell

initial commit. trying to get things to run

parent 265f7f6f
......@@ -104,16 +104,20 @@ def centroid_calc(points_meters):
return np.mean(points_meters, axis = 1)
def get_terrain_map(lat_lon = [0,0], sample_dist = 10, extent = 100, heading = 0, show_plot = False, verbosity = False):
def get_terrain_map(lat_lon = [0,0], sample_dist = 10, extent = 100, heading = 0, show_plot = False, verbosity = True):
# gis = GIS("pro")
# gis = GIS(url="http://virginiatech.maps.arcgis.com", client_id="rluxzSWjZS6TfeXs", username="hlarkin3_virginiatech", password="arcgisheintzman97#26640", verify_cert=False)
gis = GIS(username="larkinheintzman",password="Meepp97#26640")
#gis = GIS(username="larkinheintzman",password="Meepp97#26640")
#gis = GIS()
#gis = GIS(url="https://virginiatech.maps.arcgis.com", username="blhowell_virginiatech", password="Cc4f2LzUBC66q_P")
gis = GIS(api_key="AAPKe7cb1ab4f2ba44748cf53ac4f30d0caavu5t_-uMdWP8SRjtoea3s66-cRyFZmMTNx4rqy2w5sjwegU_tbJyBesd0LCMmdtV")
if verbosity:
print("Successfully logged in as: " + gis.properties.user.username)
elv_map = gis.content.get('58a541efc59545e6b7137f961d7de883')
elv_layer = elv_map.layers[0]
if len(lat_lon) > 2:
print("Error, too many lat long points provided")
return -1
......
......@@ -85,7 +85,7 @@ class RobotGP(torch.nn.Module):
def _hook(self, tensor, _min=-1e10, _max=1e10):
tensor.requires_grad_(True)
# tensor.retain_grad()
#tensor.retain_grad()
tensor.register_hook(lambda grad: grad.clamp_(min=_min, max=_max))
# tensor.register_hook(lambda grad: grad.clamp_(-self.grad_clamp_value, self.grad_clamp_value))
return tensor
......@@ -500,7 +500,7 @@ class RobotGP(torch.nn.Module):
self.compute_risk_cost()
# self.risk_cost.backward(retain_graph=True)
#self.risk_cost.backward(retain_graph=True)
self.risk_cost.backward(retain_graph=False) # testing if this is required
# no_nans_p_grad = _find_nans(self.robot_points.grad).shape[0] == 0
......
import numpy as np
from arcgis_terrain import lat_lon2meters
#from arcgis_terrain import lat_lon2meters
from scipy import interpolate
'''
A thing to handle all the lost person model/heatmap stuff, making a custom one, loading Amanda's, and so on
......@@ -54,9 +54,10 @@ def load_heatmap(filename, map_size, map_res, anchor_point):
if __name__ == "__main__":
# stuff
my_data = load_heatmap('C:\\Users\\Larkin\\planning_llh_bgc\\LP model\\analysis\\outputs\\ic_1_con_hiker_t12.csv', [100,100], 10, [37.197730, -80.585233])
'./LP model/analysis/outputs/ic_1_con_hiker_t12_kentland.csv'
#my_data = load_heatmap('C:\\Users\\Larkin\\planning_llh_bgc\\LP model\\analysis\\outputs\\ic_1_con_hiker_t12.csv', [100,100], 10, [37.197730, -80.585233])
my_data = load_heatmap('./LP model/analysis/outputs/ic_1_con_hiker_t12_kentland.csv', [100,100], 10, [37.197730, -80.585233])
import matplotlib.pyplot as plt
plt.imshow(my_data[0])
plt.show()
print("done")
......@@ -13,7 +13,7 @@ class Default:
self.params.setdefault( 'T', 50 )
self.params.setdefault( 'iter_steps', int(self.params['T']/self.params['dt']) )
self.params.setdefault( 'num_iter', 300 )
self.params.setdefault( 'num_iter', 10 ) #change from 300
self.params.setdefault( 'num_humans', 1 )
......@@ -22,7 +22,7 @@ class Default:
self.params.setdefault( 'num_robots', 2)
##############################
self.params.setdefault( 'max_plan_nodes', 100)
self.params.setdefault( 'max_plan_nodes', 5) #change from 100
self.params.setdefault( 'terrainType', 'real')
self.params.setdefault( 'save_terrain', False)
self.params.setdefault( 'save_MCdata', False)
......@@ -77,9 +77,10 @@ class Default:
# lost person model parameters
self.params.setdefault('lp_model', 'custom') # options: 'custom', 'naive', 'ring'
self.params.setdefault('lp_filename', 'C:\\Users\\Larkin\\planning_llh_bgc\\LP model\\analysis\\outputs\\ic_1_con_hiker_t12_kentland.csv') # filename to load for heatmap data
#self.params.setdefault('lp_filename', 'C:\\Users\\Larkin\\planning_llh_bgc\\LP model\\analysis\\outputs\\ic_1_con_hiker_t12_kentland.csv') # filename to load for heatmap data
self.params.setdefault('lp_filename', './LP model/analysis/outputs/ic_1_con_hiker_t12_kentland.csv') # filename to load for heatmap data
# should make sure the heatmap file used is derived from the correct BWLF mat file
self.params.setdefault('lin_feat_filename', 'C:\\Users\\Larkin\\ags_grabber\\matlab_data\\BW_LFandInac_Zelev_kentland.mat') # filename used for linear features/inac
self.params.setdefault('lin_feat_filename', '../ags_grabber/matlab_data/BW_LFandInac_Zelev_kentland.mat') # filename used for linear features/inac
self.params.setdefault('ring_mobi', [0.6e3, 1.8e3, 3.2e3, 9.9e3]) # mobility for ring model heatmap
self.params.setdefault('lp_threshold', 0.2) # hotspot cutoff threshold on normalized heatmap (ind values in 0-1)
self.params.setdefault('t_to_f_iter', 5000) # number of iterations to settle on time to find
......@@ -93,7 +94,4 @@ class Default:
# data parameters
self.params.setdefault('plot_data', True) # plots data in plotly viewer upon finishing
self.params.setdefault('save_data', False) # saves risk-cost and waypoint related data in json upon finishing
self.params.setdefault('save_folder', 'kentland_n3_s2_rc') # which folder to save data in
\ No newline at end of file
self.params.setdefault('save_folder', 'howell_test') # which folder to save data in
arcgis==1.8.2
argon2-cffi @ file:///C:/ci/argon2-cffi_1596826740294/work
attrs==19.3.0
anyio==3.6.2
arcgis==2.0.0
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
asttokens==2.2.1
attrs==22.1.0
Babel==2.11.0
backcall==0.2.0
beautifulsoup4==4.9.1
bleach==3.1.5
blinker==1.4
bmi-arcgis-restapi==1.0.5
boostrtrees @ file:///C:/Users/Larkin/planning_llh_bgc/pyboostrtree/dist/boostrtrees-0.0.1a1.tar.gz
brotlipy==0.7.0
certifi==2020.6.20
cffi==1.14.0
chardet==3.0.4
colorama==0.4.3
contextlib2==0.6.0.post1
cryptography==2.8
cycler==0.10.0
Cython @ file:///C:/ci/cython_1594834059511/work
decorator==4.4.2
defusedxml==0.6.0
dill @ file:///tmp/build/80754af9/dill_1593202311028/work
entrypoints==0.3
graphviz==0.14
idna @ file:///tmp/build/80754af9/idna_1593446292537/work
importlib-metadata @ file:///C:/ci/importlib-metadata_1593431910144/work
ipykernel @ file:///C:/ci/ipykernel_1596206775157/work/dist/ipykernel-5.3.4-py3-none-any.whl
ipython @ file:///C:/ci/ipython_1593446240034/work
beautifulsoup4==4.11.1
bleach==5.0.1
boostrtrees==0.0.1a1
cachetools==5.2.0
certifi==2022.9.24
cffi==1.15.1
charset-normalizer==2.1.1
click==8.1.3
contourpy==1.0.6
cryptography==38.0.4
cycler==0.11.0
Cython==0.29.32
debugpy==1.6.4
decorator==5.1.1
defusedxml==0.7.1
entrypoints==0.4
executing==1.2.0
fastjsonschema==2.16.2
fonttools==4.38.0
geomet==1.0.0
gssapi==1.8.2
idna==3.4
ipykernel==6.17.1
ipython==8.7.0
ipython-genutils==0.2.0
ipywidgets==7.5.1
jedi @ file:///C:/ci/jedi_1596472773465/work
Jinja2==2.11.2
jsonschema==3.2.0
jupyter==1.0.0
jupyter-client @ file:///tmp/build/80754af9/jupyter_client_1594826976318/work
jupyter-console==6.1.0
jupyter-core==4.6.3
keyring==21.2.0
kiwisolver==1.2.0
lerc @ file:///Volumes/JetDrive/virtualenv/miniconda/conda-bld/lerc_1594078116229/work
MarkupSafe==1.1.1
matplotlib @ file:///C:/ci/matplotlib-base_1592846129657/work
mistune==0.8.4
mkl-fft==1.1.0
mkl-random==1.1.1
mkl-service==2.3.0
munch==2.5.0
nbconvert==5.6.1
nbformat==5.0.7
notebook @ file:///C:/ci/notebook_1596840158498/work
ntlm-auth==1.4.0
numpy @ file:///C:/ci/numpy_and_numpy_base_1596233948451/work
oauthlib==3.1.0
olefile==0.46
opt-einsum==3.1.0
packaging==20.4
pandas @ file:///C:/ci/pandas_1596825959733/work
pandocfilters==1.4.2
parso==0.7.0
ipywidgets==8.0.2
jedi==0.18.2
jeepney==0.8.0
Jinja2==3.1.2
json5==0.9.10
jsonschema==4.17.3
jupyter-server==1.23.3
jupyter_client==7.4.8
jupyter_core==5.1.0
jupyterlab==3.5.1
jupyterlab-pygments==0.2.2
jupyterlab-widgets==3.0.3
jupyterlab_server==2.16.3
keyring==21.7.0
kiwisolver==1.4.4
lerc==0.1.0
lxml==4.9.1
MarkupSafe==2.1.1
matplotlib==3.6.2
matplotlib-inline==0.1.6
mistune==2.0.4
nbclassic==0.4.8
nbclient==0.7.2
nbconvert==7.2.6
nbformat==5.7.0
nest-asyncio==1.5.6
notebook==6.5.2
notebook_shim==0.2.2
ntlm-auth==1.5.0
numpy==1.23.5
nvidia-cublas-cu11==11.10.3.66
nvidia-cuda-nvrtc-cu11==11.7.99
nvidia-cuda-runtime-cu11==11.7.99
nvidia-cudnn-cu11==8.5.0.96
oauthlib==3.2.2
opt-einsum==3.3.0
packaging==21.3
pandas==1.5.2
pandocfilters==1.5.0
parso==0.8.3
pexpect==4.8.0
pickleshare==0.7.5
Pillow @ file:///C:/ci/pillow_1594299032796/work
plotly @ file:///tmp/build/80754af9/plotly_1597716491413/work
prometheus-client==0.8.0
prompt-toolkit==3.0.5
pycparser @ file:///tmp/build/80754af9/pycparser_1594388511720/work
Pygments==2.6.1
PyJWT==1.7.1
pyOpenSSL @ file:///tmp/build/80754af9/pyopenssl_1594392929924/work
pyparsing==2.4.7
pyproj==2.2.0
pyro-ppl==0.4.1
Pyro4 @ file:///home/conda/feedstock_root/build_artifacts/pyro4_1588174595613/work
pyrsistent==0.16.0
pyshp==2.1.0
PySocks==1.7.1
python-dateutil==2.8.1
pytz==2020.1
pywin32==227
pywin32-ctypes==0.2.0
pywinpty==0.5.7
pyzmq==19.0.1
qtconsole @ file:///tmp/build/80754af9/qtconsole_1592848611704/work
QtPy==1.9.0
requests @ file:///tmp/build/80754af9/requests_1592841827918/work
requests-kerberos==0.12.0
Pillow==9.3.0
platformdirs==2.5.4
plotly==5.11.0
prometheus-client==0.15.0
prompt-toolkit==3.0.33
psutil==5.9.4
ptyprocess==0.7.0
pure-eval==0.2.2
pycparser==2.21
Pygments==2.13.0
pyparsing==3.0.9
pyproj==3.4.0
pyro-api==0.1.2
pyro-ppl==1.8.3
pyrsistent==0.19.2
pyshp==2.3.1
python-certifi-win32==1.6.1
python-dateutil==2.8.2
pytz==2022.6
pyzmq==24.0.1
requests==2.28.1
requests-gssapi==1.2.3
requests-ntlm==1.1.0
requests-oauthlib==1.3.0
requests-toolbelt==0.9.1
retrying==1.3.3
Rtree==0.9.4
scipy @ file:///C:/ci/scipy_1592930618155/work
selenium==3.141.0
Send2Trash==1.5.0
serpent==1.30.2
Shapely==1.7.1
six==1.15.0
soupsieve==2.0.1
terminado==0.8.3
testpath==0.4.4
torch==1.5.0
torchvision==0.6.0
tornado==6.0.4
tqdm @ file:///tmp/build/80754af9/tqdm_1596810128862/work
traitlets==4.3.3
urllib3 @ file:///tmp/build/80754af9/urllib3_1597086586889/work
wcwidth @ file:///tmp/build/80754af9/wcwidth_1593447189090/work
requests-oauthlib==1.3.1
requests-toolbelt==0.10.1
Rtree==1.0.1
scipy==1.9.3
SecretStorage==3.3.3
Send2Trash==1.8.0
setuptools-scm==7.0.5
six==1.16.0
sniffio==1.3.0
soupsieve==2.3.2.post1
stack-data==0.6.2
tenacity==8.1.0
terminado==0.17.1
tinycss2==1.2.1
tomli==2.0.1
torch==1.13.0
tornado==6.2
tqdm==4.64.1
traitlets==5.6.0
typing_extensions==4.4.0
ujson==5.6.0
urllib3==1.25.11
wcwidth==0.2.5
webencodings==0.5.1
widgetsnbextension==3.5.1
win-inet-pton==1.1.0
wincertstore==0.2
winkerberos==0.7.0
zipp==3.1.0
websocket-client==1.4.2
widgetsnbextension==4.0.3
wrapt==1.14.1
......@@ -189,18 +189,30 @@ if __name__ == "__main__":
# torch.cuda.ipc_collect()
# main(iteration=0, parameters=params)
kentland_heatmap = 'C:\\Users\\Larkin\\planning_llh_bgc\\LP model\\analysis\\outputs\\ic_1_con_hiker_t12_kentland.csv'
hmpark_heatmap = 'C:\\Users\\Larkin\\planning_llh_bgc\\LP model\\analysis\\outputs\\ic_1_con_hiker_t12_hmpark.csv'
#Old absolute filepaths for Windows
#kentland_heatmap = 'C:\\Users\\Larkin\\planning_llh_bgc\\LP model\\analysis\\outputs\\ic_1_con_hiker_t12_kentland.csv'
#hmpark_heatmap = 'C:\\Users\\Larkin\\planning_llh_bgc\\LP model\\analysis\\outputs\\ic_1_con_hiker_t12_hmpark.csv'
#kentland_linfeat = 'C:\\Users\\Larkin\\ags_grabber\\matlab_data\\BW_LFandInac_Zelev_kentland.mat' # filename used for linear features/inac
#hmpark_linfeat = 'C:\\Users\\Larkin\\ags_grabber\\matlab_data\\BW_LFandInac_Zelev_hmpark.mat' # filename used for linear features/inac
#Relative filepaths for Linux (Assumes this and ags_grabber projects are in same parent directory)
kentland_heatmap = './LP model/analysis/outputs/ic_1_con_hiker_t12_kentland.csv'
hmpark_heatmap = './LP model/analysis/outputs/ic_1_con_hiker_t12_hmpark.csv'
kentland_linfeat = '../ags_grabber/matlab_data/BW_LFandInac_Zelev_kentland.mat'
hmpark_linfeat = '../ags_grabber/matlab_data/BW_LFandInac_Zelev_hmpark.mat'
#kentland_linfeat = '~/trustSAR/ags_grabber/matlab_data/BW_LFandInac_Zelev_kentland.mat'
#hmpark_linfeat = '~/trustSAR/ags_grabber/matlab_data/BW_LFandInac_Zelev_hmpark.mat'
kentland_linfeat = 'C:\\Users\\Larkin\\ags_grabber\\matlab_data\\BW_LFandInac_Zelev_kentland.mat' # filename used for linear features/inac
hmpark_linfeat = 'C:\\Users\\Larkin\\ags_grabber\\matlab_data\\BW_LFandInac_Zelev_hmpark.mat' # filename used for linear features/inac
# KENTLAND case
if True:
n_max = 6
s_max = 2
global_fail_max = 1000
#global_fail_max = 1000
global_fail_max = 5
global_fails = 0
avg_runs = 5
start_time = time.time()
......@@ -225,18 +237,23 @@ if __name__ == "__main__":
counter = 0
while counter < avg_runs and global_fails <= global_fail_max: # number of averaging runs
#print(torch.cuda.get_device_name())
torch.cuda.empty_cache()
torch.cuda.ipc_collect()
try:
try:
main(iteration = counter, parameters=params)
print("done run")
except RuntimeError as e:
print("\n\n ------ bad memory, re trying ------\n")
global_fails += 1
continue
#try:
# main(iteration = counter, parameters=params)
# print("done run")
#except RuntimeError as e:
# print(e)
# print("\n\n ------ bad memory, re trying ------\n")
# global_fails += 1
# continue
main(iteration = counter, parameters=params)
print("done run")
counter += 1
except AttributeError as e:
print(e)
print("\n\n ------- bad optimization, re trying ---------- \n")
global_fails += 1
......@@ -503,4 +520,4 @@ if __name__ == "__main__":
# counter += 1
# except AttributeError as e:
# print("\n\n ------- bad optimization, re trying ---------- \n")
# global_fails += 1
\ No newline at end of file
# global_fails += 1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment