Example #1
0
    def __init__(self, center=[460, 550], size=[800, 800]):
        super(AntOptSim, self).__init__(center, size)
        self.pher_matrix = np.ones(
            (self.cities.shape[0], self.cities.shape[0])) * 0.3
        self.current_city = 0
        self.target_city = 0
        self.ant_position = self.cities[0]
        self.path = [0]
        self.moving = False
        self.moving_angle = np.array([1, 0])

        self.beta_obj = [0]
        self.alpha_obj = [0]

        self.buttons.update({
            "BetaSlider":
            Slider(self.beta_obj, (0, 1), (1500, 550), "Beta", float),
            "AlphaSlider":
            Slider(self.alpha_obj, (0, 1), (1500, 700), "Alfa", float)
        })
Example #2
0
    def __init__(self, center=[460, 550], size=[800, 800]):
        super(AntColOptSim, self).__init__(center, size)

        self.ant_count_obj = [INITIAL_ANTS]
        self.beta_obj = [0]
        self.alpha_obj = [0]
        self.exp_obj = [0]
        self.r_obj = [0]
        self.resetSimulation()

        self.buttons["SimSpeedSlider"].moveCenter([1500, 300])
        self.buttons.update({
            "AntCountSlider":
            Slider(self.ant_count_obj, (INITIAL_ANTS, 20), (1500, 400),
                   "Broj mrava", int),
            "BetaSlider":
            Slider(self.beta_obj, (0, 1), (1500, 500), "Beta", float),
            "AlphaSlider":
            Slider(self.alpha_obj, (0, 1), (1500, 600), "Alfa", float),
            "ExploreSlider":
            Slider(self.exp_obj, (0, 100), (1500, 700), "Istraži%", int),
            "RSlider":
            Slider(self.r_obj, (0, 1), (1500, 800), "R", float)
        })
 def __init__(self, center=[460, 550], size=[800, 800]):
     self.center = np.array(center)
     self.size = np.array(size)
     self.cities = np.array([[-180, -200], [200, 50], [-200, 50], [0, 300],
                             [150, -150]])
     self.clicked_city = -1
     self.screen_update = False
     self.simulate = False
     self.simulation_speed_obj = [1]
     self.buttons = {
         "AddCity":
         Button(self.center + self.size / 2 * [-1, 1] + [100, 50],
                size=(200, 100),
                color=colors['Blue'],
                clicked_color=colors['DarkBlue'],
                text="Dodaj grad",
                action=self.addCity),
         "RemoveCity":
         Button(self.center + self.size / 2 * [-1, 1] + [300, 50],
                size=(200, 100),
                color=colors['Purple'],
                clicked_color=colors['DarkPurple'],
                text="Skloni grad",
                action=self.removeCity),
         "StartSimulation":
         ToggleButton(self.center + self.size / 2 + [-150, 50],
                      size=(300, 100),
                      color=colors['Green'],
                      clicked_color=colors['DarkRed'],
                      text="Simuliraj",
                      action=self.toggleSimulation,
                      action_arg=True,
                      alt_text="Zaustavi Simulaciju",
                      alt_action=self.toggleSimulation,
                      alt_action_arg=False),
         "SimSpeedSlider":
         Slider(self.simulation_speed_obj, (1, 10), (1500, 400),
                "Brzina simulacije")
     }
Example #4
0
 def test_slider_nav(self):
     self.assertTrue(Slider(self.driver).check_next_slides_group())
Example #5
0
 def test_slider_plate_fields(self):
     self.assertTrue(Slider(self.driver).check_plates())