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 OrangeBucketVariableMap ConvertBucket(BucketVariableModel bucket)
        {
            var bucketMap = new OrangeBucketVariableMap(bucket);

            for (var i = 0; i < bucket.Size; i++)
            {
                var bundleMap = ConvertBundle(bucket, i);

                bucketMap.Add(bundleMap);
            }

            return(bucketMap);
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
 internal void AddVariable(OrangeBucketVariableMap variable)
 {
     _bucketMaps.Add(variable);
 }