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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 788 - (hide annotations) (download) (as text)
Thu Jul 27 03:17:54 2006 UTC (18 years, 3 months ago) by johnpye
File MIME type: text/x-ascend
File size: 1039 byte(s)
CONOPT running with testconopt.a4c but seems to give the wrong answer still.
1 johnpye 786 REQUIRE "atoms.a4l";
2    
3     MODEL testconopt;
4     Profit, Inp, Out IS_A solver_var;
5 johnpye 788 P, L IS_A solver_var;
6 johnpye 786
7 johnpye 788 K IS_A real_constant;
8 johnpye 786 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 johnpye 788 cesfn: Out = ( Al*L^(-Rho) + Ak*K^(-Rho) + Ainp*Inp^(-Rho) )^(-1/Rho);
13 johnpye 786
14 johnpye 788 demandfn: Out = ( P0 - P ) / D;
15 johnpye 786
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 johnpye 788 K :== K0;
27 johnpye 786
28 johnpye 788 profitfn: Profit = P*Out - (L-L0)*W - Inp*Pinp;
29     maxprofit: MAXIMIZE Profit;
30 johnpye 786
31     METHODS
32    
33     METHOD default_self;
34     END default_self;
35    
36     METHOD specify;
37     END specify;
38    
39     METHOD values;
40 johnpye 788 L.lower_bound := L0;
41     P.lower_bound := 0;
42     Out.lower_bound := 0;
43     Inp.lower_bound := 0;
44 johnpye 786 END values;
45    
46     METHOD on_load;
47     RUN default_self;
48     RUN specify;
49     RUN values;
50     END on_load;
51    
52     METHOD self_test;
53 johnpye 788 ASSERT abs(L - 0.295686) < 0.000001;
54     ASSERT abs(Inp - 0.295686) < 0.000001;
55     ASSERT abs(Out - 0.632019) < 0.000001;
56     ASSERT abs(P - 1.683990) < 0.000001;
57 johnpye 786 END self_test;
58    
59     END testconopt;

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