foxes 0.7.4.25__py3-none-any.whl → 0.8.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of foxes might be problematic. Click here for more details.
- foxes/VERSION +1 -1
- {foxes-0.7.4.25.dist-info → foxes-0.8.1.dist-info}/METADATA +20 -116
- {foxes-0.7.4.25.dist-info → foxes-0.8.1.dist-info}/RECORD +7 -33
- foxes/opt/__init__.py +0 -9
- foxes/opt/constraints/__init__.py +0 -6
- foxes/opt/constraints/area_geometry.py +0 -214
- foxes/opt/constraints/min_dist.py +0 -239
- foxes/opt/core/__init__.py +0 -9
- foxes/opt/core/farm_constraint.py +0 -96
- foxes/opt/core/farm_objective.py +0 -97
- foxes/opt/core/farm_opt_problem.py +0 -346
- foxes/opt/core/farm_vars_problem.py +0 -219
- foxes/opt/core/pop_states.py +0 -206
- foxes/opt/objectives/__init__.py +0 -6
- foxes/opt/objectives/farm_vars.py +0 -323
- foxes/opt/objectives/max_n_turbines.py +0 -142
- foxes/opt/problems/__init__.py +0 -7
- foxes/opt/problems/layout/__init__.py +0 -9
- foxes/opt/problems/layout/farm_layout.py +0 -137
- foxes/opt/problems/layout/geom_layouts/__init__.py +0 -10
- foxes/opt/problems/layout/geom_layouts/constraints.py +0 -802
- foxes/opt/problems/layout/geom_layouts/geom_layout.py +0 -290
- foxes/opt/problems/layout/geom_layouts/geom_layout_gridded.py +0 -276
- foxes/opt/problems/layout/geom_layouts/geom_reggrid.py +0 -351
- foxes/opt/problems/layout/geom_layouts/geom_reggrids.py +0 -482
- foxes/opt/problems/layout/geom_layouts/objectives.py +0 -666
- foxes/opt/problems/layout/reggrids_layout.py +0 -417
- foxes/opt/problems/layout/regular_layout.py +0 -350
- foxes/opt/problems/opt_farm_vars.py +0 -586
- {foxes-0.7.4.25.dist-info → foxes-0.8.1.dist-info}/LICENSE +0 -0
- {foxes-0.7.4.25.dist-info → foxes-0.8.1.dist-info}/WHEEL +0 -0
- {foxes-0.7.4.25.dist-info → foxes-0.8.1.dist-info}/top_level.txt +0 -0
- {foxes-0.7.4.25.dist-info → foxes-0.8.1.dist-info}/zip-safe +0 -0
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import numpy as np
|
|
2
|
-
|
|
3
|
-
from foxes.opt.core.farm_opt_problem import FarmOptProblem
|
|
4
|
-
import foxes.variables as FV
|
|
5
|
-
import foxes.constants as FC
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class FarmLayoutOptProblem(FarmOptProblem):
|
|
9
|
-
"""
|
|
10
|
-
The turbine positioning optimization problem
|
|
11
|
-
|
|
12
|
-
:group: opt.problems.layout
|
|
13
|
-
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
def var_names_float(self):
|
|
17
|
-
"""
|
|
18
|
-
The names of float variables.
|
|
19
|
-
|
|
20
|
-
Returns
|
|
21
|
-
-------
|
|
22
|
-
names: list of str
|
|
23
|
-
The names of the float variables
|
|
24
|
-
|
|
25
|
-
"""
|
|
26
|
-
vrs = []
|
|
27
|
-
for ti in self.sel_turbines:
|
|
28
|
-
vrs += [self.tvar(FV.X, ti), self.tvar(FV.Y, ti)]
|
|
29
|
-
return vrs
|
|
30
|
-
|
|
31
|
-
def initial_values_float(self):
|
|
32
|
-
"""
|
|
33
|
-
The initial values of the float variables.
|
|
34
|
-
|
|
35
|
-
Returns
|
|
36
|
-
-------
|
|
37
|
-
values: numpy.ndarray
|
|
38
|
-
Initial float values, shape: (n_vars_float,)
|
|
39
|
-
|
|
40
|
-
"""
|
|
41
|
-
out = np.zeros((self.n_sel_turbines, 2), dtype=FC.DTYPE)
|
|
42
|
-
for i, ti in enumerate(self.sel_turbines):
|
|
43
|
-
out[i] = self.farm.turbines[ti].xy
|
|
44
|
-
return out.reshape(self.n_sel_turbines * 2)
|
|
45
|
-
|
|
46
|
-
def min_values_float(self):
|
|
47
|
-
"""
|
|
48
|
-
The minimal values of the float variables.
|
|
49
|
-
|
|
50
|
-
Use -numpy.inf for unbounded.
|
|
51
|
-
|
|
52
|
-
Returns
|
|
53
|
-
-------
|
|
54
|
-
values: numpy.ndarray
|
|
55
|
-
Minimal float values, shape: (n_vars_float,)
|
|
56
|
-
|
|
57
|
-
"""
|
|
58
|
-
b = self.farm.boundary
|
|
59
|
-
assert b is not None, f"Problem '{self.name}': Missing wind farm boundary."
|
|
60
|
-
out = np.zeros((self.n_sel_turbines, 2), dtype=FC.DTYPE)
|
|
61
|
-
out[:] = b.p_min()[None, :]
|
|
62
|
-
return out.reshape(self.n_sel_turbines * 2)
|
|
63
|
-
|
|
64
|
-
def max_values_float(self):
|
|
65
|
-
"""
|
|
66
|
-
The maximal values of the float variables.
|
|
67
|
-
|
|
68
|
-
Use numpy.inf for unbounded.
|
|
69
|
-
|
|
70
|
-
Returns
|
|
71
|
-
-------
|
|
72
|
-
values: numpy.ndarray
|
|
73
|
-
Maximal float values, shape: (n_vars_float,)
|
|
74
|
-
|
|
75
|
-
"""
|
|
76
|
-
b = self.farm.boundary
|
|
77
|
-
assert b is not None, f"Problem '{self.name}': Missing wind farm boundary."
|
|
78
|
-
out = np.zeros((self.n_sel_turbines, 2), dtype=FC.DTYPE)
|
|
79
|
-
out[:] = b.p_max()[None, :]
|
|
80
|
-
return out.reshape(self.n_sel_turbines * 2)
|
|
81
|
-
|
|
82
|
-
def update_problem_individual(self, vars_int, vars_float):
|
|
83
|
-
"""
|
|
84
|
-
Update the algo and other data using
|
|
85
|
-
the latest optimization variables.
|
|
86
|
-
|
|
87
|
-
This function is called before running the farm
|
|
88
|
-
calculation.
|
|
89
|
-
|
|
90
|
-
Parameters
|
|
91
|
-
----------
|
|
92
|
-
vars_int: np.array
|
|
93
|
-
The integer variable values, shape: (n_vars_int,)
|
|
94
|
-
vars_float: np.array
|
|
95
|
-
The float variable values, shape: (n_vars_float,)
|
|
96
|
-
|
|
97
|
-
"""
|
|
98
|
-
super().update_problem_individual(vars_int, vars_float)
|
|
99
|
-
|
|
100
|
-
xy = vars_float.reshape(self.n_sel_turbines, 2)
|
|
101
|
-
for i, ti in enumerate(self.sel_turbines):
|
|
102
|
-
t = self.algo.farm.turbines[ti]
|
|
103
|
-
t.xy = xy[i]
|
|
104
|
-
|
|
105
|
-
def update_problem_population(self, vars_int, vars_float):
|
|
106
|
-
"""
|
|
107
|
-
Update the algo and other data using
|
|
108
|
-
the latest optimization variables.
|
|
109
|
-
|
|
110
|
-
This function is called before running the farm
|
|
111
|
-
calculation.
|
|
112
|
-
|
|
113
|
-
Parameters
|
|
114
|
-
----------
|
|
115
|
-
vars_int: np.array
|
|
116
|
-
The integer variable values, shape: (n_pop, n_vars_int,)
|
|
117
|
-
vars_float: np.array
|
|
118
|
-
The float variable values, shape: (n_pop, n_vars_float,)
|
|
119
|
-
|
|
120
|
-
"""
|
|
121
|
-
super().update_problem_population(vars_int, vars_float)
|
|
122
|
-
|
|
123
|
-
n_pop = len(vars_float)
|
|
124
|
-
n_ostates = self._org_n_states
|
|
125
|
-
n_states = n_pop * n_ostates
|
|
126
|
-
|
|
127
|
-
xy = vars_float.reshape(n_pop, self.n_sel_turbines, 2)
|
|
128
|
-
sxy = np.zeros(
|
|
129
|
-
(n_pop, n_ostates, self.n_sel_turbines, 2), dtype=vars_float.dtype
|
|
130
|
-
)
|
|
131
|
-
sxy[:] = xy[:, None, :, :]
|
|
132
|
-
sxy = sxy.reshape(n_states, self.n_sel_turbines, 2)
|
|
133
|
-
del xy
|
|
134
|
-
|
|
135
|
-
for i, ti in enumerate(self.sel_turbines):
|
|
136
|
-
t = self.algo.farm.turbines[ti]
|
|
137
|
-
t.xy = sxy[:, i]
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Purely geometric wind farm layout problems.
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
from .geom_layout import GeomLayout
|
|
6
|
-
from .geom_reggrid import GeomRegGrid
|
|
7
|
-
from .geom_layout_gridded import GeomLayoutGridded
|
|
8
|
-
from .geom_reggrids import GeomRegGrids
|
|
9
|
-
from .objectives import OMaxN, OMinN, OFixN, MaxGridSpacing, MaxDensity, MeMiMaDist
|
|
10
|
-
from .constraints import Valid, Boundary, MinDist, CMinN, CMaxN, CFixN, CMinDensity
|