/[ascend]/trunk/models/johnpye/testconopt.a4c
ViewVC logotype

Contents of /trunk/models/johnpye/testconopt.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 789 - (show annotations) (download) (as text)
Thu Jul 27 04:35:17 2006 UTC (18 years, 4 months ago) by johnpye
File MIME type: text/x-ascend
File size: 1068 byte(s)
Working version of testconopt.a4c now. This model yeilds the solution given in the CONOPT tutorial.
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;

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22