Skip to content
Snippets Groups Projects
Select Git revision
  • 2ff8fb487f7dbb6af3e2285f72f323fed70c6bcf
  • master default protected
  • devel
  • adaptive_step_size
4 results

ackley_mc

  • Clone with SSH
  • Clone with HTTPS
  • user avatar
    Andrew E. Torda authored
    Behaviour changed. If final_temp is not specified, it is set to the same as ini_temp. This is consistent with the Uebung description.
    2ff8fb48
    History

    Monte Carlo / Simulated Annealing for Ackleys function

    Given Ackleys function in n dimensions and some arbitrary starting point, run a Monte Carlo / simulated annealing calculation to find an optimum.. or maybe not. That is the point. You can play with things like the temperature to see when the system converges and when it behaves badly.

    Install and run

    I do not have a mac for testing, so this is limited to linux and windows. It is possible that the instructions for linux are helpful for a mac. We can cross compile for a Mac, but not with graphics. The makefile is useful to me under linux. It makes a pile of binaries and sticks them in the bin directory.

    Prerequisites

    • You must have go installed. I have only tried with go back to version 1.16. It probably builds with earlier versions. It requires support for go.mod.
    • You need a C compiler for the graphics.
    • cross compiling is easy without graphics, but not much fun if you want graphics.
    • native compilation under windows is painless

    Build

    git clone git@gitlab.rrz.uni-hamburg.de:Bae5157/ackley_mc.git
    cd ackley_mc
    go build .

    and you should end up with an executable called ackley_mc or ackley_mc.exe under windows. To build without graphics,

    git clone git@gitlab.rrz.uni-hamburg.de:Bae5157/ackley_mc.git
    cd ackley_mc
    go build .

    Graphics yes / no ?

    The graphical interface makes it convenient to play with parameters. You can quickly see what happens if you raise the initial temperature by a factor of 10. The graphical interface does not make beautiful plots. One can export the data and plot it with gnuplot/excel/R/whatever.

    Binaries

    Binaries for linux and windows are linked to from the moodle page. If you download a linux binary, you will have to chmod +x ackley_mc to make it executable.

    Documentation

    The real documentation is in go doc format.

    Plotting output

    This is in csv format. For gnuplot, do not forget to set datafile separator ','.

    BUGS

    The UI toolkit is "fyne". It does not do charts, so we use go-chart which makes a png, which we can store in memory and feed to the fyne toolkit. Unfortunately, an svg file from go-chart causes fyne to choke. This means we are stuck with png. One day, one should try out the charting library which is based on fyne.

    The graphical interface follows no known style convention and looks like it was designed by a three-year old.

    Still have not implemented parallel runs, but given the emphasis on the quick graphics, this may not be appropriate.