Beispiel #1
0
        public static INALayer CreateRouteAnalysisLayer(string layerName, INetworkDataset networkDataset,
                                                        INARouteSolver naRouteSolver)
        {
            INASolverSettings settings    = naRouteSolver as INASolverSettings;
            INASolver         solver      = naRouteSolver as INASolver;
            IDatasetComponent component   = networkDataset as IDatasetComponent;
            IDENetworkDataset dataElement = component.DataElement as IDENetworkDataset;
            INAContext        context     = solver.CreateContext(dataElement, layerName);

            (context as INAContextEdit).Bind(networkDataset, new GPMessagesClass());
            INALayer layer = solver.CreateLayer(context);

            (layer as ILayer).Name          = layerName;
            naRouteSolver.FindBestSequence  = true;
            naRouteSolver.PreserveFirstStop = true;
            naRouteSolver.PreserveLastStop  = false;
            naRouteSolver.UseTimeWindows    = false;
            naRouteSolver.OutputLines       = esriNAOutputLineType.esriNAOutputLineTrueShapeWithMeasure;
            IStringArray restrictionAttributeNames = settings.RestrictionAttributeNames;

            restrictionAttributeNames.Add("Oneway");
            settings.RestrictionAttributeNames = restrictionAttributeNames;
            solver.UpdateContext(context, dataElement, new GPMessagesClass());
            return(layer);
        }
        /// <summary>
        /// Set solver settings
        /// </summary>
        public void SetSolverSettings()
        {
            // Set OD solver specific settings
            INASolver solver = m_NAContext.Solver;

            INAODCostMatrixSolver odSolver = solver as INAODCostMatrixSolver;

            if (textCutoff.Text.Length > 0 && IsNumeric(textCutoff.Text.Trim()))
            {
                odSolver.DefaultCutoff = textCutoff.Text;
            }
            else
            {
                odSolver.DefaultCutoff = null;
            }

            if (textTargetFacility.Text.Length > 0 && IsNumeric(textTargetFacility.Text.Trim()))
            {
                odSolver.DefaultTargetDestinationCount = textTargetFacility.Text;
            }
            else
            {
                odSolver.DefaultTargetDestinationCount = null;
            }

            odSolver.OutputLines = esriNAOutputLineType.esriNAOutputLineStraight;

            // Set generic solver settings
            // Set the impedance attribute
            INASolverSettings solverSettings = solver as INASolverSettings;

            solverSettings.ImpedanceAttributeName = comboCostAttribute.Text;

            // Set the OneWay restriction if necessary
            IStringArray restrictions = solverSettings.RestrictionAttributeNames;

            restrictions.RemoveAll();
            if (checkUseRestriction.Checked)
            {
                restrictions.Add("oneway");
            }
            solverSettings.RestrictionAttributeNames = restrictions;

            // Restrict UTurns
            solverSettings.RestrictUTurns         = esriNetworkForwardStarBacktrack.esriNFSBNoBacktrack;
            solverSettings.IgnoreInvalidLocations = true;

            // Set the hierarchy attribute
            solverSettings.UseHierarchy = checkUseHierarchy.Checked;
            if (solverSettings.UseHierarchy)
            {
                solverSettings.HierarchyAttributeName = "HierarchyMultiNet";
            }

            // Do not forget to update the context after you set your impedance
            solver.UpdateContext(m_NAContext, GetDENetworkDataset(m_NAContext.NetworkDataset), new GPMessagesClass());
        }
