math-optim/algo/stochasticHillClimbing.go

29 lines
542 B
Go
Raw Normal View History

2022-06-14 22:34:52 +02:00
// Copyright 2022 wanderer <a_mirre at utb dot cz>
// SPDX-License-Identifier: GPL-3.0-or-later
package algo
import (
"fmt"
"os"
)
func getSHCLogPrefix() string {
return " ***  stochastic hill climbing:"
}
func fmtSHCOut(input string) string {
return getSHCLogPrefix() + " " + input
}
func printSHC(input string) {
if _, err := fmt.Fprintln(os.Stderr, fmtSHCOut(input)); err != nil {
fmt.Fprintf(
os.Stdout,
getSHCLogPrefix(),
"error while printing to stderr: %q\n * original message was: %q",
err, input,
)
}
2022-06-14 22:34:52 +02:00
}