コード例 #1
0
 /// <summary>
 /// Creates a new router.
 /// </summary>
 /// <param name="directedWeightMatrixAlgorithm">The directed weight matrix algorithm.</param>
 /// <param name="turnPenalty">The turn penalty.</param>
 /// <param name="fixedTurns">Turn that cannot change, if any.</param>
 public DirectedSequenceRouter(IDirectedWeightMatrixAlgorithm <float> directedWeightMatrixAlgorithm, float turnPenalty, Tuple <bool?, bool?>[] fixedTurns = null)
 {
     _massResolvingAlgorithm        = directedWeightMatrixAlgorithm.MassResolver;
     _directedWeightMatrixAlgorithm = directedWeightMatrixAlgorithm;
     _turnPenalty = turnPenalty;
     _fixedTurns  = fixedTurns;
 }
コード例 #2
0
        /// <summary>
        /// Creates a new weight-matrix algorithm.
        /// </summary>
        public DirectedWeightMatrixAlgorithm(RouterBase router, IProfileInstance profile, WeightHandler <T> weightHandler, IMassResolvingAlgorithm massResolver, T?max = null)
        {
            _router        = router;
            _profile       = profile;
            _weightHandler = weightHandler;
            _massResolver  = massResolver;

            ContractedDb contractedDb;

            if (!router.Db.TryGetContracted(profile.Profile, out contractedDb))
            {
                throw new NotSupportedException(
                          "Contraction-based many-to-many calculates are not supported in the given router db for the given profile.");
            }
            if (!contractedDb.HasEdgeBasedGraph)
            {
                throw new NotSupportedException(
                          "Contraction-based edge-based many-to-many calculates are not supported in the given router db for the given profile.");
            }
            _graph = contractedDb.EdgeBasedGraph;
            weightHandler.CheckCanUse(contractedDb);
            if (max.HasValue)
            {
                _max = max.Value;
            }
            else
            {
                _max = weightHandler.Infinite;
            }

            _buckets = new Dictionary <uint, Dictionary <int, LinkedEdgePath <T> > >();
        }
コード例 #3
0
ファイル: WeightMatrixAlgorithm.cs プロジェクト: amseet/Orion
 /// <summary>
 /// Creates a new weight-matrix algorithm.
 /// </summary>
 public WeightMatrixAlgorithm(RouterBase router, IProfileInstance profile, WeightHandler <T> weightHandler, IMassResolvingAlgorithm massResolver)
 {
     _router        = router;
     _profile       = profile;
     _weightHandler = weightHandler;
     _massResolver  = massResolver;
 }
コード例 #4
0
 /// <summary>
 /// Creates a new weight-matrix algorithm.
 /// </summary>
 public DirectedAugmentedWeightMatrixAlgorithm(RouterBase router, IProfileInstance profile, IMassResolvingAlgorithm massResolver, Weight max)
     : base(router, profile, profile.AugmentedWeightHandler(router), massResolver, max)
 {
 }