From ed379af7248019d2ecb0409cbe869f11672d3fac Mon Sep 17 00:00:00 2001 From: BlackHat <74679492+TheManWhoLikesToCode@users.noreply.github.com> Date: Sun, 29 Jan 2023 04:04:29 -0500 Subject: [PATCH] Update Challenge_One.ipynb --- Challenge_One.ipynb | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/Challenge_One.ipynb b/Challenge_One.ipynb index 0c466ab..e9fa2b2 100644 --- a/Challenge_One.ipynb +++ b/Challenge_One.ipynb @@ -312,7 +312,17 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The Nelder–Mead method (also downhill simplex method, amoeba method, or polytope method) is a numerical method used to find the minimum or maximum of an objective function in a multidimensional space. It is a direct search method (based on function comparison) and is often applied to nonlinear optimization problems for which derivatives may not be known. However, the Nelder–Mead technique is a heuristic search method that can converge to non-stationary points[1] on problems that can be solved by alternative methods" + "The Nelder-Mead method is a direct search method that utilizes function comparison to find the minimum or maximum of an objective function. Unlike other optimization techniques, the Nelder-Mead method does not require knowledge of the function's derivatives, making it particularly useful for nonlinear optimization problems such as this one. However, it is important to note that the Nelder-Mead technique is a heuristic search method, which means that it may converge to non-stationary points on some problems that can be solved by alternative methods. This means that the algorithm may not always find the global optimum but it is a good choice for getting a good approximate solution.\n", + "\n", + "The Nelder-Mead method algorithm works by\n", + "\n", + "* Initialize a simplex in the parameter space, which is a set of n+1 points where n is the number of parameters. These points represent different configurations of the graph.\n", + "* Evaluate the objective function (i.e. cut size) at each point in the simplex.\n", + "* Identify the point with the highest objective function value (worst point) and the point with the second-highest value (second worst point).\n", + "* Reflect the worst point about the centroid of the remaining points to create a new point.\n", + "* If the new point is better than the second worst point, expand the simplex by moving the new point farther away from the centroid.\n", + "* If the new point is worse than the second worst point, contract the simplex by moving the new point closer to the centroid.\n", + "* Repeat steps 2-6 for a fixed number of iterations or until a stopping criterion is met." ] }, { @@ -378,9 +388,18 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Uses the basinhopping function from scipy.optimize, which is an implementation of simulated annealing. This function takes an initial set of angles, and applies small random perturbations to them in order to explore the parameter space. It then calls the max_cut_cost_hamiltonian function, which in turn calls the qaoa_instance function to evaluate the energy of the output state. The basinhopping function will then return the set of angles that results in the highest energy.\n", + "The quantum basin hopping algorithm is a powerful tool for global optimization, utilizing a combination of simulated annealing and Grover's algorithm to efficiently locate the optimal solution. The algorithm begins by randomly selecting an initial position in the search space and applying small, random perturbations to explore the parameter space. The energy or cost function is evaluated at each new candidate position, and the algorithm moves to the position with the highest energy. However, there is a probability of accepting a lower energy position based on the temperature parameter, which gradually decreases as the algorithm progresses to increase the likelihood of accepting only higher energy states. This iterative process continues until a stopping criterion is met, resulting in the global minimum of the function.\n", + "\n", + "The Basin hopping algorithm works by\n", "\n", - "\"The quantum basin hopping algorithm for continuous global optimisation combines a local search with Grover’s algorithm, and can locate the global optimum using effort proportional to the square root of the number of basins.\"" + "* Initialize the current position x to a random point in the search space\n", + "* Generate a new candidate position x' by perturbing x using a random displacement\n", + "* Calculate the energy or cost function E(x) at x and E(x') at x'\n", + "* If E(x') is less than E(x), move to the new position x'\n", + "* If E(x') is greater than E(x), move to the new position with probability P = exp(-(E(x')-E(x))/T)\n", + "* Repeat steps 2-5 for a fixed number of iterations or until a stopping criterion is met\n", + "* The final position is the global minimum of the function\n", + "* where T is the temperature parameter which controls the probability of accepting a higher energy state. As the algorithm progresses, the temperature is gradually decreased to increase the * * * likelihood of accepting only lower energy states." ] }, {