예제 #1
0
def opt_fg():
    #Check if queue.txt is usable
    log, ts, it_n, first_guess, queue_txt = fc.setup(True)

    #Get data and sample them
    one_queue, shift_queue = fc.sample_data(queue_txt, log)
    fc.print_pic_1_2(one_queue, shift_queue, queue_txt, it_n, ts, log)

    waiter, cooks = fc.allocation_fg(log, first_guess)

    fc.write_to_file(log, waiter, cooks, True)

    fc.print_3_fg(ts, log, first_guess)
    fc.print_3_im_new_all(ts, it_n, log, waiter, cooks)

    #Check for number of values file
    fc.finish(it_n, log)
예제 #2
0
파일: run.py 프로젝트: widmedia/start
def callSingleTest(driver, testNum, ALL_TESTS, testsToRun):
  from loginLogout import doLoginLogout
  from newUser import doNewUser
  from editLinks import doEditLinks
  
  if ALL_TESTS[testNum] in testsToRun:       
    if testNum == 0:
      result = doLoginLogout(driver, testNum)
    elif testNum == 1:
      result = doNewUser(driver, testNum)
    elif testNum == 2: 
      result = doEditLinks(driver, testNum)
    else:
      result = False
    # end if-elif
    if (not(result)): 
      finish(driver)
    print("----")
예제 #3
0
def opt():
    #Set objectives
    obj_5ord = 0.7
    obj_8ord = 0.99
    obj_5kit = 0.7
    obj_8kit = 0.82

    #Set timestamp and iterationnumber and if queue.txt is usable
    log, ts, it_n, exp_txt, queue_txt = fc.setup()

    #Analyse previous results
    mean_res, std_res = fc.analyse(exp_txt, log)

    #Objectives fulfilled?
    fc.obj_fulfill(mean_res, log)

    #Utilisation rates
    fc.ut_rates(mean_res, log)

    #Get data and sample them
    one_queue, shift_queue = fc.sample_data(queue_txt, log)

    # print 1_queue_Iteration and 2_shift_queue_iteration
    max_dia = fc.print_pic_1_2(one_queue, shift_queue, queue_txt, it_n, ts,
                               log)

    #Update staff allocation (1. get and allocate, 2. update queues, 3. update obj)
    waiter, cooks = fc.allocation(log)
    waiter, cooks, co_ql = fc.upd_ql(log, it_n, waiter, cooks, shift_queue)
    waiter, cooks, co_obj = fc.upd_obj(log, it_n, waiter, cooks, shift_queue,
                                       mean_res)
    waiter, cooks, co_sm = fc.upd_sm(log, it_n, waiter, cooks, co_ql, co_obj)
    fc.print_changes(log, waiter, cooks, co_ql, co_obj, co_sm)
    print(waiter)
    print(cooks)
    #Write to files (allocation_staff.xlsx, waiter.txt, cook.txt)
    fc.write_to_file(log, waiter, cooks)

    #produce staffing plot
    fc.print_3_im_new_all(ts, it_n, log, waiter, cooks)

    #Clean up, update iterationnumber
    fc.finish(it_n, log)
예제 #4
0
            # Playing and comparing cards by rank
            card1 = player1.hand.play()
            rank1 = get_rank(card1)
            print(f'\n{player1.name} played [{card1}] rank: {rank1}')

            card2 = computer.hand.play()
            rank2 = get_rank(card2)
            print(f'{computer.name} played [{card2}] rank: {rank2}\n')


            if rank1 == rank2:
                war(player1, computer, crd_id)

            elif rank1 > rank2:
                win(player1, computer, card2)

            elif rank1 < rank2:
                win(computer, player1, card1)

            # Monitoring deck changes in terminal
            print(f"\n{player1.name}'s deck\n{player1.hand.deck}")
            print(f"{player1.name}'s deck lenght: {len(player1.hand.deck)}")
            print(f"\n{computer.name}'s deck\n{computer.hand.deck}")
            print(f"{computer.name}'s deck lenght: {len(computer.hand.deck)}")

            # Win check
            if len(computer.hand.deck) == 0:
                game_won = finish(player1)
            elif len(player1.hand.deck) == 0:
                game_won = finish(computer)
예제 #5
0
파일: run.py 프로젝트: widmedia/start
ALL_TESTS = ['loginLogout', 'newUser', 'editLinks']


# input processing
testsToRun = []
if len(sys.argv) < 2:  # this means no argument has been given. Running all tests
  testsToRun = ALL_TESTS  
elif len(sys.argv) == 2:
  if sys.argv[1] in ALL_TESTS:  # find the argument
    testsToRun = [sys.argv[1]]
  else:
    printUsage(ALL_TESTS)
  # end if 
else:
    printUsage(ALL_TESTS)
# end if


# execution of the tests
if len(testsToRun) > 0:
  # Create a new instance of the Firefox driver
  driver = webdriver.Firefox()
  driver.set_window_size(500, 700) # about mobile size, portrait style
  driver.implicitly_wait(5) #wait 5 seconds when doing a find_element before carrying on  

  for i in range(0, len(ALL_TESTS)):
    callSingleTest(driver, i, ALL_TESTS, testsToRun)
  
  printOkOrNot(ok=True, testNum="==>", text="Selected tests execution")
  finish(driver)
# end if len testsToRun
예제 #6
0
        #The user selects food
        selected_food = user_selection(list_food,
                                       """Aliments de la categorie '{}'' :""".format(selected_category.name))

        #Display the data
        display_food(selected_food)

        #Save the product in the bookmarks if necessary
        if save_substitute(selected_food) == True:
            with db:
                modify_food = FoodSubstituted.update(is_saved=True).where(FoodSubstituted.id ==
                                                                          selected_food.id)
                modify_food.execute()

        #Finish the program or restart at the begin
        if finish() == True:
            ACTIVE = False

    #If the user wants to see all already subsituted products
    elif choice == "2":
        #Get all bookmarks
        with db:
            list_saved_sub = FoodSubstituted.select().where(FoodSubstituted.is_saved == True)

        #The user selects the bookmark that he wants
        selected_sub = user_selection(list_saved_sub, "Vos aliments favoris sont :")

        #Display th data
        display_food(selected_sub)

        #Finish the program or restart at the begin
예제 #7
0
def test_finish():
    	assert callable(finish)
	assert finish is not None
	assert finish('Darth', 'Jacob', 'curved-handled', 'blue', 'magus', 'BB') ==
	"Generated character: Darth Jacob who wields a curved-handled blue" 
	+ " lightsaber with a magus emitter, and a BB companion."