public CalculateBenefit(int year, Treatments treatmentToEvaluate, List <Deteriorate> deteriorates, List <CalculatedAttribute> calculatedAttributes, List <Consequences> noTreatmentConsequences, List <Committed> committedProjects, Dictionary <string, List <AttributeChange> > committedConsequences, Dictionary <string, CommittedEquation> committedEquation, List <Treatments> simulationTreatments) { Year = year; Treatment = treatmentToEvaluate; Deteriorates = deteriorates; CalculatedAttributes = calculatedAttributes; NoTreatmentConsequences = noTreatmentConsequences; CommittedProjects = committedProjects; CommittedConsequences = committedConsequences; CommittedEquations = committedEquation; IsBenefitAttributeAscending = SimulationMessaging.GetAttributeAscending(SimulationMessaging.Method.BenefitAttribute); IsBenefitCalculated = calculatedAttributes.Any(a => a.Attribute == SimulationMessaging.Method.BenefitAttribute); CurrentDeteriorate = new List <Deteriorate>(); SimulationTreatments = simulationTreatments; //Need to input Deficient _isNoTreatmentCircular = false; //See if any of the no treatment consequences effect the criteria. //If they do not there is no need recalculate/resolve var attributesConsequence = new List <string>(); foreach (var consequence in NoTreatmentConsequences) { foreach (var attribute in consequence.Attributes) { if (!attributesConsequence.Contains(attribute)) { attributesConsequence.Add(attribute); } } if (consequence.Criteria?.CriteriaAttributes != null) { foreach (var attribute in consequence.Criteria.CriteriaAttributes) { if (_isNoTreatmentCircular) { break; } foreach (var calculated in CalculatedAttributes) { if (calculated.Attribute != attribute) { continue; } //If a attribute is calculated it could result in a circular condition (maybe) _isNoTreatmentCircular = true; break; } //If the criteria is modified by a consequence it can change (even with no treatment) if (!attributesConsequence.Contains(attribute)) { continue; } _isNoTreatmentCircular = true; } } } }
public Scheduled(int scheduleId, Treatments treatment, int scheduledYear) { ScheduledId = scheduleId; Treatment = treatment; ScheduledYear = scheduledYear; }