Beispiel #3
0
        public void SetSolverSettings()
        {
            INASolver solver = this.m_pNAContext.Solver;
            INAClosestFacilitySolver solver2 = solver as INAClosestFacilitySolver;

            if ((this.txtCutOff.Text.Length > 0) && this.IsNumeric(this.txtCutOff.Text.Trim()))
            {
                solver2.DefaultCutoff = this.txtCutOff.Text;
            }
            else
            {
                solver2.DefaultCutoff = null;
            }
            if ((this.txtTargetFacility.Text.Length > 0) && this.IsNumeric(this.txtTargetFacility.Text))
            {
                solver2.DefaultTargetFacilityCount = int.Parse(this.txtTargetFacility.Text);
            }
            else
            {
                solver2.DefaultTargetFacilityCount = 1;
            }
            solver2.OutputLines     = esriNAOutputLineType.esriNAOutputLineTrueShapeWithMeasure;
            solver2.TravelDirection = esriNATravelDirection.esriNATravelDirectionToFacility;
            INASolverSettings settings = solver as INASolverSettings;

            settings.ImpedanceAttributeName = this.cboCostAttribute.Text;
            IStringArray restrictionAttributeNames = settings.RestrictionAttributeNames;

            restrictionAttributeNames.RemoveAll();
            if (this.chkUseRestriction.Checked)
            {
                restrictionAttributeNames.Add("oneway");
            }
            settings.RestrictionAttributeNames = restrictionAttributeNames;
            settings.RestrictUTurns            = esriNetworkForwardStarBacktrack.esriNFSBNoBacktrack;
            settings.IgnoreInvalidLocations    = true;
            settings.UseHierarchy = this.chkUseHierarchy.Checked;
            if (settings.UseHierarchy)
            {
                settings.HierarchyAttributeName = "hierarchy";
                settings.HierarchyLevelCount    = 3;
                settings.set_MaxValueForHierarchy(1, 1);
                settings.set_NumTransitionToHierarchy(1, 9);
                settings.set_MaxValueForHierarchy(2, 2);
                settings.set_NumTransitionToHierarchy(2, 9);
            }
            solver.UpdateContext(this.m_pNAContext, this.GetDENetworkDataset(this.m_pNAContext.NetworkDataset),
                                 new GPMessagesClass());
        }
Beispiel #4
0
        /// <summary>
        /// Create a new network analysis layer and set some solver settings
        /// </summary>
        private INALayer CreateRouteAnalysisLayer(String layerName, INetworkDataset networkDataset)
        {
            INARouteSolver    naRouteSolver    = new NARouteSolverClass();
            INASolverSettings naSolverSettings = naRouteSolver as INASolverSettings;
            INASolver         naSolver         = naRouteSolver as INASolver;

            //Get the NetworkDataset's Data Element
            IDatasetComponent datasetComponent = networkDataset as IDatasetComponent;
            IDENetworkDataset deNetworkDataset = datasetComponent.DataElement as IDENetworkDataset;

            //Create the NAContext and bind to it
            INAContext naContext;

            naContext = naSolver.CreateContext(deNetworkDataset, layerName);
            INAContextEdit naContextEdit = naContext as INAContextEdit;

            naContextEdit.Bind(networkDataset, new GPMessagesClass());

            //Create the NALayer
            INALayer naLayer;

            naLayer = naSolver.CreateLayer(naContext);
            (naLayer as ILayer).Name = layerName;

            //Set properties on the route solver interface
            naRouteSolver.FindBestSequence  = true;
            naRouteSolver.PreserveFirstStop = true;
            naRouteSolver.PreserveLastStop  = false;
            naRouteSolver.UseTimeWindows    = false;
            naRouteSolver.OutputLines       = esriNAOutputLineType.esriNAOutputLineTrueShapeWithMeasure;

            //Set some properties on the general INASolverSettings interface
            IStringArray restrictions = naSolverSettings.RestrictionAttributeNames;

            restrictions.Add("Oneway");
            naSolverSettings.RestrictionAttributeNames = restrictions;

            // Update the context based on the changes made to the solver settings
            naSolver.UpdateContext(naContext, deNetworkDataset, new GPMessagesClass());

            //Return the layer
            return(naLayer);
        }
 /// <summary>
 /// 设置解决器 暂时没有使用到
 /// 有问题待修正
 /// </summary>
 /// <param name="pNAContext"></param>
 private static void SetSolverSettings(INAContext pNAContext)
 {
     if (pNAContext.Solver.CanAccumulateAttributes)
     {
         INASolver      naSolver      = pNAContext.Solver;
         INARouteSolver naRouteSolver = naSolver as INARouteSolver;
         naRouteSolver.FindBestSequence  = true;
         naRouteSolver.PreserveFirstStop = true;
         naRouteSolver.PreserveLastStop  = false;
         naRouteSolver.UseTimeWindows    = false;
         naRouteSolver.OutputLines       = esriNAOutputLineType.esriNAOutputLineTrueShapeWithMeasure;
         INASolverSettings2 naSolverSettings = naSolver as INASolverSettings2;
         IStringArray       restrictions     = naSolverSettings.RestrictionAttributeNames;
         restrictions.Add("Oneway");
         naSolverSettings.RestrictionAttributeNames = restrictions;
         //基于上述设置更新Solver
         naSolver.UpdateContext(pNAContext, GetDENetworkDataset(pNAContext.NetworkDataset), new GPMessagesClass());
     }
 }
Beispiel #6
0
        public static INALayer CreateClosestFacilityLayer(string layerName, INetworkDataset networkDataset,
                                                          INAClosestFacilitySolver naClosesFacilitySolver)
        {
            INASolverSettings settings    = naClosesFacilitySolver as INASolverSettings;
            INASolver         solver      = naClosesFacilitySolver as INASolver;
            IDatasetComponent component   = networkDataset as IDatasetComponent;
            IDENetworkDataset dataElement = component.DataElement as IDENetworkDataset;
            INAContext        context     = solver.CreateContext(dataElement, layerName);

            (context as INAContextEdit).Bind(networkDataset, new GPMessagesClass());
            INALayer layer = solver.CreateLayer(context);

            (layer as ILayer).Name = layerName;
            naClosesFacilitySolver.CreateTraversalResult = true;
            naClosesFacilitySolver.TravelDirection       = esriNATravelDirection.esriNATravelDirectionFromFacility;
            naClosesFacilitySolver.OutputLines           = esriNAOutputLineType.esriNAOutputLineTrueShapeWithMeasure;
            IStringArray restrictionAttributeNames = settings.RestrictionAttributeNames;

            restrictionAttributeNames.Add("Oneway");
            settings.RestrictionAttributeNames = restrictionAttributeNames;
            solver.UpdateContext(context, dataElement, new GPMessagesClass());
            return(layer);
        }
Beispiel #7
0
        /// <summary>
        /// Set solver settings
        /// </summary>
        public void SetSolverSettings(string attributeName)
        {
            //Set Route specific Settings
            INASolver naSolver = m_NAContext.Solver;

            INAClosestFacilitySolver cfSolver = naSolver as INAClosestFacilitySolver;

            cfSolver.OutputLines     = esriNAOutputLineType.esriNAOutputLineTrueShapeWithMeasure;
            cfSolver.TravelDirection = esriNATravelDirection.esriNATravelDirectionFromFacility;

            // Set generic solver settings
            // Set the impedance attribute
            INASolverSettings naSolverSettings;

            naSolverSettings = naSolver as INASolverSettings;
            naSolverSettings.ImpedanceAttributeName = attributeName;

            // Set the OneWay Restriction if necessary
            IStringArray restrictions;

            restrictions = naSolverSettings.RestrictionAttributeNames;
            restrictions.RemoveAll();
            naSolverSettings.RestrictionAttributeNames = restrictions;

            //Restrict UTurns
            naSolverSettings.RestrictUTurns         = esriNetworkForwardStarBacktrack.esriNFSBNoBacktrack;
            naSolverSettings.IgnoreInvalidLocations = true;

            // Set the Hierarchy attribute
            if (naSolverSettings.UseHierarchy)
            {
                naSolverSettings.HierarchyAttributeName = "HierarchyMultiNet";
            }

            // Do not forget to update the context after you set your impedance
            naSolver.UpdateContext(m_NAContext, GetDENetworkDataset(m_NAContext.NetworkDataset), new GPMessagesClass());
        }
        //*********************************************************************************
        // Set Solver Settings for the Location-Allocation Solver
        //*********************************************************************************
        public void SetSolverSettings()
        {
            //Set Location-Allocation specific Settings
            INASolver naSolver = m_NAContext.Solver;

            INALocationAllocationSolver2 laSolver = naSolver as INALocationAllocationSolver2;

            // Set number of facilities to locate
            if (txtFacilitiesToLocate.Text.Length > 0 && IsNumeric(txtFacilitiesToLocate.Text))
            {
                laSolver.NumberFacilitiesToLocate = int.Parse(txtFacilitiesToLocate.Text);
            }
            else
            {
                laSolver.NumberFacilitiesToLocate = 1;
            }

            // Set impedance cutoff
            if (txtCutOff.Text.Length > 0 && IsNumeric(txtCutOff.Text.Trim()))
            {
                laSolver.DefaultCutoff = txtCutOff.Text;
            }
            else
            {
                laSolver.DefaultCutoff = null;
            }

            // Set up Location-Allocation problem type
            if (cboProblemType.Text.Equals("Maximize Attendance"))
            {
                laSolver.ProblemType = esriNALocationAllocationProblemType.esriNALAPTMaximizeAttendance;
            }
            else if (cboProblemType.Text.Equals("Maximize Coverage"))
            {
                laSolver.ProblemType = esriNALocationAllocationProblemType.esriNALAPTMaximizeCoverage;
            }
            else if (cboProblemType.Text.Equals("Maximize Capacitated Coverage"))
            {
                laSolver.ProblemType = esriNALocationAllocationProblemType.esriNALAPTMaximizeCapacitatedCoverage;
            }
            else if (cboProblemType.Text.Equals("Minimize Facilities"))
            {
                laSolver.ProblemType = esriNALocationAllocationProblemType.esriNALAPTMaximizeCoverageMinimizeFacilities;
            }
            else if (cboProblemType.Text.Equals("Maximize Market Share"))
            {
                laSolver.ProblemType = esriNALocationAllocationProblemType.esriNALAPTMaximizeMarketShare;
            }
            else if (cboProblemType.Text.Equals("Minimize Impedance"))
            {
                laSolver.ProblemType = esriNALocationAllocationProblemType.esriNALAPTMinimizeWeightedImpedance;
            }
            else if (cboProblemType.Text.Equals("Target Market Share"))
            {
                laSolver.ProblemType = esriNALocationAllocationProblemType.esriNALAPTTargetMarketShare;
            }
            else
            {
                laSolver.ProblemType = esriNALocationAllocationProblemType.esriNALAPTMinimizeWeightedImpedance;
            }

            // Set Impedance Transformation type
            if (cboImpTransformation.Text.Equals("Linear"))
            {
                laSolver.ImpedanceTransformation = esriNAImpedanceTransformationType.esriNAITTLinear;
            }
            else if (cboImpTransformation.Text.Equals("Power"))
            {
                laSolver.ImpedanceTransformation = esriNAImpedanceTransformationType.esriNAITTPower;
            }
            else if (cboImpTransformation.Text.Equals("Exponential"))
            {
                laSolver.ImpedanceTransformation = esriNAImpedanceTransformationType.esriNAITTExponential;
            }

            // Set Impedance Transformation Parameter (distance decay beta)
            if (txtImpParameter.Text.Length > 0 && IsNumeric(txtCutOff.Text.Trim()))
            {
                laSolver.TransformationParameter = double.Parse(txtImpParameter.Text);
            }
            else
            {
                laSolver.TransformationParameter = 1.0;
            }

            // Set target market share percentage (should be between 0.0 and 100.0)
            if (txtTargetMarketShare.Text.Length > 0 && IsNumeric(txtCutOff.Text.Trim()))
            {
                double targetPercentage;
                targetPercentage = double.Parse(txtTargetMarketShare.Text);

                if ((targetPercentage <= 0.0) || (targetPercentage > 100.0))
                {
                    targetPercentage = 10.0;
                    lstOutput.Items.Add("Target percentage out of range. Reset to 10%");
                }
                laSolver.TargetMarketSharePercentage = targetPercentage;
                txtTargetMarketShare.Text            = laSolver.TargetMarketSharePercentage.ToString();
            }
            else
            {
                laSolver.TargetMarketSharePercentage = 10.0;
            }

            // Set default capacity
            if (txtDefaultCapacity.Text.Length > 0 && IsNumeric(txtDefaultCapacity.Text.Trim()))
            {
                double defaultCapacity;
                defaultCapacity = double.Parse(txtDefaultCapacity.Text);

                if ((defaultCapacity <= 0.0))
                {
                    defaultCapacity = 1.0;
                    lstOutput.Items.Add("Default capacity must be greater than zero.");
                }
                laSolver.DefaultCapacity = defaultCapacity;
                txtDefaultCapacity.Text  = laSolver.DefaultCapacity.ToString();
            }
            else
            {
                laSolver.DefaultCapacity = 1.0;
            }


            // Set any other solver settings
            laSolver.OutputLines     = esriNAOutputLineType.esriNAOutputLineStraight;
            laSolver.TravelDirection = esriNATravelDirection.esriNATravelDirectionFromFacility;

            // Set the impedance attribute
            INASolverSettings naSolverSettings = naSolver as INASolverSettings;

            naSolverSettings.ImpedanceAttributeName = cboCostAttribute.Text;

            naSolverSettings.IgnoreInvalidLocations = true;

            // Do not forget to update the context after you set your impedance
            naSolver.UpdateContext(m_NAContext, GetDENetworkDataset(m_NAContext.NetworkDataset), new GPMessagesClass());
        }
Beispiel #9
0
        /// <summary>
        /// Set solver settings
        /// </summary>
        public void SetSolverSettings()
        {
            // Set VRP solver specific settings
            INASolver    solver    = m_NAContext.Solver;
            INAVRPSolver vrpSolver = solver as INAVRPSolver;

            // Both orders and routes have capacity count of 2 in the input shape files. User can modify the input data and update this value accordingly.
            vrpSolver.CapacityCount = 2;

            // Read the time and distance unit from comboBox
            vrpSolver.DistanceFieldUnits = (esriNetworkAttributeUnits)m_unitDistList[comboDistUnits.Items[comboDistUnits.SelectedIndex].ToString()];
            vrpSolver.TimeFieldUnits     = (esriNetworkAttributeUnits)m_unitTimeList[comboTimeUnits.Items[comboTimeUnits.SelectedIndex].ToString()];

            // The value of time window violation penalty factor can be adjusted in terms of the user's preference.
            string importance = comboTWImportance.Items[comboTWImportance.SelectedIndex].ToString();

            if (importance == "Low")
            {
                vrpSolver.TimeWindowViolationPenaltyFactor = 0;
            }
            else if (importance == "Medium")
            {
                vrpSolver.TimeWindowViolationPenaltyFactor = 1;
            }
            else if (importance == "High")
            {
                vrpSolver.TimeWindowViolationPenaltyFactor = 10;
            }

            // Set output line type
            vrpSolver.OutputLines = esriNAOutputLineType.esriNAOutputLineStraight;

            // Set generic solver settings
            // Set the impedance attribute
            INASolverSettings solverSettings = solver as INASolverSettings;

            solverSettings.ImpedanceAttributeName = comboTimeAttribute.Text;

            // Set the accumulated attribute
            IStringArray accumulatedAttributes = solverSettings.AccumulateAttributeNames;

            accumulatedAttributes.RemoveAll();
            accumulatedAttributes.Insert(0, comboDistanceAttribute.Text);
            solverSettings.AccumulateAttributeNames = accumulatedAttributes;

            // Set the oneway restriction if necessary
            IStringArray restrictions = solverSettings.RestrictionAttributeNames;

            restrictions.RemoveAll();
            if (checkUseRestriction.Checked)
            {
                restrictions.Add("oneway");
            }
            solverSettings.RestrictionAttributeNames = restrictions;

            // Restrict UTurns
            solverSettings.RestrictUTurns = esriNetworkForwardStarBacktrack.esriNFSBNoBacktrack;

            // Set the hierarchy attribute
            solverSettings.UseHierarchy = checkUseHierarchy.Checked;
            if (solverSettings.UseHierarchy)
            {
                solverSettings.HierarchyAttributeName = "HierarchyMultiNet";
            }

            // Do not forget to update the context after you set your impedance
            solver.UpdateContext(m_NAContext, GetDENetworkDataset(m_NAContext.NetworkDataset), new GPMessagesClass());
        }
