Subversion Repositories SmartDukaan

Rev

Rev 6646 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
78 naveen 1
import math
2051 rajveer 2
from math import sqrt, log
78 naveen 3
 
1915 rajveer 4
 
71 naveen 5
def getscore(struct):
78 naveen 6
 
7
    score = 0.0
8045 amit.gupta 8
    builtin_exp_score = 2.0
9
    ram_score = 2.0
10
    builtin = 0
11
    exp = 0
78 naveen 12
 
13
    if struct.has_key("features") :
14
        features = struct.get("features")
15
 
16
        if features.has_key("Built-in") :
17
            builtin = features.get("Built-in")
18
 
19
            if len(builtin) > 0 :
1362 rajveer 20
                builtin = float(builtin[0])
8045 amit.gupta 21
 
78 naveen 22
        # Expansion Capacity : 2, 4, 8, 16, 32
1915 rajveer 23
        if features.has_key("Expansion capacity") :
24
            expansion_capacity = features.get("Expansion capacity")
78 naveen 25
 
1915 rajveer 26
            if len(expansion_capacity) > 0 :
8045 amit.gupta 27
                exp = float(expansion_capacity[0])
1915 rajveer 28
                print "expansion_capacity=" + `expansion_capacity`
8045 amit.gupta 29
 
30
        total_memory = 3*builtin + exp
31
        if total_memory > 4*1024*1024:
32
            if total_memory >= 128*1024*1024:
33
                builtin_exp_score = 10.0
34
            else:
35
                builtin_exp_score = 2.0 + 1.6 * log(total_memory/(4*1024*1024), 2)
1915 rajveer 36
 
8045 amit.gupta 37
        if features.has_key("RAM") :
38
            ram = features.get("RAM")
39
            ram = float(ram[0])
40
            if ram > 1024*64:
41
                if ram >= 1024*1024*2:
42
                    ram_score = 10.0
43
                else:
44
                    ram_score = 2.0 + 1.6*log(ram_score/(64*1024), 2)
45
    print "builtin_exp_score" + `builtin_exp_score`
46
    print "ram_score" + `ram_score`
78 naveen 47
 
8045 amit.gupta 48
 
49
    score = (60*builtin_exp_score +  + 40*ram_score)/100
1915 rajveer 50
    return score