Skip to content

Commit

Permalink
updates for 22.10 (#5)
Browse files Browse the repository at this point in the history
* updates for 22.10

* Update extension.py

* display routes and demand

* Delete notebooks/routing/python/.ipynb_checkpoints directory

* Delete notebooks/routing/microservice/.ipynb_checkpoints directory

* Update notebook_helpers.py

* Update notebook_helpers.py

* Update notebook_helpers.py

* Update notebook_helpers.py

* updating helm version in script

Co-authored-by: rgsl888prabhu <[email protected]>
  • Loading branch information
Iroy30 and rgsl888prabhu authored Oct 20, 2022
1 parent 47f6619 commit f7fd166
Show file tree
Hide file tree
Showing 25 changed files with 1,212 additions and 1,291 deletions.
2 changes: 1 addition & 1 deletion cloud-scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ There are two ways to repair this:
$ export SERVER_TYPE=both # or jupyter, or api
$ helm list -n cuopt-server
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
nvidia-cuopt-chart cuopt-server 1 2022-09-19 14:11:45.677689124 +0000 UTC deployed cuopt-22.08.0 22.08.0
nvidia-cuopt-chart cuopt-server 1 2022-09-19 14:11:45.677689124 +0000 UTC deployed cuopt-22.10.0 22.10.0
$ helm uninstall nvidia-cuopt-chart -n cuopt-server
$ scripts/cuopt-helm.sh
$ scripts/wait-cuopt.sh
Expand Down
2 changes: 1 addition & 1 deletion cloud-scripts/scripts/cuopt-helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
NAMESPACE=cuopt-server
kubectl create namespace $NAMESPACE

helm fetch https://helm.ngc.nvidia.com/nvidia/cuopt/charts/cuopt-22.08.0.tgz --username='$oauthtoken' --password=$API_KEY --untar
helm fetch https://helm.ngc.nvidia.com/nvidia/cuopt/charts/cuopt-22.10.0.tgz --username='$oauthtoken' --password=$API_KEY --untar

case $SERVER_TYPE in
"jupyter")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
[18, 12, 0],
[25, 12, 0],
[30, 12, 0]],
"demand": [[0, 1, 1, 1, 1,
"demand": [[1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,14 @@ def _run_cuopt(self):
"max_lateness_per_route": None
}


# Preprocess network, fleet and task data
waypoint_graph_data, fleet_data, task_data = preprocess_cuopt_data(self._waypoint_graph_model,
self._orders_obj,
self._vehicles_obj)

cuopt_server = cuOptRunner(cuopt_url)

# Initialize server data and call for solve
cuopt_server.set_environment_data(waypoint_graph_data)
cuopt_server.set_fleet_data(fleet_data)
Expand All @@ -472,7 +473,7 @@ def show_vehicle_routes(routes):
for v_id, data in routes['vehicle_data'].items():
message = message + "For vehicle -" + str(v_id) + " route is: \n"
path = ""
route_ids = data["routes"]
route_ids = data["route"]
for index, route_id in enumerate(route_ids):
path += str(route_id)
if index != (len(route_ids) - 1):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

def preprocess_cuopt_data(graph, task, fleet):

waypoint_graph_data = {
waypoint_graph_data = {'waypoint_graph': {0:{
"offsets": graph.offsets,
"edges": graph.edges,
"weights": graph.weights,
}
"weights": graph.weights
}}}

fleet_data = {
"vehicle_locations": fleet.graph_locations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self,
def set_environment_data(self, opti_environment):

env_response = requests.post(
self.cuopt_url + f"set_waypoint_graph", params=self.data_parameters, json=opti_environment)
self.cuopt_url + f"set_cost_waypoint_graph", params=self.data_parameters, json=opti_environment)
print(f"\nwaypoint_graph ENDPOINT RESPONSE: {env_response.json()}\n")


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def display_routes(self, stage, graph, waypoint_graph_edge_path, routes):
vehicle_data = routes["vehicle_data"]
for i, v_id in enumerate(vehicle_data.keys()):
route_material = self.get_route_material(stage, i)
v_routes = vehicle_data[v_id]["routes"]
v_routes = vehicle_data[v_id]["route"]
for j in range(0, len(v_routes)-1):
edge_prim_path = f'{waypoint_graph_edge_path}/Edge_{v_routes[j]}_{v_routes[j+1]}'
edge_prim = stage.GetPrimAtPath(edge_prim_path)
Expand Down
11 changes: 8 additions & 3 deletions notebooks/routing/microservice/cost_matrix_creation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"metadata": {},
"outputs": [],
"source": [
"import cuopt\n",
"from cuopt import routing\n",
"from cuopt import distance_engine\n",
"import cudf\n",
"from scipy.spatial import distance\n",
Expand Down Expand Up @@ -244,7 +244,7 @@
},
"outputs": [],
"source": [
"waypoint_graph = cuopt.WaypointMatrix(\n",
"waypoint_graph = distance_engine.WaypointMatrix(\n",
" offsets,\n",
" edges,\n",
" weights\n",
Expand Down Expand Up @@ -383,7 +383,7 @@
},
{
"cell_type": "markdown",
"id": "9aad0a5d",
"id": "2dd04f7c",
"metadata": {},
"source": [
"_____\n",
Expand Down Expand Up @@ -430,6 +430,11 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
},
"vscode": {
"interpreter": {
"hash": "0f29e496949dc4ef652a1afa2d601ce2913fc84758b70efb060a954cb0e2d83f"
}
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit f7fd166

Please sign in to comment.