6.2. Assignment (lab06)#
This ungraded assignment is a collection of 10 engineering problems that can be solved by optimization. In order to understand and solve the exercises, and more generally to gain the maximum benefit from this assignment, it is highly recommended that you revise Chapter 4 and Chapter 5.
6.2.1. Content#
Activity |
Topic |
Difficulty |
---|---|---|
Travel time |
Easy |
|
Facility location |
Easy |
|
Area fencing |
Easy |
|
Topless box |
Easy |
|
— |
||
Distance between polygons |
Medium |
|
Shortest path |
Medium |
|
Trilateration |
Medium |
|
— |
||
Resection |
Hard |
|
Inscribed circle |
Hard |
|
Optimal trajectory |
Hard |
6.2.2. Required packages#
For this assignment, you need to import the following packages.
Numpy - The library for scientific computing in Python.
Matplotlib - The library for plotting graphs in Python.
Autograd - The library for automatic differentiation of Numpy code.
Installation: Open the terminal (‘Anaconda Prompt’ on Windows) and execute the following command.
pip install autograd
Add the flag --user
for a local installation (only if you are not the admin).
6.2.3. Autograd caveats#
Not all the NumPy features can be used with Autograd. Here is the list of operations that you must avoid inside your cost functions.
Don’t use assignment to arrays
A[0,0] = x
,A[:,1] = y
, …
Create new arrays through vectorized operations!
Don’t create lists
w = [x, y]
Create new arrays:
w = np.array([x, y])
Don’t implicitly cast lists to arrays
A = np.sum([x, y])
Use explicit casts:
A = np.sum(np.array([x, y]))
Don’t use in-place operations such as
a += b
Use binary opertions:
a = a + b
Don’t use the operation
A.dot(B)
Use the operation:
A @ B
Never execute the line
import numpy as np
Use the line:
import autograd.numpy as np