Namespace: companionship

shared. companionship

Companionship algorithm

Methods


<static> areArrayValuesMatching(crops, property)

Parameters:
Name Type Description
crops Array
property String
Returns:
Type
Boolean

<static> areCompatible(crops)

Determine whether the crops are compatible with each other. Compatibility means that the crops are able to grow in the same kind of environment. All compatibility functions take one input parameter, the array of crops, and return a boolean.
Parameters:
Name Type Description
crops Array
Returns:
Type
Boolean

<static> areNotIncompatibleInMatrix(crops)

Parameters:
Name Type Description
crops Array
Returns:
Type
Boolean

<static> areValuesMatching(crops, property)

Parameters:
Name Type Description
crops Array
property String
Returns:
Type
Boolean

<static> calculateCompanionshipScore(crops)

Calculate a companionship score that represents something like "overall holistic goodness" of the given crops and their surrounding ecosystems when the crops are grown together.
Parameters:
Name Type Description
crops Array Normalized crop data from practicalplants.org
Returns:
Positive number, or 0 for incompatible.
Type
Number

<static> calculateGoodness(crops)

Calculate goodness for the given set of crops. Each individual goodness value represents how much of some feature is present in the input set of crops. This feature may be anything that looks useful. For example the diversity of different plant features is one class of goodness values. All goodness functions take one input parameter, the array of crops, and return a number between 0 and 1. Each goodness function is also associated with a factor that specifies how important it is in relation to other goodness values.
Parameters:
Name Type Description
crops Array
Returns:
Type
Number

<static> getCuttingTypeDiversity(crops)

Parameters:
Name Type Description
crops Array
Returns:
Type
Number

<static> getDeciduousOrEvergreenDiversity(crops)

Parameters:
Name Type Description
crops Array
Returns:
Type
Number

<static> getEcosystemNicheDiversity(crops)

Parameters:
Name Type Description
crops Array
Returns:
Type
Number

<static> getFertilityDiversity(crops)

Parameters:
Name Type Description
crops Array
Returns:
Type
Number

<static> getFlowerTypeDiversity(crops)

Parameters:
Name Type Description
crops Array
Returns:
Type
Number

<static> getFunctionsDiversity(crops)

Parameters:
Name Type Description
crops Array
Returns:
Type
Number

<static> getGrowFromDiversity(crops)

Parameters:
Name Type Description
crops Array
Returns:
Type
Number

<static> getGrowthRateDiversity(crops)

Parameters:
Name Type Description
crops Array
Returns:
Type
Number

<static> getHerbaceousOrWoodyDiversity(crops)

Parameters:
Name Type Description
crops Array
Returns:
Type
Number

<static> getLifeCycleDiversity(crops)

Parameters:
Name Type Description
crops Array
Returns:
Type
Number

<static> getMatureHeightDiversity(crops)

TODO Divide height into half-meter ranges and count how many different ranges the crops span.
Parameters:
Name Type Description
crops Array
Returns:
Type
Number

<static> getMatureWidthDiversity()

TODO Divide width into half-meter ranges and count how many different ranges the crops span.

<static> getNumberOfDifferentValues(crops, property)

Parameters:
Name Type Description
crops Array
property String
Returns:
Type
Number

<static> getNumberOfDifferentValuesInArrays(crops, property)

Parameters:
Name Type Description
crops Array
property String
Returns:
Type
Number

<static> getPollinatorsDiversity(crops)

Parameters:
Name Type Description
crops Array
Returns:
Type
Number

<static> getRootZoneDiversity(crops)

Parameters:
Name Type Description
crops Array
Returns:
Type
Number

<static> haveValue(crops, property, value)

Parameters:
Name Type Description
crops Array
property String
value Object
Returns:
Type
Boolean

<static> isDroughtCompatible(crops)

Parameters:
Name Type Description
crops Array
Returns:
Type
Boolean

<static> isHardinessZoneCompatible(crops)

Check that the hardiness zones are in a small range.
Parameters:
Name Type Description
crops Array
Returns:
Type
Boolean

<static> isShadeCompatible(crops)

TODO It might be too strict to specify that the values must match exactly, and too free to say that they may be anything. Try to specify that the crops may span two or three consecutive values?
Parameters:
Name Type Description
crops Array
Returns:
Type
Boolean

<static> isSoilPhCompatible(crops)

Parameters:
Name Type Description
crops Array
Returns:
Type
Boolean

<static> isSoilTextureCompatible(crops)

Parameters:
Name Type Description
crops Array
Returns:
Type
Boolean

<static> isSoilWaterRetentionCompatible(crops)

Parameters:
Name Type Description
crops Array
Returns:
Type
Boolean

<static> isSunCompatible(crops)

TODO It might be too strict to specify that the values must match exactly, and too free to say that they may be anything. Try to specify that the crops may span two consecutive values?
Parameters:
Name Type Description
crops Array
Returns:
Type
Boolean

<static> isWaterCompatible(crops)

Aquatic plants are incompatible with non-aquatic plants. TODO Otherwise it might be too strict to specify that the values must match exactly, and too free to say that they may be anything non-aquatic. Try to specify that the crops may span two consecutive values?
Parameters:
Name Type Description
crops Array
Returns:
Type
Boolean