Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing coefficients file should throw an exception #221

Open
PeterVermont opened this issue Mar 11, 2019 · 2 comments
Open

Missing coefficients file should throw an exception #221

PeterVermont opened this issue Mar 11, 2019 · 2 comments

Comments

@PeterVermont
Copy link
Contributor

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
Copy link
Contributor Author

Ben and Mark: Are there cases where it is okay not to have a coefficients file? If so, then I will not throw an error if coefficients path is null or blank.

@PeterVermont
Copy link
Contributor Author

Mark says this does in fact give an error but I did get an error when I had a mistake in my properties file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant