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

ConstraintAnalysis: add matchCount() or matchesSize() #885

Open
ge0ffrey opened this issue Jun 16, 2024 · 6 comments · May be fixed by #923
Open

ConstraintAnalysis: add matchCount() or matchesSize() #885

ge0ffrey opened this issue Jun 16, 2024 · 6 comments · May be fixed by #923
Assignees
Labels
papercut process/needs triage Requires initial assessment of validity, priority etc.

Comments

@ge0ffrey
Copy link
Contributor

ge0ffrey commented Jun 16, 2024

But don't add it to the json serialization, as it can be derived from the matches.

Convenience methods for POC building to print to System.out etc.

Also consider, easily finding:

  • the constraint weight
  • the match weight
  • the impact weigh (= constraint weigh * match weight)

Fail fast if matches are null (= not fetched)?

@ge0ffrey ge0ffrey added process/needs triage Requires initial assessment of validity, priority etc. papercut labels Jun 16, 2024
@zepfred zepfred self-assigned this Jun 27, 2024
@zepfred zepfred linked a pull request Jun 27, 2024 that will close this issue
@zepfred
Copy link
Contributor

zepfred commented Jun 27, 2024

Fail fast if matches are null (= not fetched)?

We have a flag, analyzeConstraintMatches, that can cause the InnerScoreDirector#getConstraintAnalysis to set matches to null. So, failing fast could potentially cause existing code to break, e.g., SolutionManager#analyze.

@Christopher-Chianelli
Copy link
Contributor

Fail fast if matches are null (= not fetched)?

We have a flag, analyzeConstraintMatches, that can cause the InnerScoreDirector#getConstraintAnalysis to set matches to null. So, failing fast could potentially cause existing code to break, e.g., SolutionManager#analyze.

That depends on where the fail fast is. I think no issue will occur if the fail fast occurs in matchCount() and matchesSize() (provided these new methods are not called).

@zepfred
Copy link
Contributor

zepfred commented Jun 27, 2024

Fail fast if matches are null (= not fetched)?

We have a flag, analyzeConstraintMatches, that can cause the InnerScoreDirector#getConstraintAnalysis to set matches to null. So, failing fast could potentially cause existing code to break, e.g., SolutionManager#analyze.

That depends on where the fail fast is. I think no issue will occur if the fail fast occurs in matchCount() and matchesSize() (provided these new methods are not called).

That's correct. @ge0ffrey, did you mean "failing fast" with the new method?

@triceo
Copy link
Contributor

triceo commented Jun 27, 2024

Aren't we just moving the same problem on a lower level now? In order to call matchCount, you need to know if it will or will not throw an exception - and in this case, you don't even have a way to find out.

In my opinion, returning -1 or something like that is a better approach.

@Christopher-Chianelli
Copy link
Contributor

Aren't we just moving the same problem on a lower level now? In order to call matchCount, you need to know if it will or will not throw an exception - and in this case, you don't even have a way to find out.

In my opinion, returning -1 or something like that is a better approach.

I prefer exception compared to returning -1. It suppose to fail hard so users know what to fix. The problem that @zepfred alluded to is SolutionManager.analyze too eagerly fail fasting because matches is null.

@ge0ffrey
Copy link
Contributor Author

Yes, only scoreAnalysis.matchCount() should throw an exception if matches weren't fetched. SolutionManager.analyse() should still work.

Similarly, ScoreAnalysis.toString() or getSummary() should always work, but it has the top 3 matches per constraint only if matches were fetched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
papercut process/needs triage Requires initial assessment of validity, priority etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants