internal void AddBucketDomainValue(BucketVariableModel bucket, DomainValue variableBand) { if (!this.valueBucketMap.ContainsKey(bucket.Name)) { this.valueBucketMap.Add(bucket.Name, variableBand); } }
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); }
private OrangeBundleMap ConvertBundle(BucketVariableModel bucket, int bucketCount) { var bundleMap = new OrangeBundleMap(bucket.Bundle); foreach (var singleton in bucket.Bundle.Singletons) { var variableBand = VariableBandEvaluator.GetVariableBand(singleton); _valueMapper.AddBucketDomainValue(bucket, variableBand); var solverVariableName = CreateVariableNameFrom(bucket, bucketCount, singleton); var variableRange = variableBand.GetRange(); var solverVariable = new SolverVariable(solverVariableName, CreateRangeFrom(variableRange)); bundleMap.Add(singleton, solverVariable); } return(bundleMap); }
private void ConvertBucket(BucketVariableModel bucket) { var bucketMap = new OrBucketVariableMap(bucket); for (var i = 0; i < bucket.Size; i++) { var bundleMap = new OrBundleMap(bucket.Bundle); foreach (var singleton in bucket.Bundle.Singletons) { var variableBand = VariableBandEvaluator.GetVariableBand(singleton); _valueMapper.AddBucketDomainValue(bucket, variableBand); var variableRange = variableBand.GetRange(); var orToolsVariableName = CreateOrToolsVariableNameFrom(bucket, i, singleton); var orVariable = _solver.MakeIntVar(variableRange.Lower, variableRange.Upper, orToolsVariableName); bundleMap.Add(singleton, orVariable); _cache.AddVariable(orVariable); } bucketMap.Add(bundleMap); } _cache.AddBucket(bucket.Name, bucketMap); }
private static string CreateOrToolsVariableNameFrom(BucketVariableModel bucket, int index, SingletonVariableModel singletonVariable) { return(bucket.Name + "_" + Convert.ToString(index) + "_" + singletonVariable.Name); }
internal DomainValue GetDomainValueFor(BucketVariableModel theBucket) { return(this.valueBucketMap[theBucket.Name]); }
private object ConvertSolverValueToModel(BucketVariableModel bucket, long solverValue) { var variableDomainValue = this.valueMapper.GetDomainValueFor(bucket); return(variableDomainValue.MapFrom(solverValue)); }
internal OrBucketVariableMap(BucketVariableModel bucket, OrBucketVariableMap parent) { _bundleMaps = new List <OrBundleMap>(); Bucket = bucket; Parent = parent; }
internal OrBucketTracker(BucketVariableModel bucket, OrBucketVariableMap bucketMap) { _bundles = new List <OrBundleMap>(); Bucket = bucket; BucketMap = bucketMap; }
internal OrangeBucketVariableMap(BucketVariableModel bucket) { Bucket = bucket; _bundleMaps = new List <OrangeBundleMap>(); }