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

Performance: function scales badly when the domain is not known at compile-time #674

Open
jwatts-maybe opened this issue Dec 3, 2024 · 0 comments

Comments

@jwatts-maybe
Copy link

A few examples of models finding a constant function on a domain of fixed size (in this case 64, but easily modified):
a)

letting m be 64
find dmap : function int(1..m) --> int(0..0)
such that forAll p : int(1..m) . dmap(p) = 0

b)

letting m be 64
find d : set of int(1..m)
maximising |d|

find dmap : function int(1..m) --> int(0..0)
such that forAll p in d . dmap(p) = 0

d)

letting n be 6
find dmap : function set of int(1..n) --> int(0..0)
such that forAll p : set of int(1..n) . dmap(p) = 0

c)

find dmap : function set of int(0..5) --> int(0..0)
such that forAll p in powerSet({0,1,2,3,4,5}) . dmap(p) = 0

Using the size of the generated minion model as a very rough, easy benchmark of performance, these examples behave very differently:

  • Model (a) does not scale with m: the generated minion model is of fixed size.
  • Model (b) grows linearly as m increases - roughly 16kb for m=64 on my system.
  • Models (c) and (d) grow quadratically with the size of domain (i.e. fourth-power growth with n) - roughly 3.5mb for n=6 on my system. The two models differ slightly, but not by much.

Obviously on their own these are not hugely consequential examples, but I have found that when attempting to work with objects of actual interest, the file sizes quickly scale into hundreds of mb (and based on observed growth, beyond), becoming functionally unsolvable. It would be helpful if a much wider range of functions were supported efficiently.


From discussion with Oz, it seems this is due to the latter cases needing to fall back to FunctionAsRelation, rather than using Function1DPartial.

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