예제 #1
0
        public ChoiceProbabilityFactory(string coefficientsPath, bool modelIsInEstimationMode, int totalAlternatives, int totalNestedAlternatives, int totalLevels, int maxParameter, ICoefficientsReader reader = null)
        {
            ICoefficientsReader coefficientsReader = null;

            if (reader != null)
            {
                coefficientsReader = reader;
            }

            if (reader == null)
            {
                FileInfo file = new FileInfo(coefficientsPath);

                if (file.Exists)
                {
                    coefficientsReader = new CoefficientsReader();
                }
                else
                {
                    string message = string.Format("No file exists at coefficientsPath '{0}'", coefficientsPath);
                    DaySim.Framework.Core.Global.PrintFile.WriteLine(message, true);
                    throw new Exception(message);
                }
            }
            if (coefficientsReader != null)
            {
                _coefficients = coefficientsReader.Read(coefficientsPath, out _title, out _sizeFunctionMultiplier,
                                                        out ICoefficient nestCoefficient);
            }
            _modelIsInEstimationMode = modelIsInEstimationMode;
            _totalAlternatives       = totalAlternatives;
            _totalNestedAlternatives = totalNestedAlternatives;
            _totalLevels             = totalLevels;
            _totalUtilities          = maxParameter + 1;
        }
예제 #2
0
        public ChoiceProbabilityFactory(string coefficientsPath, bool modelIsInEstimationMode, int totalAlternatives, int totalNestedAlternatives, int totalLevels, int maxParameter, ICoefficientsReader reader = null)
        {
            ICoefficientsReader coefficientsReader = null;

            if (reader != null)
            {
                coefficientsReader = reader;
            }
            if (reader == null)
            {
                var file = new FileInfo(coefficientsPath);

                if (file.Exists)
                {
                    coefficientsReader = new CoefficientsReader();
                }
            }
            if (coefficientsReader == null)
            {
            }

            if (coefficientsReader != null)
            {
                ICoefficient nestCoefficient;

                _coefficients = coefficientsReader.Read(coefficientsPath, out _title, out _sizeFunctionMultiplier,
                                                        out nestCoefficient);
            }
            _modelIsInEstimationMode = modelIsInEstimationMode;
            _totalAlternatives       = totalAlternatives;
            _totalNestedAlternatives = totalNestedAlternatives;
            _totalLevels             = totalLevels;
            _totalUtilities          = maxParameter + 1;
        }