Skip to content
Snippets Groups Projects
Commit 5adfe70b authored by Andrew E. Torda's avatar Andrew E. Torda
Browse files

comments and cleaning

parent 61f9235b
No related branches found
No related tags found
No related merge requests found
......@@ -135,8 +135,9 @@ func setupRun(mcPrm *McPrm, cprm *cprm) error {
return nil
}
// newx will move just one dimension at a time. Moving all dimensions at once
// required teeny moves.
// newx provides a random step to give us new coordinates.
// An earlier version moved all dimensions at once, but required
// teeny moves.
func newx(xold []float32, xT []float32, rand *rand.Rand, xDlta float64) {
var iDim int
if (len(xold)) > 1 {
......@@ -260,7 +261,7 @@ func DoRun(mcPrm *McPrm) (MCresult, error) {
for n := 0; n < mcPrm.NStep; n++ {
var accept bool
if mcPrm.AdaptStep {
if mcPrm.AdaptStep { // Are we trying adaptive steps ?
nRunAcc--
if nRunAcc == 0 { // Do we want to try adjusting the step size ?
xDlta = nRunAdj(mcPrm, n, runAcc, xDlta)
......@@ -303,7 +304,7 @@ func DoRun(mcPrm *McPrm) (MCresult, error) {
defer fmt.Println("n accepted:", nAcc, "of", mcPrm.NStep)
if bestX != nil {
defer fmt.Printf("Best function value: %.2f at %.2v\n", bestfval, bestX)
defer fmt.Printf("Best function value: %.2f at %.2v at step %d\n", bestfval, bestX, bestN)
} else {
defer fmt.Println("bestX was never initialised")
}
......
......@@ -22,7 +22,7 @@ type genParams struct {
chn chan workstatus // To tell the output tab current status
}
// We have a channel that sends the status to the output tab.
// We have a channel used to tell the output tab that there are new results.
type status uint8
const (
......@@ -57,6 +57,3 @@ func UiDoRun(mcPrm *mcwork.McPrm) error {
win.ShowAndRun()
return nil
}
func nothing(...interface{}) {}
func breaker(...interface{}) {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment