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

flattening very slow for specific models #399

Closed
Wout4 opened this issue Aug 14, 2023 · 2 comments
Closed

flattening very slow for specific models #399

Wout4 opened this issue Aug 14, 2023 · 2 comments

Comments

@Wout4
Copy link
Collaborator

Wout4 commented Aug 14, 2023

Flattening does not seems to stop for the model I attached. This makes it so that the solver time-limit is not respected, since we get stuck in the transformations before the actual solve call.

f = 'lastmodel1691934027.144177.pickle'
    with open(f, 'rb') as fpcl:
        modle, originalmodel, mutatorsused = pickle.loads(fpcl.read())
        modle.solve(time_limit=3) #does not stop (yet)

lastmodel1691934027.144177.zip

@Wout4 Wout4 changed the title solver time-limit is not respected (flattening very slow) flattening very slow for specific models Aug 14, 2023
@Wout4
Copy link
Collaborator Author

Wout4 commented Oct 5, 2023

I think the problem lies within the fact that we attempt to optimize flattening by applying distributivity over disjunctions of conjunctions. This avoids creating aux vars, but in the case of many conjunctions inside a disjunction this explodes the number of constraints exponentially.
So we need some heuristic to decide when to apply distributivity, or not apply it at all (since aux var creation can cause a small slowdown but never exponential, it is the safe option)

@Dimosts
Copy link
Collaborator

Dimosts commented Oct 13, 2023

It seems that removing the rule for applying distributivity is very beneficial! It is always better to have more aux variables than more constraints, so imo, we should test different cases and how it performs and then if it confirms our intuition, we should remove the rule

@Wout4 Wout4 closed this as completed Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants