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
|
|
|
|
}
|
|
|
|
|
2022-06-17 19:55:23 +02:00
|
|
|
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
|
|
|
}
|