Skip to content

Commit 1fe0b3a

Browse files
committed
Add benchmarks
1 parent b325a94 commit 1fe0b3a

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

test/perf/nl_alias_cache.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Part of the problem is this horrific block:
2+
```
3+
@expression(household, betaks[r=R,s=S],
4+
kd0[r,s]/sum(kd0[rr,ss] for rr∈R,ss∈S)
5+
)
6+
7+
@expressions(household, begin
8+
PI_KS, sum(betaks[r,s]*RK[r,s]^(1+etaK) for r∈R,s∈S)^(1/(1+etaK))
9+
O_KS_RK[r=R,s=S], kd0[r,s]*(RK[r,s]/PI_KS)^etaK
10+
I_RKS_KS, sum(kd0[r,s] for r∈R,s∈S)
11+
end)
12+
13+
@constraint(household, prf_KS,
14+
RKS*I_RKS_KS - sum(RK[r,s]*O_KS_RK[r,s] for r∈R,s∈S) ⟂ KS
15+
)
16+
```
17+
18+
`|R|` is 51 and `|S|` is 71. So `PI_KS` contains $O(|R| \times |S|)$ terms. This appears in the denominator of `O_KS_RK`, and `O_KS_RK` appears `prf_KS` $O(|R| \times |S|)$ times. So the function has $O(|R|^2 \times |S|^2) = 13,111,641$ terms. Ouch.

0 commit comments

Comments
 (0)