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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 797 - (show annotations) (download) (as text)
Mon Jul 31 10:52:34 2006 UTC (14 years, 2 months ago) by johnpye
File MIME type: text/x-ascend
File size: 1031 byte(s)
Added 'testcmslv' model.
Fixed error in CONOPT build test.
1 REQUIRE "atoms.a4l";
2
3 (*
4 Model the solution of a piecewise-specified continuous x-y curve
5
6 + 3
7 | '
8 | / (y-2)=(x-1)^2 for x > 1
9 | .`
10 + 2 ,-'
11 | .'
12 | .' y = x + 1 otherwise
13 |.'
14 # 1
15 # x = 0 for y < 1;
16 #
17 #------+------+-----+->
18 0 1 2 3
19 *)
20 MODEL testcmslv;
21 x IS_A factor;
22 y IS_A factor;
23
24 isvert: y <= 1;
25 isparab: x > 1;
26
27 vert: x = 0;
28 diag: y = x + 1;
29 parab:y - 2 = (x - 1)^2;
30
31 isvertp IS_A boolean_var;
32 isvertp = SATISFIED(isvert);
33
34 isparabp IS_A boolean_var;
35 isparabp = SATISFIED(isparab);
36
37 WHEN (isvertp, isparabp)
38 CASE TRUE,FALSE:
39 USE vert;
40 CASE FALSE,TRUE:
41 USE parab;
42 OTHERWISE :
43 USE diag;
44 END WHEN;
45
46 METHODS
47 METHOD default_self;
48 isvert := FALSE;
49 isparam := FALSE;
50 y := 0.5;
51 x := 0.5;
52 END default_self;
53
54 METHOD values;
55 x := 3;
56 END values;
57
58 METHOD specify;
59 FIX x;
60 END specify;
61
62 METHOD on_load;
63 RUN default_self; RUN values; RUN specify;
64 END on_load;
65
66 END testcmslv;

Properties

Name Value
svn:executable *

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