-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexambin.py
More file actions
56 lines (39 loc) · 898 Bytes
/
exambin.py
File metadata and controls
56 lines (39 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Example binary
import random
class Solution:
def __init__(self):
self.program=[]
def generateSimpleSolutions(self,var):
pass
class Razonador:
def __init__(self):
self.examples=ExamBin()
while True:
match random.randomint(0,2):
case 0:
print("Genera una nueva solucion")
# get random sample
sample = random.choice(self.examples.examples)
case 1:
print("Muta una solucion")
case 2:
print("Testea una solucion")
class ExamBin:
def __init__(self):
self.makeExamples()
def makeExamples(self):
examples=1000
self.examples=[]
for i in range(examples):
var={}
var["a"]=random.random()*2-1
var["b"]=random.random()*2-1
var["c"]=random.random()*2-1
self.examples.append(var)
def simple(self,var):
if var["c"]<0:
return var["a"]
else:
return var["b"]
if __name__ == "__main__":
ExamBin()