Add compact string notation for SolverOptions

This commit is contained in:
Ettore Di Giacinto 2020-02-12 12:23:37 +01:00
parent b2a5de9222
commit d6f7c47eae
No known key found for this signature in database
GPG Key ID: 1ADA699B145A2D1C

View File

@ -50,12 +50,11 @@ type LuetGeneralConfig struct {
FatalWarns bool `mapstructure:"fatal_warnings"`
}
type ResolverType string
type LuetSolverOptions struct {
Type ResolverType `mapstructure:"type"`
LearnRate float32 `mapstructure:"rate"`
Discount float32 `mapstructure:"discount"`
MaxAttempts int `mapstructure:"max_attempts"`
Type string `mapstructure:"type"`
LearnRate float32 `mapstructure:"rate"`
Discount float32 `mapstructure:"discount"`
MaxAttempts int `mapstructure:"max_attempts"`
}
func (opts LuetSolverOptions) Resolver() solver.PackageResolver {
@ -71,6 +70,11 @@ func (opts LuetSolverOptions) Resolver() solver.PackageResolver {
return &solver.DummyPackageResolver{}
}
func (opts *LuetSolverOptions) CompactString() string {
return fmt.Sprintf("type: %s rate: %f, discount: %f, attempts: %d, initialobserved: %d",
opts.Type, opts.LearnRate, opts.Discount, opts.MaxAttempts, 999999)
}
type LuetSystemConfig struct {
DatabaseEngine string `yaml:"database_engine" mapstructure:"database_engine"`
DatabasePath string `yaml:"database_path" mapstructure:"database_path"`