private void AddMoneyToEndorcementReceiver(int endorcerId, int receiverId, RelationData relation, Guid transaction) { var addition = new ConfidenceValue(GetData(endorcerId).Trust, 1 - relation.Strength); var data = RetrieveData(receiverId, transaction); data.AddMoney(addition, transaction); }
internal void UpdateMoney(Func <ConfidenceValue> estimate) { var newEstimation = estimate(); if (newEstimation.Confidence > _money.Confidence) { _money = newEstimation; } }
internal void AddMoney(ConfidenceValue addition, Guid transaction) { _moneyBeforeTransaction[transaction] = _money; var addedValue = addition.Value; var newValue = _money.Value + addedValue; var k = ConfidenceChangeFactor * addedValue / newValue; var newConfidence = k * addition.Confidence + (1 - k) * _money.Confidence; var possessableAmount = MaxAmount * newConfidence; var newPossessableValue = Math.Min(possessableAmount, newValue); _money = new ConfidenceValue(newConfidence, newPossessableValue); }
public TrustConfidenceValue(float trust, ConfidenceValue confidenceValue) { Trust = trust; Confidence = confidenceValue.Confidence; Value = confidenceValue.Value; }