1 |
REQUIRE "atoms.a4l"; |
2 |
|
3 |
MODEL testconopt; |
4 |
Profit, Inp, Out IS_A solver_var; |
5 |
P, L IS_A solver_var; |
6 |
|
7 |
K IS_A real_constant; |
8 |
Al, Ak, Ainp, Rho IS_A real_constant; |
9 |
Pinp, P0, D IS_A real_constant; |
10 |
W, L0, K0 IS_A real_constant; |
11 |
|
12 |
cesfn: Out = ( Al*L^(-Rho) + Ak*K^(-Rho) + Ainp*Inp^(-Rho) )^(-1/Rho); |
13 |
|
14 |
demandfn: Out = ( P0 - P ) / D; |
15 |
|
16 |
W :== 1.0; |
17 |
L0 :== 0.1; |
18 |
Pinp :== 1.0; |
19 |
Al :== 0.16; |
20 |
Ak :== 2.00; |
21 |
Ainp :== 0.16; |
22 |
Rho :== 1.0; |
23 |
K0 :== 4.0; |
24 |
P0 :== 2.0; |
25 |
D :== 0.5; |
26 |
K :== K0; |
27 |
|
28 |
profitfn: Profit = P*Out - (L-L0)*W - Inp*Pinp; |
29 |
maxprofit: MAXIMIZE Profit; |
30 |
|
31 |
METHODS |
32 |
|
33 |
METHOD default_self; |
34 |
L := 0.5; |
35 |
Inp := 0.5; |
36 |
END default_self; |
37 |
|
38 |
METHOD specify; |
39 |
END specify; |
40 |
|
41 |
METHOD values; |
42 |
L.lower_bound := L0; |
43 |
P.lower_bound := 0; |
44 |
Out.lower_bound := 0; |
45 |
Inp.lower_bound := -0.001; |
46 |
END values; |
47 |
|
48 |
METHOD on_load; |
49 |
RUN default_self; |
50 |
RUN specify; |
51 |
RUN values; |
52 |
END on_load; |
53 |
|
54 |
METHOD self_test; |
55 |
ASSERT abs(L - 0.295686) < 0.000001; |
56 |
ASSERT abs(Inp - 0.295686) < 0.000001; |
57 |
ASSERT abs(Out - 0.632019) < 0.000001; |
58 |
ASSERT abs(P - 1.683990) < 0.000001; |
59 |
END self_test; |
60 |
|
61 |
END testconopt; |