edu.usc.cse.desi.algorithm
Class GreedyAlgorithm
java.lang.Object
edu.usc.cse.desi.algorithm.AbstractAlgorithm
edu.usc.cse.desi.algorithm.GreedyAlgorithm
- public class GreedyAlgorithm
- extends AbstractAlgorithm
- Author:
- NeLs
Started on Oct 4, 2004
This is the greedy algorithm, probably the only algorithm that will
be implemented for a while (Well besides Exact). As you will notice
most of its implementation relies on the existing code from DeSi 1.0.
This is fine for this case because it will fill in some arrays and
then those results will be applied to the DESIViewModel.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
hostRelFactor
public double hostRelFactor
hostMemFactor
public double hostMemFactor
compFreqFactor
public double compFreqFactor
compMemFactor
public double compMemFactor
numOfMappedHosts
int numOfMappedHosts
numOfMappedComps
int numOfMappedComps
compsList
private java.util.List compsList
hostsList
private java.util.List hostsList
GreedyAlgorithm
public GreedyAlgorithm()
executeAlgo
protected DESIViewModel executeAlgo(DESIViewModel cur_model)
- THis is the most important method of the class. It gets called when the algorithm is run.
I overrode this method:
- Specified by:
executeAlgo in class AbstractAlgorithm
- Parameters:
cur_model - DESIViewModel - The current model of the system.
- Returns:
- DESIViewModel - The affected model of the system.
- See Also:
AbstractAlgorithm.executeAlgo(edu.usc.cse.desi.model.view.DESIViewModel)
findNextBestComp
private int findNextBestComp(int[] currentlyMapped,
double maxMem,
int currentHost)
findNextBestHost
private int findNextBestHost(int[] currentlyMappedHosts)
findMaxFreqOfComps
public double findMaxFreqOfComps()
findMaxRelOfHosts
public double findMaxRelOfHosts()
findMaxFreqOfUnmappedComps
public double findMaxFreqOfUnmappedComps(int[] currentlyMapped)
findMaxMemOfUnmappedComps
public double findMaxMemOfUnmappedComps(int[] currentlyMapped)
findMaxRelOfUnmappedHosts
public double findMaxRelOfUnmappedHosts(int[] currentlyMappedHosts)
findMaxMemOfUnmappedHosts
public double findMaxMemOfUnmappedHosts(int[] currentlyMappedHosts)
findMax
public int findMax(double[] a,
int length)
findMin
public int findMin(double[] a,
int length)
findFirstComponent
public int findFirstComponent(double[] compsRank,
int curHost,
int[] currentlyMapped)
locationConstraintSatisfied
public boolean locationConstraintSatisfied(int[] currentlyMapped,
int currentHost,
int comp)