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

Optimize algorithm #195

Merged
merged 102 commits into from
Dec 18, 2024
Merged

Optimize algorithm #195

merged 102 commits into from
Dec 18, 2024

Conversation

YairSlobodin1
Copy link
Member

@YairSlobodin1 YairSlobodin1 commented Sep 8, 2024

4th and 5th bullets of #191

@YairSlobodin1 YairSlobodin1 marked this pull request as draft September 8, 2024 11:15
test/main_test_list.go Outdated Show resolved Hide resolved
pkg/optimize/sg/sgCubesToRules.go Outdated Show resolved Hide resolved
test/data/optimize_sg_redundant/details.txt Outdated Show resolved Hide resolved
pkg/optimize/sg/sgCubesToRules.go Outdated Show resolved Hide resolved
pkg/optimize/sg/sgCubesToRules.go Outdated Show resolved Hide resolved
pkg/optimize/common.go Outdated Show resolved Hide resolved
pkg/optimize/common.go Show resolved Hide resolved
pkg/optimize/common.go Outdated Show resolved Hide resolved
pkg/optimize/common.go Outdated Show resolved Hide resolved
pkg/optimize/sg/sg.go Outdated Show resolved Hide resolved
@YairSlobodin1
Copy link
Member Author

Is this not doing exactly the job of ds.Product? I though all that's need is trying different associativity of ds.Product, and taking the smaller one. Each projection of a rule is a essentially a Set, just like Interval; it should be possible to extend each to a RuleSet, exactly like IntervalSet, and then the Product datatype should be amenable to support minimizing the number of partitions.

@elazarg we use ds.Product here. The additional code is necessary to handle all protocols and combinations with anyProtocol rules. Moreover, for a cross, we return two rules, whereas Partitions() returns three cubes.

The question is why, or rather, is it possible to generalize Product to accommodate for that. Any rule should be representable as a Set. The difference between rules and Sets is that rules are coarse-grained, that is, there are sets that cannot be described precisely using a single rule (they are not closed under union/subtraction). Generalizing the operations of Set to represent this should yield a Product that minimizes any collection of rules.

@elazarg After implementing both SG and nACL optimization, I don't currently see a strong case for generalizing them

@elazarg
Copy link
Member

elazarg commented Dec 17, 2024

Is this not doing exactly the job of ds.Product? I though all that's need is trying different associativity of ds.Product, and taking the smaller one. Each projection of a rule is a essentially a Set, just like Interval; it should be possible to extend each to a RuleSet, exactly like IntervalSet, and then the Product datatype should be amenable to support minimizing the number of partitions.

@elazarg we use ds.Product here. The additional code is necessary to handle all protocols and combinations with anyProtocol rules. Moreover, for a cross, we return two rules, whereas Partitions() returns three cubes.

The question is why, or rather, is it possible to generalize Product to accommodate for that. Any rule should be representable as a Set. The difference between rules and Sets is that rules are coarse-grained, that is, there are sets that cannot be described precisely using a single rule (they are not closed under union/subtraction). Generalizing the operations of Set to represent this should yield a Product that minimizes any collection of rules.

@elazarg After implementing both SG and nACL optimization, I don't currently see a strong case for generalizing them

I see. The incentive for generalization is to make the models library more useful. The abstractions are not trivial though, so I think it's just a direction to keep in mind, to do it when opportunity arises.

pkg/optimize/sg/sg.go Outdated Show resolved Hide resolved
pkg/optimize/sg/sg.go Outdated Show resolved Hide resolved
pkg/optimize/sg/sg.go Outdated Show resolved Hide resolved
pkg/optimize/sg/sg.go Outdated Show resolved Hide resolved
pkg/optimize/sg/ipCubesToRules.go Outdated Show resolved Hide resolved
pkg/optimize/sg/reduceCubes.go Outdated Show resolved Hide resolved
pkg/optimize/sg/reduceCubes.go Outdated Show resolved Hide resolved
pkg/optimize/sg/ipCubesToRules.go Outdated Show resolved Hide resolved
pkg/optimize/sg/ipCubesToRules.go Outdated Show resolved Hide resolved
@YairSlobodin1 YairSlobodin1 merged commit b4b86f1 into optimize Dec 18, 2024
3 checks passed
@YairSlobodin1 YairSlobodin1 deleted the all_algo branch December 18, 2024 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants