internal void AddBucket(string name, OrangeBucketVariableMap bucketVariableMap) { _bucketMap.Add(name, bucketVariableMap); foreach (var bundleMap in bucketVariableMap.GetBundleMaps()) { foreach (var x in bundleMap.GetVariableMaps()) { _solverVariableMap.Add(x.SolverVariable.Name, x.SolverVariable); } } }
private BucketLabelModel ExtractBucketLabelFrom(SnapshotLabelAssignment assignment, OrangeBucketVariableMap bucketVariableMap) { var bundleLabels = new List <BundleLabelModel>(); foreach (var bundleMap in bucketVariableMap.GetBundleMaps()) { var variableLabels = new List <SingletonVariableLabelModel>(); foreach (var variableMap in bundleMap.GetVariableMaps()) { var solverVariable = variableMap.SolverVariable; var labelAssignment = assignment.GetAssignmentFor(solverVariable); var variableSolverValue = labelAssignment.Value; var variableModel = variableMap.ModelVariable; var variableModelValue = ConvertSolverValueToModel(bucketVariableMap.Bucket, variableSolverValue); var label = new SingletonVariableLabelModel(variableModel, new ValueModel(variableModelValue)); variableLabels.Add(label); } bundleLabels.Add(new BundleLabelModel(bucketVariableMap.Bucket.Bundle, variableLabels)); } return(new BucketLabelModel(bucketVariableMap.Bucket, bundleLabels)); }