#πŸ”’ Simulated annealing on 8queens HELP please

4 messages Β· Page 1 of 1 (latest)

ruby lark
#

Hi, I'm working on a slightly modified version of 8 queens and my simulated annealing failures to find any answers the temperature is decreasing I've checked the neighbours and acceptance probability functions many times and checked quite a bit if you need to see more of the code I can message you any functions you need.

def simulated_annealing(self):
    solution = self.queens.copy()
    energy = self.cost()
    static_queen = self.static_queen.copy()
    iterations = 0

    while self.temperature > 1.0:
        new_solution = random.choice(self.neighbours(solution))
        new_energy = self.cost()

        if self.acceptance_probability(energy, new_energy):
            solution = new_solution
            energy = new_energy
            static_queen = self.update_queens(solution)

        self.temperature *= self.energy_consumption
        print(self.temperature)

        iterations += 1

    return solution, energy, static_queen, iterations

def update_queens(self, board_state):
    for column in board_state:
        if column not in self.static_queen:
            self.static_queen[column] = board_state[column]
tall mortarBOT
#

@ruby lark

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

tall mortarBOT
#

@ruby lark

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.