Program: 186613
Project: 186613
Buggy source:
/** 
 * Compute WCET for a segment, using global IPET, and cache analysis results
 * @throws InvalidFlowFactException 
 * @throws LpSolveException 
 */
public WcetCost computeWCET(String key,Segment segment,StaticCacheApproximation cacheMode) throws InvalidFlowFactException, LpSolveException {
  IPETSolver<SuperGraphEdge> ipetSolver=buildIpetProblem(project,key,segment,ipetConfig);
  setExecutionCost(segment,ipetSolver);
  Set<SuperGraphEdge> missEdges=new HashSet<SuperGraphEdge>();
  if (project.getWCETProcessorModel().hasMethodCache()) {
switch (cacheMode) {
case ALWAYS_HIT:
      break;
case ALWAYS_MISS:
    missEdges=methodCacheAnalysis.addMissAlwaysCost(segment,ipetSolver);
  break;
case ALL_FIT_SIMPLE:
missEdges=methodCacheAnalysis.addMissOnceCost(segment,ipetSolver);
break;
case ALL_FIT_REGIONS:
missEdges=methodCacheAnalysis.addMissOnceConstraints(segment,ipetSolver);
break;
case GLOBAL_ALL_FIT:
missEdges=methodCacheAnalysis.addGlobalAllFitConstraints(segment,ipetSolver);
break;
}
}
Map<SuperGraphEdge,Long> flowMap=new HashMap<SuperGraphEdge,Long>();
long _start=System.currentTimeMillis();
double relaxedCost=ipetSolver.solve(null,false);
long _time_rlp=System.currentTimeMillis() - _start;
double ilpCost=ipetSolver.solve(flowMap);
long _time_ilp=System.currentTimeMillis() - _start;
WCETTool.logger.info(String.format("String_Node_Str",_time_rlp,Math.round(relaxedCost),Math.round(ilpCost),_time_ilp));
WcetCost cost=new WcetCost();
for (Entry<SuperGraphEdge,Long> flowEntry : flowMap.entrySet()) {
SuperGraphEdge edge=flowEntry.getKey();
long edgeCost=ipetSolver.getEdgeCost(edge);
long flowCost=edgeCost * flowEntry.getValue();
if (missEdges.contains(edge)) {
if (WCETTool.logger.isTraceEnabled() && flowEntry.getValue() > 0) {
WCETTool.logger.trace("String_Node_Str" + edge + "String_Node_Str"+ flowCost+ "String_Node_Str"+ flowEntry.getValue()+ "String_Node_Str"+ edgeCost+ "String_Node_Str");
}
cost.addCacheCost(flowCost);
}
 else {
if (WCETTool.logger.isTraceEnabled() && flowEntry.getValue() > 0) {
WCETTool.logger.trace("String_Node_Str" + edge + "String_Node_Str"+ flowCost);
}
cost.addNonLocalCost(flowCost);
}
}
if (Double.isInfinite(ilpCost)) {
throw new AssertionError("String_Node_Str");
}
long objValue=(long)(ilpCost + 0.5);
if (cost.getCost() != objValue) {
throw new AssertionError("String_Node_Str" + objValue + "String_Node_Str"+ cost.getCost());
}
return cost;
}

Fixed version (ground truth):
/** 
 * Compute WCET for a segment, using global IPET, and cache analysis results
 * @throws InvalidFlowFactException 
 * @throws LpSolveException 
 */
public WcetCost computeWCET(String key,Segment segment,StaticCacheApproximation cacheMode) throws InvalidFlowFactException, LpSolveException {
  String problemId=formatProblemName(key,segment.getEntryMethods().toString());
  IPETSolver<SuperGraphEdge> ipetSolver=buildIpetProblem(project,problemId,segment,ipetConfig);
  setExecutionCost(segment,ipetSolver);
  Set<SuperGraphEdge> missEdges=new HashSet<SuperGraphEdge>();
  if (project.getWCETProcessorModel().hasMethodCache()) {
switch (cacheMode) {
case ALWAYS_HIT:
      break;
case ALWAYS_MISS:
    missEdges=methodCacheAnalysis.addMissAlwaysCost(segment,ipetSolver);
  break;
case ALL_FIT_SIMPLE:
missEdges=methodCacheAnalysis.addMissOnceCost(segment,ipetSolver);
break;
case ALL_FIT_REGIONS:
missEdges=methodCacheAnalysis.addMissOnceConstraints(segment,ipetSolver);
break;
case GLOBAL_ALL_FIT:
missEdges=methodCacheAnalysis.addGlobalAllFitConstraints(segment,ipetSolver);
break;
}
}
Map<SuperGraphEdge,Long> flowMap=new HashMap<SuperGraphEdge,Long>();
long _start=System.currentTimeMillis();
double relaxedCost=ipetSolver.solve(null,false);
long _time_rlp=System.currentTimeMillis() - _start;
double ilpCost=ipetSolver.solve(flowMap);
long _time_ilp=System.currentTimeMillis() - _start;
WCETTool.logger.info(String.format("String_Node_Str",_time_rlp,Math.round(relaxedCost),Math.round(ilpCost),_time_ilp));
WcetCost cost=new WcetCost();
for (Entry<SuperGraphEdge,Long> flowEntry : flowMap.entrySet()) {
SuperGraphEdge edge=flowEntry.getKey();
long edgeCost=ipetSolver.getEdgeCost(edge);
long flowCost=edgeCost * flowEntry.getValue();
if (missEdges.contains(edge)) {
if (WCETTool.logger.isTraceEnabled() && flowEntry.getValue() > 0) {
WCETTool.logger.trace("String_Node_Str" + edge + "String_Node_Str"+ flowCost+ "String_Node_Str"+ flowEntry.getValue()+ "String_Node_Str"+ edgeCost+ "String_Node_Str");
}
cost.addCacheCost(flowCost);
}
 else {
if (WCETTool.logger.isTraceEnabled() && flowEntry.getValue() > 0) {
WCETTool.logger.trace("String_Node_Str" + edge + "String_Node_Str"+ flowCost);
}
cost.addNonLocalCost(flowCost);
}
}
if (Double.isInfinite(ilpCost)) {
throw new AssertionError("String_Node_Str");
}
long objValue=(long)(ilpCost + 0.5);
if (cost.getCost() != objValue) {
throw new AssertionError("String_Node_Str" + objValue + "String_Node_Str"+ cost.getCost());
}
return cost;
}