Documentation ¶
Index ¶
- Constants
- func AddCriterionToAlternatives(alternatives *[]AlternativeWithCriteria, newCriterion *Criterion, ...) *[]AlternativeWithCriteria
- func CopyAlternatives(alternatives *[]AlternativeWithCriteria) *[]AlternativeWithCriteria
- func CriteriaValuesRange(alternatives *[]AlternativeWithCriteria, criterion *Criterion) *utils.ValueRange
- func FetchAlternatives(a *[]AlternativeWithCriteria, ids *[]Alternative) *[]AlternativeWithCriteria
- func GetNormalScaleRatio(currentRange *utils.ValueRange) float64
- func GetScaleRatio(target *utils.ValueRange, currentRange *utils.ValueRange) float64
- func IsStringBlank(str *string) bool
- func PreserveCriteriaForAlternatives(alternatives *[]AlternativeWithCriteria, criteria *Criteria) *[]AlternativeWithCriteria
- func ShuffleAlternatives(alternatives *[]AlternativeWithCriteria, generator utils.ValueGenerator) *[]AlternativeWithCriteria
- func SortAlternativesByName(alternatives *[]AlternativeWithCriteria) *[]AlternativeWithCriteria
- func UpdateAlternatives(old *[]AlternativeWithCriteria, newOnes *[]AlternativeWithCriteria) *[]AlternativeWithCriteria
- func ValuesRangeWithGroundZero(alternatives *[]AlternativeWithCriteria, criterion *Criterion) *utils.ValueRange
- func WeightsParamOnly() interface{}
- type AddedCriterionParams
- type Alternative
- type AlternativeResult
- type AlternativeResults
- type AlternativeWeightFunction
- type AlternativeWithCriteria
- func FetchAlternative(a *[]AlternativeWithCriteria, id Alternative) AlternativeWithCriteria
- func RemoveAlternative(alternatives []AlternativeWithCriteria, alternative AlternativeWithCriteria) []AlternativeWithCriteria
- func RemoveAlternativeAt(alternatives []AlternativeWithCriteria, index int) []AlternativeWithCriteria
- func (a *AlternativeWithCriteria) CriterionRawValue(criterion *Criterion) Weight
- func (a *AlternativeWithCriteria) CriterionValue(criterion *Criterion) Weight
- func (a *AlternativeWithCriteria) String() string
- func (a *AlternativeWithCriteria) WithCriteriaOnly(criteria *Criteria) *AlternativeWithCriteria
- func (a *AlternativeWithCriteria) WithCriteriaValues(criteriaValues *Weights) *AlternativeWithCriteria
- func (a *AlternativeWithCriteria) WithCriterion(name string, value Weight) *AlternativeWithCriteria
- type Alternatives
- type AlternativesRankEntry
- type AlternativesRanking
- type Bias
- type BiasListener
- type BiasListeners
- type BiasMap
- type BiasParams
- type BiasProps
- type BiasWithProps
- type BiasedResult
- type Biases
- type BiasesParams
- type BiasesWithProps
- type Criteria
- func (c *Criteria) Add(criterion *Criterion) Criteria
- func (c *Criteria) FindWeight(weights *Weights, criterion *Criterion) Weight
- func (c *Criteria) First() Criterion
- func (c *Criteria) Get(index int) utils.Identifiable
- func (c *Criteria) Len() int
- func (c *Criteria) Names() *[]string
- func (c *Criteria) NotUsedName(name string) string
- func (c *Criteria) ShallowCopy() *Criteria
- func (c *Criteria) SortByWeights(weights Weights) *WeightedCriteria
- func (c *Criteria) Validate()
- func (c *Criteria) Weight(weights Weights, criterionIndex int) Weight
- func (c *Criteria) ZipWithWeights(weights *Weights) *WeightedCriteria
- type CriteriaRanker
- type Criterion
- type CriterionAdder
- type CriterionRemover
- type CriterionType
- type DecisionMaker
- func (dm *DecisionMaker) Alternative(id Alternative) AlternativeWithCriteria
- func (dm *DecisionMaker) AlternativesToConsider() *[]AlternativeWithCriteria
- func (dm *DecisionMaker) MakeDecision(preferenceFunctions PreferenceFunctions, biasListeners BiasListeners, ...) *DecisionMakerChoice
- func (dm *DecisionMaker) NotConsideredAlternatives() *[]AlternativeWithCriteria
- type DecisionMakerChoice
- type DecisionMakingParams
- type EvaluationSingleValue
- type MethodParameters
- type MethodParametersMerger
- type PreferenceFunction
- type PreferenceFunctions
- type RawMethodParameters
- type Weight
- type WeightType
- type WeightedCriteria
- type WeightedCriterion
- type Weights
Constants ¶
View Source
const WeightsParam = "weights"
Variables ¶
This section is empty.
Functions ¶
func AddCriterionToAlternatives ¶
func AddCriterionToAlternatives( alternatives *[]AlternativeWithCriteria, newCriterion *Criterion, valueProvider func(alt *AlternativeWithCriteria) Weight, ) *[]AlternativeWithCriteria
func CopyAlternatives ¶
func CopyAlternatives(alternatives *[]AlternativeWithCriteria) *[]AlternativeWithCriteria
func CriteriaValuesRange ¶
func CriteriaValuesRange(alternatives *[]AlternativeWithCriteria, criterion *Criterion) *utils.ValueRange
func FetchAlternatives ¶
func FetchAlternatives(a *[]AlternativeWithCriteria, ids *[]Alternative) *[]AlternativeWithCriteria
func GetNormalScaleRatio ¶
func GetNormalScaleRatio(currentRange *utils.ValueRange) float64
func GetScaleRatio ¶
func GetScaleRatio(target *utils.ValueRange, currentRange *utils.ValueRange) float64
func IsStringBlank ¶
func PreserveCriteriaForAlternatives ¶
func PreserveCriteriaForAlternatives(alternatives *[]AlternativeWithCriteria, criteria *Criteria) *[]AlternativeWithCriteria
func ShuffleAlternatives ¶
func ShuffleAlternatives(alternatives *[]AlternativeWithCriteria, generator utils.ValueGenerator) *[]AlternativeWithCriteria
func SortAlternativesByName ¶
func SortAlternativesByName(alternatives *[]AlternativeWithCriteria) *[]AlternativeWithCriteria
func UpdateAlternatives ¶
func UpdateAlternatives(old *[]AlternativeWithCriteria, newOnes *[]AlternativeWithCriteria) *[]AlternativeWithCriteria
func ValuesRangeWithGroundZero ¶
func ValuesRangeWithGroundZero(alternatives *[]AlternativeWithCriteria, criterion *Criterion) *utils.ValueRange
func WeightsParamOnly ¶
func WeightsParamOnly() interface{}
Types ¶
type AddedCriterionParams ¶
type AddedCriterionParams = MethodParameters
type Alternative ¶
type Alternative = string
type AlternativeResult ¶
type AlternativeResult struct { Alternative AlternativeWithCriteria `json:"alternative"` Evaluation interface{} `json:"evaluation"` }
func ValueAlternativeResult ¶
func ValueAlternativeResult(alternative *AlternativeWithCriteria, value float64) *AlternativeResult
func (*AlternativeResult) Identifier ¶
func (a *AlternativeResult) Identifier() string
func (*AlternativeResult) String ¶
func (a *AlternativeResult) String() string
func (*AlternativeResult) Value ¶
func (a *AlternativeResult) Value() float64
type AlternativeResults ¶
type AlternativeResults []AlternativeResult
func (*AlternativeResults) Len ¶
func (a *AlternativeResults) Len() int
func (*AlternativeResults) Less ¶
func (a *AlternativeResults) Less(i, j int) bool
func (*AlternativeResults) Ranking ¶
func (a *AlternativeResults) Ranking() *AlternativesRanking
func (*AlternativeResults) Swap ¶
func (a *AlternativeResults) Swap(i, j int)
type AlternativeWeightFunction ¶
type AlternativeWeightFunction func(alternative *AlternativeWithCriteria) *AlternativeResult
type AlternativeWithCriteria ¶
type AlternativeWithCriteria struct { Id Alternative `json:"id"` Criteria Weights `json:"criteria"` }
func FetchAlternative ¶
func FetchAlternative(a *[]AlternativeWithCriteria, id Alternative) AlternativeWithCriteria
func RemoveAlternative ¶
func RemoveAlternative(alternatives []AlternativeWithCriteria, alternative AlternativeWithCriteria) []AlternativeWithCriteria
func RemoveAlternativeAt ¶
func RemoveAlternativeAt(alternatives []AlternativeWithCriteria, index int) []AlternativeWithCriteria
func (*AlternativeWithCriteria) CriterionRawValue ¶
func (a *AlternativeWithCriteria) CriterionRawValue(criterion *Criterion) Weight
func (*AlternativeWithCriteria) CriterionValue ¶
func (a *AlternativeWithCriteria) CriterionValue(criterion *Criterion) Weight
func (*AlternativeWithCriteria) String ¶
func (a *AlternativeWithCriteria) String() string
func (*AlternativeWithCriteria) WithCriteriaOnly ¶
func (a *AlternativeWithCriteria) WithCriteriaOnly(criteria *Criteria) *AlternativeWithCriteria
func (*AlternativeWithCriteria) WithCriteriaValues ¶
func (a *AlternativeWithCriteria) WithCriteriaValues(criteriaValues *Weights) *AlternativeWithCriteria
func (*AlternativeWithCriteria) WithCriterion ¶
func (a *AlternativeWithCriteria) WithCriterion(name string, value Weight) *AlternativeWithCriteria
type Alternatives ¶
type Alternatives []Alternative
type AlternativesRankEntry ¶
type AlternativesRankEntry struct { AlternativeResult BetterThanOrSameAs Alternatives `json:"betterThanOrSameAs"` // preference >= }
type AlternativesRanking ¶
type AlternativesRanking []AlternativesRankEntry
func Rank ¶
func Rank(dmp *DecisionMakingParams, pref AlternativeWeightFunction) *AlternativesRanking
func (*AlternativesRanking) ReverseOrder ¶
func (r *AlternativesRanking) ReverseOrder()
type Bias ¶
type Bias interface { utils.Identifiable Apply( original, current *DecisionMakingParams, props *BiasProps, listener *BiasListener, ) *BiasedResult }
type BiasListener ¶
type BiasListener interface { utils.Identifiable CriterionAdder CriterionRemover CriteriaRanker MethodParametersMerger }
type BiasListeners ¶
type BiasListeners struct {
Listeners []BiasListener
}
func (*BiasListeners) Fetch ¶
func (pf *BiasListeners) Fetch(listenerName string) *BiasListener
func (*BiasListeners) Get ¶
func (pf *BiasListeners) Get(index int) utils.Identifiable
func (*BiasListeners) Len ¶
func (pf *BiasListeners) Len() int
type BiasMap ¶
func AsBiasesMap ¶
type BiasParams ¶
type BiasParams struct { Name string `json:"name"` Disabled bool `json:"disabled"` ApplyProbability float64 `json:"applyProbability"` Props BiasProps `json:"props"` }
func UpdateBiasesProps ¶
func UpdateBiasesProps(oldProps *BiasParams, update BiasProps) *BiasParams
type BiasWithProps ¶
type BiasWithProps struct { Bias *Bias `json:"bias"` Props *BiasParams `json:"props"` }
type BiasedResult ¶
type BiasedResult struct { DMP *DecisionMakingParams `json:"dm"` Props BiasProps `json:"props"` }
type BiasesParams ¶
type BiasesParams = []interface{}
type BiasesWithProps ¶
type BiasesWithProps = []BiasWithProps
func ChooseBiases ¶
func ChooseBiases(available *BiasMap, choose *BiasesParams) *BiasesWithProps
type Criteria ¶
type Criteria []Criterion
func (*Criteria) FindWeight ¶
func (*Criteria) NotUsedName ¶
func (*Criteria) ShallowCopy ¶
func (*Criteria) SortByWeights ¶
func (c *Criteria) SortByWeights(weights Weights) *WeightedCriteria
func (*Criteria) ZipWithWeights ¶
func (c *Criteria) ZipWithWeights(weights *Weights) *WeightedCriteria
type CriteriaRanker ¶
type CriteriaRanker interface {
RankCriteriaAscending(params *DecisionMakingParams) *WeightedCriteria
}
type Criterion ¶
type Criterion struct { Id string `json:"id"` Type CriterionType `json:"type"` ValuesRange *utils.ValueRange `json:"valuesRange,omitempty"` }
func (Criterion) Identifier ¶
func (*Criterion) Multiplier ¶
type CriterionAdder ¶
type CriterionAdder interface { OnCriterionAdded( criterion *Criterion, referenceCriterion *Criterion, params MethodParameters, generator utils.ValueGenerator, ) AddedCriterionParams }
type CriterionRemover ¶
type CriterionRemover interface {
OnCriteriaRemoved(leftCriteria *Criteria, params MethodParameters) MethodParameters
}
type CriterionType ¶
type CriterionType string
const ( Gain CriterionType = "gain" Cost CriterionType = "cost" )
type DecisionMaker ¶
type DecisionMaker struct { PreferenceFunction string `json:"preferenceFunction"` Biases BiasesParams `json:"biases"` BiasApplyRandomSeed int64 `json:"biasApplyRandomSeed"` KnownAlternatives []AlternativeWithCriteria `json:"knownAlternatives"` ChoseToMake []Alternative `json:"choseToMake"` Criteria Criteria `json:"criteria"` MethodParameters RawMethodParameters `json:"methodParameters"` }
func (*DecisionMaker) Alternative ¶
func (dm *DecisionMaker) Alternative(id Alternative) AlternativeWithCriteria
func (*DecisionMaker) AlternativesToConsider ¶
func (dm *DecisionMaker) AlternativesToConsider() *[]AlternativeWithCriteria
func (*DecisionMaker) MakeDecision ¶
func (dm *DecisionMaker) MakeDecision( preferenceFunctions PreferenceFunctions, biasListeners BiasListeners, availableBiases *BiasMap, biasApplyProbGenerator utils.SeededValueGenerator, ) *DecisionMakerChoice
func (*DecisionMaker) NotConsideredAlternatives ¶
func (dm *DecisionMaker) NotConsideredAlternatives() *[]AlternativeWithCriteria
type DecisionMakerChoice ¶
type DecisionMakerChoice struct { Result AlternativesRanking `json:"result"` Biases BiasesParams `json:"biases"` }
type DecisionMakingParams ¶
type DecisionMakingParams struct { NotConsideredAlternatives []AlternativeWithCriteria ConsideredAlternatives []AlternativeWithCriteria Criteria Criteria MethodParameters interface{} }
func (*DecisionMakingParams) AllAlternatives ¶
func (p *DecisionMakingParams) AllAlternatives() []AlternativeWithCriteria
type EvaluationSingleValue ¶
type EvaluationSingleValue struct {
Value float64 `json:"value"`
}
type MethodParameters ¶
type MethodParameters = interface{}
type MethodParametersMerger ¶
type MethodParametersMerger interface {
Merge(params MethodParameters, addition MethodParameters) MethodParameters
}
type PreferenceFunction ¶
type PreferenceFunction interface { utils.Identifiable MethodParameters() interface{} ParseParams(dm *DecisionMaker) interface{} Evaluate(dmp *DecisionMakingParams) *AlternativesRanking }
type PreferenceFunctions ¶
type PreferenceFunctions struct {
Functions []PreferenceFunction `json:"functions"`
}
func (*PreferenceFunctions) Fetch ¶
func (pf *PreferenceFunctions) Fetch(function string) *PreferenceFunction
func (*PreferenceFunctions) FetchParameters ¶
func (pf *PreferenceFunctions) FetchParameters() *map[string]interface{}
func (*PreferenceFunctions) Get ¶
func (pf *PreferenceFunctions) Get(index int) utils.Identifiable
func (*PreferenceFunctions) Len ¶
func (pf *PreferenceFunctions) Len() int
type RawMethodParameters ¶
type RawMethodParameters = map[string]interface{}
type Weight ¶
type Weight = float64
func NewCriterionValue ¶
func NewCriterionValue(previousWeights *Weights, baseCriterion *Criterion, generator *utils.ValueGenerator) Weight
func WeightIdentity ¶
type WeightType ¶
type WeightType struct {
Weights Weights `json:"weights"`
}
func SingleWeight ¶
func SingleWeight(criterion *Criterion, value Weight) WeightType
type WeightedCriteria ¶
type WeightedCriteria []WeightedCriterion
func (*WeightedCriteria) Criteria ¶
func (w *WeightedCriteria) Criteria() *Criteria
type WeightedCriterion ¶
func (*WeightedCriterion) AsWeights ¶
func (c *WeightedCriterion) AsWeights() *Weights
type Weights ¶
func ExtractWeights ¶
func ExtractWeights(dm *DecisionMaker) Weights
func PrepareCumulatedWeightsMap ¶
func PrepareCumulatedWeightsMap( params *DecisionMakingParams, mapper func(criterion string, value Weight) Weight, ) *Weights
func RescaleCriterion ¶
func RescaleCriterion(c *Criterion, alternatives *[]AlternativeWithCriteria, target *utils.ValueRange) Weights
func (*Weights) AsKeyValue ¶
func (w *Weights) AsKeyValue() []namedWeight
func (*Weights) PreserveOnly ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.