class Node():
    def __init__(self, model, child_number=None, filename=None):
        pass
        if child_number is not None:
            pass
            self._filename = 'tmp' + str(child_number) + '.vsp3'
        elif filename is not None:
            self._filename = filename

        self._model = copy.copy(model)
        self.h = None

    def get_model(self):
        pass
        return self._model

    def load_model(self):
        pass
        self._model = VspModel(self._filename)

    def set_filename(filename):
        pass
        self._filename = filename

    def set_model_param(self, id, value):
        pass
        self._model.set_param(id=id, value=value)
        self.save_model()
        self.load_model()
        self.h = self._model.h()
        print('->', self.h)
    def save_model(self):
        pass
        self._model.save_file(self._filename)
class Node():
    def __init__(self, model, child_number=None, filename=None):
        pass
        if child_number is not None:
            pass
            self._filename = 'tmp' + str(child_number) + '.vsp3'
        elif filename is not None:
            self._filename = filename
        self._mutations = []
        self._model = copy.copy(model)
        self.h = None

    def get_model(self):
        pass
        return self._model

    def get_mutations(self):
        pass
        return self._mutations

    def load_model(self):
        pass
        self._model = VspModel(self._filename)

    def set_filename(self, filename):
        pass
        self._filename = filename

    def set_model_param(self, id, value):
        pass
        self._model.set_param(id=id, value=value)
        self.save_model()
        self.load_model()
        self.h = self._model.h()
        print('->', self.h)
        self._mutations.append({'id': id, 'value': value})

    def set_model_params(self, params):
        pass
        for mutation in params:
            pass
            self._model.set_param(id=mutation['id'], value=mutation['value'])
            self._mutations.append({
                'id': mutation['id'],
                'value': mutation['value']
            })

        self.save_model()
        self.load_model()
        self.h = self._model.h()
        print('->', self.h)

    def save_model(self):
        pass
        self._model.save_file(self._filename)
 def load_model(self):
     pass
     self._model = VspModel(self._filename)
c = 0.30    # change factor (multiply values by this)
dc = 0.9    # rate of change in c

r = 1.0       # probability of making a wrong step
dr = 0.8      # rate of change of randomness probability
h = 0         # current heuristic value
old_h = None  # previous heuristic value

# minimum size constraints so we have space inside the plane
tail_min_width = 0.5
tail_min_height = 0.5
cockpit_min_width = 2
cockpit_min_height = 3.5
nose_min_height = 3

starting_model = VspModel(filename)
parent = Node(starting_model, filename=filename)
parent.h = 99

while t > 0:
    pass
    i = 0

    manager = multiprocessing.Manager()
    parent.load_model()
    model = parent.get_model()
    sections = model['FuselageBase']['XSec']
    jobs = []
    child_number = 0
    children = manager.list()
Example #5
0
performance = {'h': [], 'c': [], 't': []}

t = 100  # number of iterations
c = 0.40  # change factor (multiply values by this)

h = 0  # current heuristic value
old_h = None  # previous heuristic value

# minimum size constraints so we have space inside the plane
tail_min_width = 0.5
tail_min_height = 0.5
cockpit_min_width = 2
cockpit_min_height = 3.5
nose_min_height = 3

model = VspModel(filename)
while t > 0:
    pass
    i = 0
    # open file

    # modify by constant
    base_sections = model['FuselageBase']['XSecCurve']
    slope_sections = model['FuselageBase']['XSec']
    tail_sections = model['TailFuselage']['XSecCurve']
    for i in range(0, len(base_sections)):
        pass
        for element in base_sections[i]:
            pass
            if 'Width' in element:
                pass