Skip to content

Instantly share code, notes, and snippets.

@hyunjimoon
Created April 19, 2024 16:46
Show Gist options
  • Save hyunjimoon/f918d549bf4c42898ca9bd80a0c68ad3 to your computer and use it in GitHub Desktop.
Save hyunjimoon/f918d549bf4c42898ca9bd80a0c68ad3 to your computer and use it in GitHub Desktop.
emergency_response
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# Constants
x1, x2, y1, y2 = 1, 3, 2, 4
# Grid of x, y points
x = np.linspace(0, 5, 400)
y = np.linspace(0, 5, 400)
X, Y = np.meshgrid(x, y)
Z = np.maximum(np.abs(X - x1) + np.abs(X - x2), np.abs(Y - y1) + np.abs(Y - y2))
# Plot
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(X, Y, Z, cmap='viridis')
# Labels
ax.set_xlabel('X coordinate')
ax.set_ylabel('Y coordinate')
ax.set_zlabel('Z value')
plt.show()
@hyunjimoon
Copy link
Author

hyunjimoon commented Apr 19, 2024

output

@hyunjimoon
Copy link
Author

hyunjimoon commented Apr 19, 2024

Angie shared graphical solution of the emergency response (last page from L19. Linear programming I ) to Cathy who asked to share the diagram.

Screenshot 2024-04-19 at 12 50 00 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment