The optimization is done via the gradient-free Nelder-Mead method (aka Downhill Simplex algorithm). The code is specified for simulating soil cutting operations (e.g. excavation).
|- run.py
| - constr_nm.py
| - nelder_mead.py
| - obj_func.py
| - input/
| - ref.py
| - plot.py
| - output/
|- test.py
-
run.py
: Runs the optimization.-
The initial, lower and upper bounds of optimization variables are defined here.
X0 = [,] LB = [,] UB = [,]
-
Some other settings including loading/saving optimal solution, and excavation depth and time can also be set.
load = True/False save = True/False depths = [,] # [m] sim_times = [,] # [sec]
-
-
constr_nm.py
: Implements the constrained Nelder-Mead method (reference). -
nelder_mead.py
: Implements the Nelder-Mead method (reference).-
This is modified to terminate the optimization loop when no significant error changes happen (e.g.
<1
%) during the last specified iterations by setting e.g.history = 10
as fallows:if iterations > history+2: for i in range(2,history+2): fval_sum += abs(fval_history[-1] - fval_history[-i]) if fval_sum/history < 1: break
-
-
obj_func.py
: Implements the objective function.-
The Vortex (excavation) model is called here and implemented in:
def run_vortex(self, x, depth): ...
-
The mean absolute percentage error (MAPE) is calculated using the results from Vortex and experiment.
-
The Vortex files and reference (experimental) results should already be provided in folder
input/
.
-
-
ref.py
: Reads reference (experimental) results from the files provided ininput/
. -
plot.py
: Plots MAPE versus number of function evaluations, and save in folderoutput/
. -
test.py
: Tests the Vortex (excavation) model via the optimal solution and saves the results.
- VxSim
- numpy
- pickle