DaySim icon indicating copy to clipboard operation
DaySim copied to clipboard

Missing coefficients file should throw an exception

Open PeterVermont opened this issue 5 years ago • 2 comments

No warning or exception is thrown if a coefficent file cannot be found.

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

        }
      }
      if (coefficientsReader == null) {

      }

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


PeterVermont avatar Mar 11 '19 23:03 PeterVermont