Beispiel #10
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            INASolver naSolver = pMainFrm.m_NAContext.Solver;
            //开始进行设置
            INAClosestFacilitySolver cfSolver = naSolver as INAClosestFacilitySolver;

            if (numericUpDownCutoff.Value == 0)
            {
                cfSolver.DefaultCutoff = null;
            }
            else
            {
                cfSolver.DefaultCutoff = numericUpDownCutoff.Value;
            }
            if (numericUpDownFCount.Value == 0)
            {
                cfSolver.DefaultTargetFacilityCount = 1;
            }
            else
            {
                cfSolver.DefaultTargetFacilityCount = int.Parse(numericUpDownFCount.Value.ToString());
            }
            //设置输出线的形状
            switch (cboOutShapeType.Text)
            {
            case "无":
                cfSolver.OutputLines = esriNAOutputLineType.esriNAOutputLineNone;
                break;

            case "直线":
                cfSolver.OutputLines = esriNAOutputLineType.esriNAOutputLineStraight;
                break;

            case "True Shape":
                cfSolver.OutputLines = esriNAOutputLineType.esriNAOutputLineTrueShape;
                break;

            case "True Shape(无测量)":
                cfSolver.OutputLines = esriNAOutputLineType.esriNAOutputLineTrueShapeWithMeasure;
                break;
            }
            //设置查找方向
            if (rbnItoF.Checked == true)
            {
                cfSolver.TravelDirection = esriNATravelDirection.esriNATravelDirectionToFacility;
            }
            else
            {
                cfSolver.TravelDirection = esriNATravelDirection.esriNATravelDirectionFromFacility;
            }

            //设置SOLVER的参数
            //设置Impedance的属性
            INASolverSettings naSolverSetting = naSolver as INASolverSettings;

            naSolverSetting.ImpedanceAttributeName = cboImpedance.Text;
            //设置OneWay限制
            IStringArray restriction = naSolverSetting.RestrictionAttributeNames;

            restriction.RemoveAll();
            int i = 0;

            for (i = 0; i <= listView1.SelectedItems.Count - 1; i++)
            {
                restriction.Add(listView1.SelectedItems.ToString());
            }
            naSolverSetting.RestrictionAttributeNames = restriction;
            //设置拐点
            switch (cboAllowedTurn.Text)
            {
            case "无":
                naSolverSetting.RestrictUTurns = esriNetworkForwardStarBacktrack.esriNFSBNoBacktrack;
                break;

            case "任何端点":
                naSolverSetting.RestrictUTurns = esriNetworkForwardStarBacktrack.esriNFSBAllowBacktrack;
                break;

            case "仅在末端":
                naSolverSetting.RestrictUTurns = esriNetworkForwardStarBacktrack.esriNFSBAtDeadEndsOnly;
                break;
            }
            naSolverSetting.IgnoreInvalidLocations = chkIgnoreInvalidValue.Checked;
            naSolver.UpdateContext(pMainFrm.m_NAContext, Utility.GetDENetworkDataset(pMainFrm.m_pNetDataset), new GPMessagesClass());
            ToolBarButton toolbarbutton1 = pMainFrm.returnToolbarButton();

            toolbarbutton1.Enabled = true;
            this.Dispose();
        }
Beispiel #11
0
        /// <summary>
        /// Set solver settings
        /// </summary>
        public void SetSolverSettings()
        {
            //Set Route specific Settings
            INASolver naSolver = m_NAContext.Solver;

            INAClosestFacilitySolver cfSolver = naSolver as INAClosestFacilitySolver;

            if (txtCutOff.Text.Length > 0 && IsNumeric(txtCutOff.Text.Trim()))
            {
                cfSolver.DefaultCutoff = txtCutOff.Text;
            }
            else
            {
                cfSolver.DefaultCutoff = null;
            }

            if (txtTargetFacility.Text.Length > 0 && IsNumeric(txtTargetFacility.Text))
            {
                cfSolver.DefaultTargetFacilityCount = int.Parse(txtTargetFacility.Text);
            }
            else
            {
                cfSolver.DefaultTargetFacilityCount = 1;
            }

            cfSolver.OutputLines     = esriNAOutputLineType.esriNAOutputLineTrueShapeWithMeasure;
            cfSolver.TravelDirection = esriNATravelDirection.esriNATravelDirectionToFacility;

            // Set generic solver settings
            // Set the impedance attribute
            INASolverSettings naSolverSettings;

            naSolverSettings = naSolver as INASolverSettings;
            naSolverSettings.ImpedanceAttributeName = cboCostAttribute.Text;

            // Set the OneWay Restriction if necessary
            IStringArray restrictions;

            restrictions = naSolverSettings.RestrictionAttributeNames;
            restrictions.RemoveAll();
            if (chkUseRestriction.Checked)
            {
                restrictions.Add("oneway");
            }

            naSolverSettings.RestrictionAttributeNames = restrictions;

            //Restrict UTurns
            naSolverSettings.RestrictUTurns         = esriNetworkForwardStarBacktrack.esriNFSBNoBacktrack;
            naSolverSettings.IgnoreInvalidLocations = true;

            // Set the Hierarchy attribute
            naSolverSettings.UseHierarchy = chkUseHierarchy.Checked;
            if (naSolverSettings.UseHierarchy)
            {
                naSolverSettings.HierarchyAttributeName = "HierarchyMultiNet";
            }

            // Do not forget to update the context after you set your impedance
            naSolver.UpdateContext(m_NAContext, GetDENetworkDataset(m_NAContext.NetworkDataset), new GPMessagesClass());
        }