26 lines
607 B
Python
26 lines
607 B
Python
import math
|
|
import numpy as np
|
|
|
|
from model.base_model import Model
|
|
|
|
class MyModel(Model):
|
|
def __init__(self):
|
|
super().__init__()
|
|
|
|
def init(self, nodes):
|
|
"""
|
|
Put your initialization here.
|
|
"""
|
|
super().init(nodes)
|
|
|
|
self.log("Nothing to initialize in your model now")
|
|
|
|
def fit(self, max_it=1000):
|
|
"""
|
|
Put your iteration process here.
|
|
"""
|
|
self.best_solution = np.random.permutation(self.N).tolist()
|
|
self.fitness_list.append(self.fitness(self.best_solution))
|
|
|
|
return self.best_solution, self.fitness_list
|