Ejemplo n.º 1
0
        private void ConvertBucket(OrBucketTracker bucketTracker)
        {
            var bucket    = bucketTracker.Bucket;
            var bucketMap = bucketTracker.BucketMap;

            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);
                }

#if false
                foreach (var innerBucket in bucket.Bundle.Buckets)
                {
                    var innerBucketMap     = new OrBucketVariableMap(innerBucket, bucketMap);
                    var innerBucketTracker = new OrBucketTracker(bucket, innerBucketMap);
//                    ConvertBucket(innerBucketTracker);
                }
#endif

                bucketMap.Add(bundleMap);
            }
            _cache.AddBucket(bucket.Name, bucketMap);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 internal void Add(OrBundleMap bundleMap)
 {
     _bundleMaps.Add(bundleMap);
 }