This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from numpy import np | |
| import random | |
| class GeneticAlgorithm: | |
| def __init__(self, createIndividual, mutateIndividual, fitnessFunction, crossoverFunction, population_size=1000, crossoverProb=0.6, mutateProb=0.4, alpha=0.5): | |
| self.create = createIndividual | |
| self.mutate = mutateIndividual | |
| self.fitness = fitnessFunction | |
| self.populationSize = population_size |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Tabu Search Class | |
| """ | |
| class TabuSearch: | |
| def __init__(self, initialSolution, solutionEvaluator, neighborOperator, aspirationCriteria, acceptableScoreThreshold, tabuTenure): | |
| self.currSolution = initialSolution | |
| self.bestSolution = initialSolution | |
| self.evaluate = solutionEvaluator | |
| self.aspirationCriteria = aspirationCriteria | |
| self.neighborOperator = neighborOperator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Simulated Annealing Class | |
| """ | |
| import random | |
| import math | |
| class SimulatedAnnealing: | |
| def __init__(self, initialSolution, solutionEvaluator, initialTemp, finalTemp, tempReduction, neighborOperator, iterationPerTemp=100, alpha=10, beta=5): | |
| self.solution = initialSolution | |
| self.evaluate = solutionEvaluator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| t = 10 | |
| # compute kalman filter over t iterations | |
| for k in range(1, len(t)): # Start at 1 because we have initial prediction from ground truth. | |
| delta_t = t[k] - t[k - 1] # time step (difference between timestamps) | |
| px = np.cos(x_est[k-1][2]) | |
| py = np.sin(x_est[k-1][2]) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| input_angles = [0, np.pi/2, np.pi, (3/2) * np.pi, 2 * np.pi] | |
| print('Input: ', input_angles) | |
| sin_output = np.sin(input_angles) | |
| cos_output = np.cos(input_angles) | |
| print('Sine values: ', sin_output) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "Simulation.h" | |
| #include "Constants.h" | |
| #include "Particle.h" | |
| #include <cassert> | |
| #include <cmath> | |
| #include <fstream> | |
| #include <iostream> | |
| #include <sstream> | |
| #include <string> |