@@ -109,7 +109,7 @@ def _get_algorithms_in_module(module: ModuleType) -> dict[str, Type[Algorithm]]:
109
109
}
110
110
algos = {}
111
111
for candidate in candidate_dict .values ():
112
- name = candidate .__algo_info__ .name
112
+ name = candidate .algo_info .name
113
113
if issubclass (candidate , Algorithm ) and candidate is not Algorithm :
114
114
algos [name ] = candidate
115
115
return algos
@@ -119,47 +119,47 @@ def _get_algorithms_in_module(module: ModuleType) -> dict[str, Type[Algorithm]]:
119
119
# Functions to filter algorithms by selectors
120
120
# ======================================================================================
121
121
def _is_gradient_based (algo : Type [Algorithm ]) -> bool :
122
- return algo .__algo_info__ .needs_jac # type: ignore
122
+ return algo .algo_info .needs_jac # type: ignore
123
123
124
124
125
125
def _is_gradient_free (algo : Type [Algorithm ]) -> bool :
126
126
return not _is_gradient_based (algo )
127
127
128
128
129
129
def _is_global (algo : Type [Algorithm ]) -> bool :
130
- return algo .__algo_info__ .is_global # type: ignore
130
+ return algo .algo_info .is_global # type: ignore
131
131
132
132
133
133
def _is_local (algo : Type [Algorithm ]) -> bool :
134
134
return not _is_global (algo )
135
135
136
136
137
137
def _is_bounded (algo : Type [Algorithm ]) -> bool :
138
- return algo .__algo_info__ .supports_bounds # type: ignore
138
+ return algo .algo_info .supports_bounds # type: ignore
139
139
140
140
141
141
def _is_linear_constrained (algo : Type [Algorithm ]) -> bool :
142
- return algo .__algo_info__ .supports_linear_constraints # type: ignore
142
+ return algo .algo_info .supports_linear_constraints # type: ignore
143
143
144
144
145
145
def _is_nonlinear_constrained (algo : Type [Algorithm ]) -> bool :
146
- return algo .__algo_info__ .supports_nonlinear_constraints # type: ignore
146
+ return algo .algo_info .supports_nonlinear_constraints # type: ignore
147
147
148
148
149
149
def _is_scalar (algo : Type [Algorithm ]) -> bool :
150
- return algo .__algo_info__ .solver_type == AggregationLevel .SCALAR # type: ignore
150
+ return algo .algo_info .solver_type == AggregationLevel .SCALAR # type: ignore
151
151
152
152
153
153
def _is_least_squares (algo : Type [Algorithm ]) -> bool :
154
- return algo .__algo_info__ .solver_type == AggregationLevel .LEAST_SQUARES # type: ignore
154
+ return algo .algo_info .solver_type == AggregationLevel .LEAST_SQUARES # type: ignore
155
155
156
156
157
157
def _is_likelihood (algo : Type [Algorithm ]) -> bool :
158
- return algo .__algo_info__ .solver_type == AggregationLevel .LIKELIHOOD # type: ignore
158
+ return algo .algo_info .solver_type == AggregationLevel .LIKELIHOOD # type: ignore
159
159
160
160
161
161
def _is_parallel (algo : Type [Algorithm ]) -> bool :
162
- return algo .__algo_info__ .supports_parallelism # type: ignore
162
+ return algo .algo_info .supports_parallelism # type: ignore
163
163
164
164
165
165
def _get_filters () -> dict [str , Callable [[Type [Algorithm ]], bool ]]:
@@ -385,27 +385,32 @@ def _all(self) -> list[Type[Algorithm]]:
385
385
def _available(self) -> list[Type[Algorithm]]:
386
386
_all = self._all()
387
387
return [
388
- a for a in _all if a.__algo_info__ .is_available # type: ignore
388
+ a for a in _all if a.algo_info .is_available # type: ignore
389
389
]
390
390
391
391
@property
392
- def All(self) -> list[str ]:
393
- return [a.__algo_info__.name for a in self._all()] # type: ignore
392
+ def All(self) -> list[Type[Algorithm] ]:
393
+ return self._all()
394
394
395
395
@property
396
- def Available(self) -> list[str]:
397
- return [a.__algo_info__.name for a in self._available()] # type: ignore
396
+ def Available(self) -> list[Type[Algorithm]]:
397
+ return self._available()
398
+
399
+ @property
400
+ def AllNames(self) -> list[str]:
401
+ return [str(a.name) for a in self._all()]
402
+
403
+ @property
404
+ def AvailableNames(self) -> list[str]:
405
+ return [str(a.name) for a in self._available()]
398
406
399
407
@property
400
408
def _all_algorithms_dict(self) -> dict[str, Type[Algorithm]]:
401
- return {a.__algo_info__. name: a for a in self._all()} # type: ignore
409
+ return {str(a. name) : a for a in self._all()}
402
410
403
411
@property
404
412
def _available_algorithms_dict(self) -> dict[str, Type[Algorithm]]:
405
- return {
406
- a.__algo_info__.name: a # type: ignore
407
- for a in self._available()
408
- }
413
+ return {str(a.name): a for a in self._available()}
409
414
410
415
""" )
411
416
return out
0 commit comments