def __init__(self, memory=10, delay=0.001, plot_initial=True, plot_improvements_only=False, ax=None, legendloc=1): """Initialize component for plotting turbine locations Parameters ---------- memory : int, optional Number of previous iterations to remember delay : float, optional Time delay in seconds between plotting updates plot_initial : bool, optional Flag to plot the initial turbine locations plot_improvements_only : bool, optional Flag to plot only improvements in cost ax : matplotlib axes, optional Axes into which to make the plot legendloc : int Location of the legend in the plot """ ExplicitComponent.__init__(self) self.delay = delay self.plot_improvements_only = plot_improvements_only self._ax = ax self.memory = memory self.delay = max([delay, 1e-6]) self.plot_initial = plot_initial self.history = [] self.counter = 0 self.by_pass = False self.legendloc = legendloc
def __init__(self, n_wt, xy_boundary=None, z_boundary=None, **kwargs): sys.stderr.write( "%s is deprecated. Use BoundaryConstraint from topfarm.constraint_components.boundary instead\n" % self.__class__.__name__) ExplicitComponent.__init__(self, **kwargs) self.n_wt = n_wt if xy_boundary is None: self.xy_boundary = np.zeros((0, 2)) else: self.xy_boundary = np.array(xy_boundary) if z_boundary is None: z_boundary = [] if len(z_boundary) > 0: z_boundary = np.asarray(z_boundary) assert z_boundary.shape[-1] == 2 if len(z_boundary.shape) == 1: z_boundary = np.zeros((self.n_wt, 2)) + [z_boundary] assert z_boundary.shape == (self.n_wt, 2) assert np.all(z_boundary[:, 0] < z_boundary[:, 1]) self.z_boundary = z_boundary
def __init__(self, problem): ExplicitComponent.__init__(self) self.problem = problem
def __init__(self, problem, additional_inputs=[]): ExplicitComponent.__init__(self) self.problem = problem self.additional_inputs = additional_inputs