本文整理汇总了Java中edacc.model.ExperimentResult类的典型用法代码示例。如果您正苦于以下问题:Java ExperimentResult类的具体用法?Java ExperimentResult怎么用?Java ExperimentResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExperimentResult类属于edacc.model包,在下文中一共展示了ExperimentResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: singleCost
import edacc.model.ExperimentResult; //导入依赖的package包/类
@Override
public double singleCost(ExperimentResult job) {
if (String.valueOf(job.getResultCode().getResultCode()).startsWith("1")) {
if (costType.equals(Experiment.Cost.resultTime))
return job.getResultTime();
else if (costType.equals(Experiment.Cost.wallTime))
return job.getWallTime();
else
return job.getCost();
} else {
if (costType.equals(Experiment.Cost.resultTime))
return job.getCPUTimeLimit() * (double) penaltyFactor;
else if (costType.equals(Experiment.Cost.wallTime))
return job.getWallClockTimeLimit() * (double) penaltyFactor;
else
return costPenaltyValue * penaltyFactor;
}
}
示例2: singleCost
import edacc.model.ExperimentResult; //导入依赖的package包/类
@Override
public double singleCost(edacc.model.ExperimentResult job){
if (String.valueOf(job.getResultCode().getResultCode()).startsWith("1")) {
if (costType.equals(Experiment.Cost.resultTime))
return job.getResultTime();
else if (costType.equals(Experiment.Cost.wallTime))
return job.getWallTime();
else
return job.getCost();
} else {
if (costType.equals(Experiment.Cost.resultTime))
return job.getCPUTimeLimit() * (double) penaltyFactor;
else if (costType.equals(Experiment.Cost.wallTime))
return job.getWallClockTimeLimit() * (double) penaltyFactor;
else
return costPenaltyValue * penaltyFactor;
}
}
示例3: updateModel
import edacc.model.ExperimentResult; //导入依赖的package包/类
public void updateModel(SolverConfiguration sc, int instanceId) {
List<ExperimentResult> list = new LinkedList<ExperimentResult>();
boolean solved = false;
for (ExperimentResult er : sc.getJobs()) {
if (instanceId == er.getInstanceId()) {
list.add(er);
solved |= (er.getResultCode().isCorrect());
}
}
double cost = (solved ? par1.calculateCost(list) : Double.POSITIVE_INFINITY);
if (maxCost != null && maxCost > 0 && cost > maxCost) {
cost = Double.POSITIVE_INFINITY;
}
clustering.update(sc.getIdSolverConfiguration(), instanceId, cost);
clusteringChanged = true;
}
示例4: removeSolverConfig
import edacc.model.ExperimentResult; //导入依赖的package包/类
private void removeSolverConfig(int scId) {
pacc.log("[Challenge] Solver configuration " + scId + " has < 0 points -> removing");
// we remove the jobs from allJobs for this solver config
for (ExperimentResult er : allSolverConfigs.get(scId).solverConfig.getJobs()) {
boolean found = false;
List<ExperimentResult> results = allJobs.get(er.getInstanceId());
if (results == null) {
continue;
}
for (int i = 0; i < results.size(); i++) {
if (results.get(i).getId() == er.getId()) {
results.remove(i);
found = true;
break;
}
}
if (!found) {
pacc.log("[Challenge] (DEBUG) ERROR removeSolverConfig() scid: " + scId + " didn't find job " + er.getId());
}
}
// remove the solver config
allSolverConfigs.remove(scId);
clustering.remove(scId);
}
示例5: mapResultsToClusters
import edacc.model.ExperimentResult; //导入依赖的package包/类
/**
* Maps the ExperimentResults of a given SolverConfiguration to the clusters their instance-seed-pairs
* belong to
*
* @param sc the config for which the results should be mapped
* @return An array containing Lists of ExperimentResults. Each position in the array corresponds to one
* cluster, e.g. array[5] would give you the list of Results for cluster 5.
*/
public List<ExperimentResult>[] mapResultsToClusters(SolverConfiguration sc){
LinkedList<ExperimentResult>[] resultClusterMap = new LinkedList[clusters.length];
for(int i=0; i<clusters.length; i++){
resultClusterMap[i] = new LinkedList<ExperimentResult>();
}
int clusterNr;
InstanceIdSeed idSeed;
for(ExperimentResult r : sc.getFinishedJobs()){
idSeed = new InstanceIdSeed(r.getInstanceId(), r.getSeed());
clusterNr = instanceClusterMap.get(idSeed);
resultClusterMap[clusterNr].add(r);
}
return resultClusterMap;
}
示例6: addValue
import edacc.model.ExperimentResult; //导入依赖的package包/类
public void addValue(ExperimentResult r){
double oldSize = costValues.size();
double newSize = oldSize +1;
costValues.add((double)r.getCost());
//calculate new average
avg = avg*oldSize;
avg += costFunction.singleCost(r);
avg = avg/newSize;
double[] vals = new double[costValues.size()];
int i=0;
for(Double d : costValues){
vals[i] = d;
i++;
}
var = variance.evaluate(vals, avg);
}
示例7: jobReset
import edacc.model.ExperimentResult; //导入依赖的package包/类
protected void jobReset(ExperimentResult er) {
if (er.getStatus().equals(StatusCode.RUNNING)) {
numRunningJobs--;
}
if (!er.getStatus().equals(StatusCode.NOT_STARTED) && !er.getStatus().equals(StatusCode.RUNNING)) {
numFinishedJobs--;
}
if (String.valueOf(er.getResultCode().getResultCode()).startsWith("1")) {
numSuccessfulJobs--;
}
if (!er.getStatus().equals(StatusCode.NOT_STARTED)) {
numNotStartedJobs++;
}
er.setStatus(StatusCode.NOT_STARTED);
er.setResultCode(ResultCode.UNKNOWN);
}
示例8: getScResultMap
import edacc.model.ExperimentResult; //导入依赖的package包/类
private HashMap<Integer, List<ExperimentResult>> getScResultMap(Set<Integer> instanceIds) {
HashMap<Integer, List<ExperimentResult>> res = new HashMap<Integer, List<ExperimentResult>>();
for (SolverConfiguration sc : solverConfigs.values()) {
for (ExperimentResult er : sc.getJobs()) {
if (instanceIds.contains(er.getInstanceId())) {
List<ExperimentResult> list = res.get(er.getSolverConfigId());
if (list == null) {
list = new LinkedList<ExperimentResult>();
res.put(er.getSolverConfigId(), list);
}
list.add(er);
}
}
}
return res;
}
示例9: jobsFinished
import edacc.model.ExperimentResult; //导入依赖的package包/类
@Override
public void jobsFinished(List<ExperimentResult> _results) {
for (ExperimentResult result : _results) {
if (result.getResultCode().isCorrect()) {
if (maxCost != null && maxCost > 0) {
List<ExperimentResult> tmp = new LinkedList<ExperimentResult>();
tmp.add(result);
if (parameters.getStatistics().getCostFunction().calculateCost(tmp) <= maxCost) {
solvedInstances.add(result.getInstanceId());
}
} else {
solvedInstances.add(result.getInstanceId());
}
}
}
}
示例10: getReferenceSolverConfigs
import edacc.model.ExperimentResult; //导入依赖的package包/类
private List<SolverConfiguration> getReferenceSolverConfigs() throws Exception {
List<SolverConfiguration> res = new ArrayList<SolverConfiguration>();
List<Integer> scIds = api.getSolverConfigurations(parameters.getIdExperiment(), "reference");
for (Integer scId : scIds) {
SolverConfiguration sc = new SolverConfiguration(scId, null, parameters.getStatistics());
sc.setNameRacing(api.getSolverConfigName(scId));
for (ExperimentResult job : api.getAllRuns(parameters.idExperiment, scId)) {
sc.putJob(job);
}
log("c Found reference solver configuration: "+sc.getName()+" with "+ sc.getJobCount() + " jobs");
res.add(sc);
}
return res;
}
示例11: getMedian
import edacc.model.ExperimentResult; //导入依赖的package包/类
/**
* Returns the median property value of the given ExperimentResults
* @param results
* @param property
* @param useTimeOutForCPUProp
* @return the median of the ExperimentResult values
*/
public Double getMedian(ArrayList<ExperimentResult> results, Property property, boolean useTimeOutForCPUProp) {
if (results.isEmpty()) {
return null;
}
ArrayList<Double> values = new ArrayList<Double>();
for (ExperimentResult res : results) {
Double value = expController.getValue(res, property, useTimeOutForCPUProp);
if (value != null) {
values.add(value);
}
}
if (values.isEmpty()) {
return null;
}
Collections.sort(values);
if (values.size() % 2 == 1) {
// this is the median
return values.get(values.size() / 2);
} else {
// we have two medians, so we use the average of both
return (values.get((values.size() - 1) / 2) + values.get(values.size() / 2)) / 2;
}
}
示例12: getAvgTime
import edacc.model.ExperimentResult; //导入依赖的package包/类
public static Float getAvgTime(ArrayList<ExperimentResult> er, Integer expId) {
float res = 0.f;
int count = 0;
for (ExperimentResult e : er) {
if (expId != null && e.getExperimentId() != expId) {
continue;
}
if (e.getResultCode().isCorrect()) {
res += e.getResultTime();
count++;
}
}
if (count == 0) {
return null;
} else {
return (res / (float) count);
}
}
示例13: getMedianTime
import edacc.model.ExperimentResult; //导入依赖的package包/类
public static Float getMedianTime(ArrayList<ExperimentResult> er, Integer expId) {
List<Float> resultTimes = new ArrayList<Float>();
for (ExperimentResult e : er) {
if (expId != null && e.getExperimentId() != expId) {
continue;
}
if (e.getResultCode().isCorrect()) {
resultTimes.add(e.getResultTime());
} else {
if (e.getCPUTimeLimit() > 0) {
resultTimes.add(Float.valueOf(e.getCPUTimeLimit()));
}
}
}
if (resultTimes.isEmpty()) {
return null;
} else {
return resultTimes.get(resultTimes.size() / 2);
}
}
示例14: getStatus
import edacc.model.ExperimentResult; //导入依赖的package包/类
public static String getStatus(ArrayList<ExperimentResult> er, Integer expId) {
int status = UNKNOWN;
for (ExperimentResult e : er) {
if (expId != null && e.getExperimentId() != expId) {
continue;
}
if (e.getResultCode().getResultCode() == SAT) {
status = SAT;
break;
} else if (e.getResultCode().getResultCode() == UNSAT) {
if (status == UNKNOWN) {
status = UNSAT;
}
}
}
if (status == UNKNOWN) {
return "UNKNOWN";
} else if (status == SAT) {
return "SAT";
} else if (status == UNSAT) {
return "UNSAT";
}
return "";
}
示例15: calculateProperty
import edacc.model.ExperimentResult; //导入依赖的package包/类
@Override
public String calculateProperty(int instanceId) throws Exception {
float minTime = Float.MAX_VALUE;
int scid = -1;
for (ExperimentResult er : ExperimentResultDAO.getAllByInstanceId(instanceId)) {
if (expId != null && er.getExperimentId() != expId) {
continue;
}
if (er.getResultCode().isCorrect()) {
if (er.getResultTime() < minTime) {
minTime = er.getResultTime();
scid = er.getSolverConfigId();
}
}
}
if (scid == -1) {
return "";
} else {
SolverConfiguration sc = SolverConfigurationDAO.getSolverConfigurationById(scid);
return sc.getName() + " (" + sc.getId() + ")";
}
}