コード例 #1
0
 def __init__(self, cost_comp, turbineTypes, lower, upper, turbineXYZ, boundary_comp, min_spacing=None,
              driver=EasyRandomSearchDriver(random_search_driver.RandomizeTurbineTypeAndPosition()), plot_comp=None, record_id=None, expected_cost=1):
     sys.stderr.write("%s is deprecated. Use TopFarmProblem instead\n" % self.__class__.__name__)
     TopFarmProblem.__init__(self, cost_comp, driver, plot_comp, record_id, expected_cost)
     TurbineTypeOptimizationProblem.initialize(self, turbineTypes, lower, upper)
     TurbineXYZOptimizationProblem.initialize(self, turbineXYZ, boundary_comp, min_spacing)
     self.setup(check=True, mode=self.mode)
コード例 #2
0
    def __init__(self, cost_comp, turbineXYZ, boundary_comp, min_spacing=None,
                 driver=ScipyOptimizeDriver(), plot_comp=None, record_id=None, expected_cost=1):
        sys.stderr.write("%s is deprecated. Use TopFarmProblem instead\n" % self.__class__.__name__)
        if plot_comp:
            if plot_comp == "default":
                plot_comp = PlotComp()
        turbineXYZ = np.asarray(turbineXYZ)
        design_vars = {xy: v for xy, v in zip([topfarm.x_key, topfarm.y_key], turbineXYZ.T)}
        constraints = []
        if min_spacing:
            constraints.append(SpacingConstraint(min_spacing))

        if isinstance(boundary_comp, PolygonBoundaryComp):
            constraints.append(XYBoundaryConstraint(boundary_comp.xy_boundary, 'polygon'))
        elif len(boundary_comp.xy_boundary):
            constraints.append(XYBoundaryConstraint(boundary_comp.xy_boundary, boundary_comp.boundary_type))

        if turbineXYZ.shape[1] == 3:
            if len(boundary_comp.z_boundary):
                design_vars[topfarm.z_key] = (turbineXYZ[:, 2], boundary_comp.z_boundary[:, 0], boundary_comp.z_boundary[:, 1])
            else:
                design_vars[topfarm.z_key] = turbineXYZ[:, 2]

        TopFarmProblem.__init__(
            self,
            design_vars=design_vars,
            cost_comp=cost_comp,
            driver=driver,
            constraints=constraints,
            plot_comp=plot_comp,
            record_id=record_id,
            expected_cost=expected_cost)
        self.setup()
コード例 #3
0
    def __init__(self, cost_comp, turbineTypes, lower, upper, **kwargs):
        sys.stderr.write("%s is deprecated. Use TopFarmProblem instead\n" % self.__class__.__name__)

        TopFarmProblem.__init__(self,
                                design_vars={topfarm.type_key: (turbineTypes, lower, upper)},
                                cost_comp=cost_comp,
                                **kwargs)
        self.setup()
コード例 #4
0
 def __init__(self, turbines, cost_comp, min_spacing, boundary,
              boundary_type='convex_hull', plot_comp=None,
              driver=ScipyOptimizeDriver(),
              record_id="Opt_%s" % time.strftime("%Y%m%d_%H%M%S"),
              expected_cost=1):
     sys.stderr.write("%s is deprecated. Use TopFarmProblem instead\n" % self.__class__.__name__)
     constraints = []
     if min_spacing and len(turbines) > 1:
         constraints.append(SpacingConstraint(min_spacing))
     if boundary is not None:
         constraints.append(XYBoundaryConstraint(boundary, boundary_type))
     TopFarmProblem.__init__(
         self,
         design_vars={k: v for k, v in zip([topfarm.x_key, topfarm.y_key, topfarm.z_key], np.asarray(turbines).T)},
         cost_comp=cost_comp,
         driver=driver,
         constraints=constraints,
         plot_comp=plot_comp,
         record_id=record_id,
         expected_cost=expected_cost)
     self.setup()