pyJaya package¶
Subpackages¶
pyJaya.consts module¶
Constants module
pyJaya.population module¶
Population class
-
class
pyJaya.population.
Population
(minimax, solutions=[])[source]¶ Bases:
object
Population class
- Parameters
minimax (int) – Objective function to be (0: minimized or 1: maximized).
-
divideInTo
(n=2)[source]¶ Divide the population into n subpopulations
- Parameters
n (int, optional) – Number of subpopulations. Defaults to 2.
- Returns
Subpopulations list.
- Return type
list
-
divideInToWithElitist
(n=2)[source]¶ Divide the population into n subpopulations with elitism
- Parameters
n (int, optional) – Number of subpopulations. Defaults to 2.
- Returns
Subpopulations list.
- Return type
list
-
generate
(numSolutions, listVars, functionToEvaluate, space, listConstraints)[source]¶ Population generator
- Parameters
numSolutions (int) – Number of solutions.
listVars (list) – Range list.
functionToEvaluate (funtion) – Function to minimize or maximize.
space (bool) – Spaced numbers over a specified interval.
listConstraints (list, optional) – Constraint list. Defaults to [].
-
getBestAndWorst
()[source]¶ Best and worst value and solution
- Returns
Best value, worst value, best solution and worst solution.
- Return type
dict
pyJaya.solution module¶
Solution class
-
class
pyJaya.solution.
Solution
(listVars, functionToEvaluate, listConstraints=[])[source]¶ Bases:
object
Solution class
- Parameters
listVars (list) – Range list.
functionToEvaluate (funtion) – Function to minimize or maximize.
listConstraints (list, optional) – Constraint list. Defaults to [].
-
constraintsOK
(solution)[source]¶ Check that the solution satisfies the constraints
- Parameters
solution (Solution) – Solution to check.
- Returns
True if it satisfies the constraints, False if not.
- Return type
Bool
pyJaya.variables module¶
-
class
pyJaya.variables.
VariableBinary
[source]¶ Bases:
pyJaya.variables.Variable
VariableBinary class
-
convert
(item)[source]¶ Converts an item to a possible value in the range
- Parameters
item (int or float) – Value to convert.
- Returns
Value in the range.
- Return type
int
-
-
class
pyJaya.variables.
VariableFloat
(outside_first=- 100.0, outside_second=100.0)[source]¶ Bases:
pyJaya.variables.Variable
VariableFloat class
- Parameters
outside_first (int, optional) – Lowest possible value in the range of the variable. Defaults to -100.0.
outside_second (int, optional) – Largest possible value in the range of the variable. Defaults to 100.0.
-
class
pyJaya.variables.
VariableInt
(outside_first=- 100, outside_second=100)[source]¶ Bases:
pyJaya.variables.Variable
VariableInt class
- Parameters
outside_first (int, optional) – Lowest possible value in the range of the variable. Defaults to -100.
outside_second (int, optional) – Largest possible value in the range of the variable. Defaults to 100.
-
convert
(item)[source]¶ Converts an item to a possible value in the range
- Parameters
item (int or float) – Value to convert.
- Returns
Value in the range.
- Return type
int
Module contents¶
Top-level package for pyJaya.