Revision 302, 0.7 KB
(checked in by trnewman, 15 years ago)
|
Python demo updates
|
-
Property svn:executable set to
*
|
Rev | Line | |
---|
[302] | 1 | # Simple Python demonstration script for using |
---|
| 2 | # the CROSS system. |
---|
| 3 | # |
---|
| 4 | # Use with demo.xml shell configuration file |
---|
| 5 | # Instructions: |
---|
| 6 | # Start shell with demo.xml config from the examples directory |
---|
| 7 | # Start cognitive engine |
---|
| 8 | # Run this script |
---|
| 9 | # |
---|
| 10 | |
---|
[299] | 11 | from cross import * |
---|
| 12 | |
---|
| 13 | p = Parameter(2) |
---|
| 14 | currentParameters = Parameter(2) |
---|
| 15 | o = Observable(2) |
---|
| 16 | |
---|
| 17 | o[0].value = 150.00 |
---|
| 18 | o[0].name = "throughput" |
---|
| 19 | |
---|
| 20 | o[1].name = "PER" |
---|
| 21 | o[1].value = 12.00 |
---|
| 22 | |
---|
| 23 | currentParameters[0].name = "bandwidth" |
---|
| 24 | currentParameters[0].value = 300.0 |
---|
| 25 | |
---|
| 26 | currentParameters[1].name = "bandwidth" |
---|
| 27 | currentParameters[1].value = 10.0 |
---|
| 28 | |
---|
| 29 | p = GetOptimalParameters(o,2,currentParameters,2); |
---|
[301] | 30 | |
---|
| 31 | for i in range(2): |
---|
| 32 | print p[i].name, p[i].value |
---|
| 33 | |
---|
| 34 | |
---|