simulated-annealing

How to use simulated annealing for a function with discrete paremeters?

北战南征 提交于 2021-02-08 06:52:21
问题 Quoting Wikipedia article about simulated annealing: It is often used when the search space is discrete (e.g., all tours that visit a given set of cities). As far as I'm aware the R version of simulated annealing is provided by the package GenSA , https://cran.r-project.org/web/packages/GenSA/GenSA.pdf . And yet I can find nothing in the linked docu about discrete parameters; the docs seem to assume continuous parameters (as there is no way to pass step!) Is there any way to use simulated

How to use simulated annealing for a function with discrete paremeters?

不打扰是莪最后的温柔 提交于 2021-02-08 06:51:15
问题 Quoting Wikipedia article about simulated annealing: It is often used when the search space is discrete (e.g., all tours that visit a given set of cities). As far as I'm aware the R version of simulated annealing is provided by the package GenSA , https://cran.r-project.org/web/packages/GenSA/GenSA.pdf . And yet I can find nothing in the linked docu about discrete parameters; the docs seem to assume continuous parameters (as there is no way to pass step!) Is there any way to use simulated

Simulated Annealing TSP

限于喜欢 提交于 2020-01-20 05:09:42
问题 I'm looking to implement the simulated annealing algorithm in Java to find an optimal route for the Travelling Salesman Problem, so far I have implemented brute force and am looking to modify that code in order to use simulated annealing. Obviously brute-force and simulated annealing are very different and use very different functions. I understand simulated annealing uses a variable known as the temperature which then cools as the algorithm runs; with the temperature starting high and it

Discrete optimzation in python

守給你的承諾、 提交于 2020-01-01 08:53:33
问题 I am trying to use the scipy.optimize package to optimize a discrete optimization problem (global optimization). Acc to the doc, simulated annealing implemented in scipy.optimize.anneal should be a good choice for the same. But I am not sure how to force the optimizer to search only integer values of the search space. Can someone help? An illustrative example: f(x1,x2) = (1-0.4*x1)^2 + 100*(0.6*x2 -0.4*x1^2)^2 where, $x1, x2 \in I$ 回答1: I've checked scipy.optimize.anneal, and I can't see a

How to efficiently select neighbour in 1-dimensional and n-dimensional space for Simulated Annealing

岁酱吖の 提交于 2019-12-23 19:50:54
问题 I would like to use Simulated Annealing to find local minimum of single variable Polynomial function, within some predefined interval. I would also like to try and find Global minimum of Quadratic function. Derivative-free algorithm such as this is not the best way to tackle the problem, so this is only for study purposes. While the algorithm itself is pretty straight-forward, i am not sure how to efficiently select neighbor in single or n-dimensional space. Lets say that i am looking for

Graph Coloring with using Simulated Annealing

浪尽此生 提交于 2019-12-22 13:58:51
问题 I am trying to come up with the algorithm for a Graph Coloring problem using Simulated Annealing. There is the general algorithm online, but when i look at it, I couldn't understand how can apply this algorithm on this problem. Each node in graph must had diffrent color from it's neibours. How can I use the Simulated annealing algorithm for this. What is the "temperature", "schedule" in this problem? Please help me understand this. Thanks 回答1: Setting the starting temperature and cooling

How to put mathematical constraints with GenSA function in R

旧街凉风 提交于 2019-12-18 08:55:07
问题 I am currently trying to use Simulated Annealing package GenSA in order to minimize the function below : efficientFunction <- function(v) { t(v) %*% Cov_Mat %*% v } Where Cov_Mat is a covariance matrix obtained from 4 assets and v is a weight vector of dimension 4. I'm trying to solve the Markowitz asset allocation approach this way and I would like to know how I could introduce mathematical constraint such as the sum of all coefficients have to equal 1 : sum(v) = 1 Moreover since I intend to

Algorithm to avoid obvious costly combinations when splitting n values to m groups

梦想与她 提交于 2019-12-13 05:13:01
问题 I have 7 values and I need to split them into 5 groups. Each group should contain atleast one value. There are 15 ways to group those values into 5. Mon- 13 Tue- 5 Wed- 4 Thu- 4 Fri- 11 Sat- 2 Sun- 1 When grouping, ordering of Mon, Tue, Wed, Thu, Fri, Sat, Sun should be preserved. Suppose there is a function which decides how good a grouping is. 13, 5, 4, 4, 11, 2, 1 Function Grouping 1 - 13, 5, [4,4], 11, [2,1] 13 added, 13 withdrawn, 0 remaining 5 added, 5 withdrawn, 0 remaining [4,4] added

Trouble with copying dictionaries and using deepcopy on an SQLAlchemy ORM object

无人久伴 提交于 2019-12-12 02:22:41
问题 I'm doing a Simulated Annealing algorithm to optimise a given allocation of students and projects. This is language-agnostic pseudocode from Wikipedia: s ← s0; e ← E(s) // Initial state, energy. sbest ← s; ebest ← e // Initial "best" solution k ← 0 // Energy evaluation count. while k < kmax and e > emax // While time left & not good enough: snew ← neighbour(s) // Pick some neighbour. enew ← E(snew) // Compute its energy. if enew < ebest then // Is this a new best? sbest ← snew; ebest ← enew /

How to effectively solve a compound cost function optimisation problem?

一笑奈何 提交于 2019-12-11 15:45:58
问题 I want to solve the following optimization problem with Python: I have a black box function f with multiple variables as input. The execution of the black box function is quite time consuming, therefore I would like to avoid a brute force approach. I would like to find the optimum input parameters for that black box function f . In the following, for simplicity I just write the dependency for one dimension x . An optimum parameter x is defined as: the cost function cost(x) is maximized with