Writing a good Membrane Algorithm
This page contains a checklist of things that you should keep in mind while you are developing your membrane algorithm:
- Ensure that the runtime of your algorithm is finite (unless you intend it to run as long as the user stops it manually)!
The more dense the membrane gets the more often your attempts to add or move a lipid will fail. Implement something like a maximum number of retries or a timeout in order to prevent an infinte loop.
- Always check if any sample lipids are available for the membrane side of the domain (or default area) you want to add a lipid to. The getNextExtra- or IntracellularLipid() methods will return null if no lipid could be created. Handle this case and leave the membrane empty in this areas and don't let your algorithm get wrecked by NullPointerExceptions because of this.
- Use the intersection tests wisely; although they are already working as efficiently as possible, they still are an expensive part of the process. Don't use them more than necessary and try to work heuristically.
Always make your algorithm abort- or stopable! Don't ignore any stopAlgorithm() calls by the user
- Be advised of recycling! If an attempt to place a lipid has failed, try to find a new position for it and reuse it instead starting all over again.
- Don't add any lipids before performing the intersection tests in order to remove them afterwards. That is way more expensive and wouldn't make any sense since the intersection methods work as well with unadded molecules.
- Always make your algorithm abort- or stopable! Don't ignore any stopAlgorithm() calls by the user.
- Calculate and display the current progress or state to the user by using the displayInformation() or setDisplayedProgress() methods of the membrane algorithm.
- Written by bjoern
- Category: Cm2dev
- Published: 14 September 2013
- Hits: 2009