simulated-annealing

TSP, algorithm gets stuck in local minimum

旧街凉风 提交于 2019-12-10 10:09:53
问题 I am struggling to implement a program based on simulated annealing to solve the traveling salesman problem. All solutions I got are not satisfying and i have no clue how to improve my implementation. Obviously I'm not focusing on benchmarks, but only on finding the visually acceptable shortest path. If anyone might enlighten me I would be thankful. # weight function, simple euclidean norm def road(X,Y): sum = 0 size = len(X) -1 for i in range(0,size): sum +=math.sqrt((X[i]-X[i+1])**2 + (Y[i]

What's the fastest heuristic algorithm to split students into groups?

…衆ロ難τιáo~ 提交于 2019-12-07 07:16:31
问题 I have X number of students, where X is a multiple of 6. I now want to split up the students into groups of 6. I have a function that measures how "good" a group of 6 is (lets say it's a black box that runs in constant time for now). By splitting up the students, and then calling my function on each group to measure it's goodness, and then summing up the goodness of each group, I'm able to measure how "good" a certain set of groups is. I'm trying to create an algorithm that will group the

Writing Simulated Annealing algorithm for 0-1 knapsack in C#

天涯浪子 提交于 2019-12-06 06:36:56
问题 I'm in the process of learning about simulated annealing algorithms and have a few questions on how I would modify an example algorithm to solve a 0-1 knapsack problem. I found this great code on CP: http://www.codeproject.com/KB/recipes/simulatedAnnealingTSP.aspx I'm pretty sure I understand how it all works now (except the whole Bolzman condition, as far as I'm concerned is black magic, though I understand about escaping local optimums and apparently this does exactly that). I'd like to re

Graph Coloring with using Simulated Annealing

こ雲淡風輕ζ 提交于 2019-12-06 05:34:31
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 Setting the starting temperature and cooling scheduling parameters correctly is a pain, because you need to have a good value for both before you get a good

How to design acceptance probability function for simulated annealing with multiple distinct costs?

孤街浪徒 提交于 2019-12-05 21:43:36
问题 I am using simulated annealing to solve an NP-complete resource scheduling problem. For each candidate ordering of the tasks I compute several different costs (or energy values). Some examples are (though the specifics are probably irrelevant to the question): global_finish_time : The total number of days that the schedule spans. split_cost : The number of days by which each task is delayed due to interruptions by other tasks (this is meant to discourage interruption of a task once it has

What's the fastest heuristic algorithm to split students into groups?

a 夏天 提交于 2019-12-05 13:47:16
I have X number of students, where X is a multiple of 6. I now want to split up the students into groups of 6. I have a function that measures how "good" a group of 6 is (lets say it's a black box that runs in constant time for now). By splitting up the students, and then calling my function on each group to measure it's goodness, and then summing up the goodness of each group, I'm able to measure how "good" a certain set of groups is. I'm trying to create an algorithm that will group the students in a way so that the total goodness of all the groups is maximized, and no group has an

Writing Simulated Annealing algorithm for 0-1 knapsack in C#

Deadly 提交于 2019-12-04 13:45:35
I'm in the process of learning about simulated annealing algorithms and have a few questions on how I would modify an example algorithm to solve a 0-1 knapsack problem. I found this great code on CP: http://www.codeproject.com/KB/recipes/simulatedAnnealingTSP.aspx I'm pretty sure I understand how it all works now (except the whole Bolzman condition, as far as I'm concerned is black magic, though I understand about escaping local optimums and apparently this does exactly that). I'd like to re-design this to solve a 0-1 knapsack-"ish" problem. Basically I'm putting one of 5,000 objects in 10

Discrete optimzation in python

时间秒杀一切 提交于 2019-12-04 03:08:04
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$ I've checked scipy.optimize.anneal, and I can't see a way to use discrete values. The way to implement it yourself, is to create a custom "move" function, but the

How to put mathematical constraints with GenSA function in R

夙愿已清 提交于 2019-11-29 15:41:38
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 rely on the GenSA function, I would like to use something like this with the constraint : v <- c(0.25,

Simulated Annealing TSP

六月ゝ 毕业季﹏ 提交于 2019-11-29 11:27:30
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 gradually cooling throughout. Whilst the temperature is high the algorithm is more likely to choose