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 { ...@@ -135,8 +135,9 @@ func setupRun(mcPrm *McPrm, cprm *cprm) error {
return nil return nil
} }
// newx will move just one dimension at a time. Moving all dimensions at once // newx provides a random step to give us new coordinates.
// required teeny moves. // An earlier version moved all dimensions at once, but required
// teeny moves.
func newx(xold []float32, xT []float32, rand *rand.Rand, xDlta float64) { func newx(xold []float32, xT []float32, rand *rand.Rand, xDlta float64) {
var iDim int var iDim int
if (len(xold)) > 1 { if (len(xold)) > 1 {
...@@ -260,7 +261,7 @@ func DoRun(mcPrm *McPrm) (MCresult, error) { ...@@ -260,7 +261,7 @@ func DoRun(mcPrm *McPrm) (MCresult, error) {
for n := 0; n < mcPrm.NStep; n++ { for n := 0; n < mcPrm.NStep; n++ {
var accept bool var accept bool
if mcPrm.AdaptStep { if mcPrm.AdaptStep { // Are we trying adaptive steps ?
nRunAcc-- nRunAcc--
if nRunAcc == 0 { // Do we want to try adjusting the step size ? if nRunAcc == 0 { // Do we want to try adjusting the step size ?
xDlta = nRunAdj(mcPrm, n, runAcc, xDlta) xDlta = nRunAdj(mcPrm, n, runAcc, xDlta)
...@@ -303,7 +304,7 @@ func DoRun(mcPrm *McPrm) (MCresult, error) { ...@@ -303,7 +304,7 @@ func DoRun(mcPrm *McPrm) (MCresult, error) {
defer fmt.Println("n accepted:", nAcc, "of", mcPrm.NStep) defer fmt.Println("n accepted:", nAcc, "of", mcPrm.NStep)
if bestX != nil { 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 { } else {
defer fmt.Println("bestX was never initialised") defer fmt.Println("bestX was never initialised")
} }
......
...@@ -22,7 +22,7 @@ type genParams struct { ...@@ -22,7 +22,7 @@ type genParams struct {
chn chan workstatus // To tell the output tab current status 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 type status uint8
const ( const (
...@@ -57,6 +57,3 @@ func UiDoRun(mcPrm *mcwork.McPrm) error { ...@@ -57,6 +57,3 @@ func UiDoRun(mcPrm *mcwork.McPrm) error {
win.ShowAndRun() win.ShowAndRun()
return nil 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