Exemplo n.º 1
0
def main():
    fn.init()
    myself = Student()  # 创建实例

    fn.login(myself)  # 登录

    """主循环"""
    while True:
        get_input = fn.menu()
        if get_input == 1:
            exit()
        elif get_input == 2:
            fn.add_new_test(myself)
        elif get_input == 3:
            fn.make_bar_graph(myself)
        elif get_input == 4:
            fn.remove_test(myself)
        elif get_input == 5:
            fn.change_results(myself)
        elif get_input == 6:
            fn.make_line_graph(myself)
        elif get_input == 7:
            fn.show_tests_list(myself)
        elif get_input == 8:
            fn.show_test_info(myself)
        elif get_input == 9:
            fn.rename_test(myself)
        elif get_input == 10:
            fn.change_passwd(myself)
Exemplo n.º 2
0
def create_New_Toplevel(root, *args, **kwargs):
    '''Starting point when module is imported by another program.'''
    global w, w_win, rt
    rt = root
    w = Toplevel(root)
    top = New_Toplevel(w)
    functions.init(w, top, *args, **kwargs)
    return (w, top)
Exemplo n.º 3
0
def vp_start_gui():
    '''Starting point when module is the main routine.'''
    global val, w, root
    root = Tk()
    top = New_Toplevel(root)
    functions.init(root, top)
    #functions.timerFiredWrapper(root, top)
    root.mainloop()
Exemplo n.º 4
0
def main():
    method = None
    option = None
    directory = None
    out = None
    key = None

    method, option, directory, out, key = init_options()

    if option == '-i':
        init(method, directory, out, key)
    elif option == '-t':
        track(method, directory, out, key)
    elif option == '-x':
        if remove(directory):
            print("Programa guarda removido da pasta " + str(directory))
Exemplo n.º 5
0
def startit():
    global avg
    start = timer()
    
    old = start
    popn = init(POPULATION_SIZE, PERMUTATION_LENGTH)       
    i=0
    globmin = popn[0]
    while i<MAXITERATIONS and globmin.fitness>=118283:
        i+=1
        natselect(popn, TOURNAMENT_SIZE)
        if i%1000==0:
            globmin = getbest()
            current = timer()
            print '\n-----------------------------'
            print 'elapsed time: ' + str(current-old) + '\niteration: ' + str(i) + '\nfitness: ' + str(globmin.fitness) + '\n'
            print globmin. route
            old = current
    print '\nCOMPLETE!\niteration: ' + str(i)
    print globmin. route
    end = timer()
    avg.append(end-start)
    print '\ntotal time: ' + str(end-start)
    del popn[:]
    return (end-start, i)
Exemplo n.º 6
0
def main(A, B, C, eps, sim_steps = 100):
    """
        Genetic Algorithm simulation with a given number of steps and initial values: A, B, C, eps,
        required for the goal function calculation.
        :return: Last population after GA simulation is finished.
        """
    steps = int(sim_steps)  # simulation steps
    p_c = 0.15  # cross over probability # 0.15
    p_m = 0.0005  # mutation probability # 0.0005
    p_i = 0.0001  # inversion probability # 0.0001

    pop_size = 200  # 200
    ### INITIALIZATION ###
    pop = func.init(pop_size, 'multinomial')
    best_fs = [] # goal function of the best one in populationin each step
    fs = [] # summary goal function of the population in each step
    for ii in range(0, steps):
        ##### 1 SELECTION
        p_sel = func.selection(pop, A, B, C, eps)
        fs.append(np.sum(p_sel))
        best_fs.append(np.max(p_sel))
        new_pop = func.roulette_select(pop, p_sel, pop_size)

        ##### 2 CROSSOVER
        pop = func.crossover(new_pop, pop_size, p_c)

        ###### 3 MUTATION
        for cc in range(0, len(pop)):
            pop[cc] = func.mutate(pop[cc], p_m)

        ###### 4 INVERSION
        probs_inv = np.random.uniform(size=len(pop))
        for nn in range(0, len(probs_inv)):
            if probs_inv[nn] < p_i:
                pop[nn] = func.inverse(pop[nn])

    # after the GA steps >= simulation steps - i.e. the result of GA
    # the code below calculates results averaged over the whole population
    vals = np.zeros(16)
    get_av = False
    if get_av:
        for ii in range(0, 16):
            for em in pop:
                vals[ii] += em[ii]
        vals /= pop_size
        terminal_view(vals)

    return pop, vals, np.array(best_fs), fs
Exemplo n.º 7
0
def init(config):
    ## Initialise jarvis kernel
    jarvis = kernel.kernel(config)

    ## Connect to data source
    jarvis.register('data', data.init(jarvis))

    ## Initialise functions
    jarvis.register('function', functions.init())

    ## Set up interfaces
    jarvis.register('interface', interfaces.init(jarvis))

    ## Finish setup
    jarvis.setup()

    return jarvis
Exemplo n.º 8
0
def handle_text(bot, update):
    global state
    print('test')

    try:
        print('HEY')
        #chat_id = update.message.chat_id
        if state == 'init':
            state = init(bot, update)
        elif state == 'wait products':
            state = wait_products(bot, update)
        elif state == 'wait number':
            state = wait_number(bot, update)
        elif state == 'choose option':
            state = choose_option(bot, update)
    except Exception as e:
        print('Error!!!! What: ' + str(e))
        return
Exemplo n.º 9
0
import functions as app

if __name__ == '__main__':
    app.init()
    app.process()
    app.end()
Exemplo n.º 10
0
from functions import init

files = [
    'classification_datasets/cars.csv', 'classification_datasets/abalone.csv',
    'classification_datasets/bloodTransfusion.csv',
    'classification_datasets/ticΤacΤoe.csv',
    'classification_datasets/balanceScale.csv',
    'classification_datasets/bestSellersBooks.csv',
    'classification_datasets/haberman.csv',
    'classification_datasets/hayesRoth.csv',
    'classification_datasets/lenses.csv',
    'classification_datasets/drugTypes.csv'
]

init(files, 'Classification')
Exemplo n.º 11
0
    print("\033[1;33mOlá! Bem-vindo ao Header!\033[0;0m")
    print("\033[1;32mStatus do Header: iniciado\033[0;0m" if status ==
          True else "\033[1;31mStatus do Header: não iniciado\033[0;0m")
    print("\033[1;32mPara obter ajuda no uso da ferramenta, digite:\033[0;0m")
    print("python3 header.py help")
else:
    arg.pop(0)

if status and arg[0].lower() == "w":
    print(functions.write(arg))
elif status and arg[0].lower() == "ws":
    print(functions.write_save(arg, directory))
elif status and arg[0].lower() == "s":
    print(functions.save(arg, directory))
elif status and arg[0].lower() == "c":
    print(functions.create(arg, directory))
elif not status and arg[0].lower() == "init":
    print(functions.init(directory))
elif status and arg[0].lower() == "init":
    print("Seu Header já foi iniciado!")
elif status and arg[0].lower() == "list":
    functions.list_ws(directory)
elif status and arg[0].lower() == "e":
    print(functions.edit(arg, directory))
elif status and arg[0].lower() == "d":
    print(functions.delete(arg, directory))
elif arg[0].lower() == "help":
    help("header")

config.close()
Exemplo n.º 12
0
from functions import init

init()  # init en start tkinter scherm
Exemplo n.º 13
0
import functions

functions.init("english")
Exemplo n.º 14
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''-----------------------------------------------------------------------------
							FINAL PROJECT PRS
							     main.py
Author: Émilio G!
Date: from April 30 to May 26th
Version: 1.0
Description: This program generates audio waves and play them in real time.
You can adjust amplitudes and frequencies, and change the waves' type. You can
manage up to 5 waves (WARNING: even though the program is very light on ram
usage, you might experience unfluid sound. During development, my intel 3570K
could only manage a maximum of 2 waves at the same time. My laptop could barely
manage one without having interruptions in the audio stream or crashes that
ruined the experience. If you experience fluidity issues, try running the
program using another computer.). The GUI was created using Tkinter and most of
the calculations are done with numpy. Use this program as you wish, but please
give me credits for it :).
-----------------------------------------------------------------------------'''

import functions as fn

fn.init()
from functions import init

files = [
    'regression_datasets/aquaticΤoxicity.csv',
    'regression_datasets/slumpΤest.csv', 'regression_datasets/drivePoints.csv',
    'regression_datasets/southGermanCredit.csv',
    'regression_datasets/carPriceAssignment.csv',
    'regression_datasets/insurance.csv', 'regression_datasets/realΕstate.csv',
    'regression_datasets/winequalityRed.csv',
    'regression_datasets/diabetes.csv', 'regression_datasets/advertising.csv'
]

init(files, 'Regression')
Exemplo n.º 16
0
#!/usr/bin/python3
import cgi, cgitb
import xml.etree.ElementTree as ET
import functions as fun
from datetime import datetime
import os, sys

fun.init()
print ("Content-type:text/xml\r\n\r\n")

form = cgi.FieldStorage()

username = form.getvalue('username')
password = form.getvalue('password')


user = fun.getUser(username,password)

if user == None:
	print ("<error>Username and Password do not match up</error>")
	sys.exit()

if user[3] == 1:
	ID = user[4]
elif user[3] == 2:
	ID = form.getvalue('ID')
	if ID == None:
		print('<error>No Student ID Given On Teacher Account</error>')
		sys.exit()

sdate = form.getvalue("sdate")