-
Notifications
You must be signed in to change notification settings - Fork 9
Make log encoding domain threshold configurable by adding log_encoding_domain_threshold config option #85
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
a9346f5
855aa66
8da04d4
a661300
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -597,8 +597,7 @@ fn decide_encode_schemes( | |
| for &var in new_vars { | ||
| let repr = norm_vars.int_var(var); | ||
| if let IntVarRepresentation::Domain(domain) = repr { | ||
| if domain.num_candidates() > 500 && complex_constraints_vars.contains(&var) { | ||
| // TODO: make this configurable | ||
| if domain.num_candidates() > config.encoding_domain_threshold && complex_constraints_vars.contains(&var) { | ||
| scheme.insert(var, EncodeScheme::Log); | ||
| } | ||
| } | ||
|
|
@@ -688,7 +687,7 @@ fn decide_encode_schemes( | |
| for &var in &direct_encoding_vars { | ||
| let repr = norm_vars.int_var(var); | ||
| let use_direct_encoding = match repr { | ||
| IntVarRepresentation::Domain(domain) => domain.num_candidates() <= 500, | ||
| IntVarRepresentation::Domain(domain) => domain.num_candidates() <= config.encoding_domain_threshold, | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this threshold 500 is not related
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in commit a661300. Reverted this threshold back to the hardcoded value of 500, as you're correct - this threshold for direct encoding is conceptually different from the log encoding threshold and should not share the same configuration. |
||
| _ => true, | ||
| }; | ||
| if use_direct_encoding { | ||
|
|
@@ -1564,4 +1563,17 @@ mod tests { | |
| } | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_encoding_domain_threshold_configurable() { | ||
| let mut config = Config::default(); | ||
| assert_eq!(config.encoding_domain_threshold, 500); // default value | ||
|
|
||
| config.encoding_domain_threshold = 1000; | ||
| assert_eq!(config.encoding_domain_threshold, 1000); // changed value | ||
|
|
||
| // Test that the field exists and can be modified | ||
| config.encoding_domain_threshold = 100; | ||
| assert_eq!(config.encoding_domain_threshold, 100); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it clear that this config is related to log encoding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit a661300. Renamed the config field to
log_encoding_domain_thresholdand updated CLI option to--log-encoding-domain-thresholdto make it clear this config is specifically for log encoding decisions.