/[ascend]/trunk/solvers/conopt/conopttest.a4c
ViewVC logotype

Annotation of /trunk/solvers/conopt/conopttest.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1491 - (hide annotations) (download) (as text)
Sun Jun 10 13:49:39 2007 UTC (16 years, 3 months ago) by jpye
Original Path: trunk/models/johnpye/conopt/conopttest.a4c
File MIME type: text/x-ascend
File size: 1218 byte(s)
Moved all solvers to dynamically loaded modules currently in folder models/johnpye.
Location of these files will ultimately change.
1 johnpye 786 REQUIRE "atoms.a4l";
2    
3 jpye 1491 IMPORT "johnpye/conopt/conopt";
4    
5 jpye 1345 (*
6     This example model comes from the CONOPT documentation, which is
7     distributed with CONOPT.
8     *)
9 jpye 1491 MODEL conopttest;
10 johnpye 786 Profit, Inp, Out IS_A solver_var;
11 johnpye 788 P, L IS_A solver_var;
12 johnpye 786
13 johnpye 788 K IS_A real_constant;
14 johnpye 791 Al, Ak, Ainp, Rho IS_A solver_var;
15 johnpye 786 Pinp, P0, D IS_A real_constant;
16     W, L0, K0 IS_A real_constant;
17    
18 johnpye 788 cesfn: Out = ( Al*L^(-Rho) + Ak*K^(-Rho) + Ainp*Inp^(-Rho) )^(-1/Rho);
19 johnpye 786
20 johnpye 788 demandfn: Out = ( P0 - P ) / D;
21 johnpye 786
22     W :== 1.0;
23     L0 :== 0.1;
24     Pinp :== 1.0;
25 johnpye 791
26 johnpye 786 K0 :== 4.0;
27     P0 :== 2.0;
28     D :== 0.5;
29 johnpye 788 K :== K0;
30 johnpye 786
31 johnpye 788 profitfn: Profit = P*Out - (L-L0)*W - Inp*Pinp;
32     maxprofit: MAXIMIZE Profit;
33 johnpye 786
34     METHODS
35    
36     METHOD default_self;
37 johnpye 789 L := 0.5;
38     Inp := 0.5;
39 johnpye 786 END default_self;
40    
41     METHOD specify;
42 johnpye 791 FIX Al, Ak, Ainp, Rho;
43 johnpye 786 END specify;
44    
45     METHOD values;
46 johnpye 791 Al := 0.16;
47     Ak := 2.00;
48     Ainp := 0.16;
49     Rho := 1.0;
50    
51 johnpye 788 L.lower_bound := L0;
52     P.lower_bound := 0;
53     Out.lower_bound := 0;
54 johnpye 789 Inp.lower_bound := -0.001;
55 johnpye 786 END values;
56    
57     METHOD on_load;
58     RUN default_self;
59     RUN specify;
60     RUN values;
61     END on_load;
62    
63     METHOD self_test;
64 johnpye 788 ASSERT abs(L - 0.295686) < 0.000001;
65     ASSERT abs(Inp - 0.295686) < 0.000001;
66     ASSERT abs(Out - 0.632019) < 0.000001;
67     ASSERT abs(P - 1.683990) < 0.000001;
68 johnpye 786 END self_test;
69    
70 jpye 1491 END conopttest;

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