Community Tip - You can change your system assigned username to something more personal in your community settings. X
Hello everyone,
I am attempting to perform the optimal transportation problema with simulated annealing, but I cannot do the initial approach correctly.
Can anybody shed light on this procedure?
CarlosRomero
Solved! Go to Solution.
I can't be bothered implementing the annealing algorithm in Mathcad, but here is how I would do it using a solve block with minimize().
I am not sure what the exact question/problem is.
Haven't looked i n detail at your sheet.
Maybe the sheet posted by Richard Jackson can be of help -> Minimizing a Function using Simulated Annealing - PTC Community
Hola Werner,
I am attempting to determine optimal transport program, so that total transport expenses would be minimal.
I want to use simulated annealing to minimize. The theory of the optimal transportation program is attached in the pdf document.
The data being applied is presented in the image.
Any help you can give me will be greatly appreciated.
CarlosRomero
I can't be bothered implementing the annealing algorithm in Mathcad, but here is how I would do it using a solve block with minimize().
Good work Werner.
If you get a minute please, could you implement the development of this problem with simulated annealing?
Thanks.
CarlosRomero
@CarlosRomero wrote:
Good work Werner.
If you get a minute please, could you implement the development of this problem with simulated annealing?
Thanks.
CarlosRomero
Unfortunately no, because it sure would take me much more than just a minute to make me acquainted with the algorithm and implement it.
I had never dealt with that algorithm and also did not dig into Richards worksheet, so I can't advice what you would have to modify to make it work for your problem. Especially how to add the additional constraints for the row and column sums. Without these constraints the algorithm will approach an all zero matrix as it seems to be in your sheet where you tried to use Richards implementation of the algorithm.
You would have to ensure by some means that each new candidate fulfills these additional constraints and maybe it would be a good idea to ensure that all values are integers (not sure about this, though).
Looks like you have quite some work to do ...
Couldn't resist and played around with Richards annealing function.
I used this objective function
vec2mat is a function which converts a 9x1 vector as used in Richards routine to the 3x3 matrix used in my already written functions.
The results are not overwhelming
or
Guess that if you insist on using the annealing algorithm, you will have to write your own implementation of it specifically trimmed to tasks like the one you try to solve.
Thank you Werner.
Good work and extremely useful and informative.
CarlosRomero
Hello Werner
I have implemented the codes from your answers into the annealed simulated algorithm.
I used StuartBruff's vec2mat program and it doesn't seem to work.
Could you help me where the error is?
Thank you.
CarlosRomero
you typed vex2mat instead of vec2mat
and you typed totalCost when you defined the function, but totalCosts when you used it at the end.
Furthermore you must increase the vector with the max values as otherwise the constraint with the columns and rows sums can't be fulfilled.
A vector with the theretically max values is
The vector I used in my sheet was less sophisticated and consisted of all values being 850, the max of the row and column sums vectors s and d.
Furthermore you should add a check if the constraints with the row and column sums being s and d is fulfilled. As I added these constraints a part of the objective function, there is no guarantee that these constraints are perfectly fulfilled even though I weighted them with 10^3 to get a value around the magnitude of the totalCosts. Play around with decreasing and increasing the weight value. If you decrease it, chances are higher that the row and column sums don't match, if you increase it, the total Costs are less considered.
I attach the file I used.
Thanks again Werner, and I will so happy to see your posts for the future concerns with Mathcad.
Best Regards,
CarlosRomero.