root/vtcross/branches/nikhil/crossmodel2/src/libvtcross/test1.py @ 570

Revision 570, 1.1 KB (checked in by nikhil, 14 years ago)
Line 
1from cross import *
2
3import time
4
5def main():
6       
7        CN1 = "localhost"
8        CN2 = "40000"
9
10        SetCrossShellLocation(CN1,CN2)
11
12        p = Parameter(2)
13        currentParameters = Parameter(2)
14        o = Observable(2)
15        u = Utility(2)
16
17        u[0].name = "ber"
18
19
20        for i in range(0,30):
21                if i is 0:
22                        currentParameters[0].name = "Txpower"
23                        currentParameters[0].value = 1.0
24               
25                        currentParameters[1].name = "Modscheme"
26                        currentParameters[1].value = 4.0
27                else:
28                        currentParameters[0].value = p[0].value
29                        currentParameters[1].value = p[1].value
30
31                print "Application:: Requesting parameter optimization"
32       
33                p = GetOptimalParameters(o,0,currentParameters,2,u,1)
34
35                print "parameters : " + p[0].name + " : " + str(p[0].value) + " "
36                print "parameters : " + p[1].name + " : " + str(p[1].value) + "\n"
37
38                print "Application:: Receiving the following parameters.\n"
39       
40                u1 = (p[0].value)/25
41
42                u2 = (p[1].value)/20
43
44                u[0].value = 1 - u1 + u2
45
46                print "utilities " + u[0].name + " = " + str(u[0].value) + "\n"
47
48                time.sleep(0.5)
49
50                UpdateParameterPerformance(p,2,o,0,u,1)
51
52if __name__ == "__main__" :
53        main()
54
Note: See TracBrowser for help on using the browser.