Skip to content

Commit

Permalink
deleted unnecessary files
Browse files Browse the repository at this point in the history
  • Loading branch information
rhomeister committed Aug 24, 2013
1 parent 81124fd commit 243531d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 31 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
<artifactId>jung-api</artifactId>
<version>2.0</version>
</dependency>
<!-- <dependency>
<dependency>
<groupId>uk.ac.soton.ecs.gp4j</groupId>
<artifactId>gp4j</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency> -->
</dependency>
<dependency>
<groupId>net.sf.jung</groupId>
<artifactId>jung-graph-impl</artifactId>
Expand Down
35 changes: 19 additions & 16 deletions src/main/java/boundedMaxSum/MinimisingFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,21 @@
public class MinimisingFunction extends LinkBoundedInternalFunction implements
BBDiscreteInternalFunction {

private BBDiscreteInternalFunction wrappedFunction;
private Set<DiscreteInternalVariable> rejectedVariables;
private final BBDiscreteInternalFunction wrappedFunction;
private final Set<DiscreteInternalVariable> rejectedVariables;
private boolean debug;
private BBFunctionCache cache;
private final BBFunctionCache cache;

public MinimisingFunction(BBDiscreteInternalFunction wrappedFunction,
Set<DiscreteInternalVariable> rejectedVariables) {
super(wrappedFunction.getName());
setOwningAgentIdentifier(wrappedFunction.getOwningAgentIdentifier());

Validate.isTrue(wrappedFunction.getVariableDependencies().containsAll(
rejectedVariables), "Rejected variables have to be a subset "
+ "of the variable dependencies");
Validate.isTrue(
wrappedFunction.getVariableDependencies().containsAll(
rejectedVariables),
"Rejected variables have to be a subset "
+ "of the variable dependencies");

this.wrappedFunction = wrappedFunction;
this.rejectedVariables = rejectedVariables;
Expand Down Expand Up @@ -139,11 +141,11 @@ private double getBound(PartialJointVariableState partialState,
// expand children to find maximum value
for (PartialJointVariableState partialJointVariableState : children) {
if (lower)
bestUtility = Math.min(bestUtility, getBound(
partialJointVariableState, true));
bestUtility = Math.min(bestUtility,
getBound(partialJointVariableState, true));
else
bestUtility = Math.max(bestUtility, getBound(
partialJointVariableState, false));
bestUtility = Math.max(bestUtility,
getBound(partialJointVariableState, false));
}

// store values so recomputation is not needed
Expand All @@ -160,7 +162,7 @@ private double getBound(PartialJointVariableState partialState,
// JointStateIterator(
// (Set<? extends DiscreteVariable<?>>) rejectedVariables);
//
//
//
// double bestUtility = lower ? Double.POSITIVE_INFINITY
// : Double.NEGATIVE_INFINITY;
//
Expand Down Expand Up @@ -189,8 +191,9 @@ private double getBound(PartialJointVariableState partialState,
private double getLeafValue(PartialJointVariableState<?> partialState) {
double bestUtility = Double.POSITIVE_INFINITY;

JointStateIterator fixedVariableValueIterator = new JointStateIterator(
(Set<? extends DiscreteVariable<?>>) rejectedVariables);
JointStateIterator fixedVariableValueIterator = null; // new
// JointStateIterator(
// (Set<? extends DiscreteVariable<?>>) rejectedVariables);

while (fixedVariableValueIterator.hasNext()) {
VariableJointState next = fixedVariableValueIterator.next();
Expand All @@ -210,8 +213,8 @@ private double getLeafValue(PartialJointVariableState<?> partialState) {
throw new IllegalArgumentException();
}

bestUtility = Math.min(bestUtility, wrappedFunction
.evaluate(combinedState.getJointState()));
bestUtility = Math.min(bestUtility,
wrappedFunction.evaluate(combinedState.getJointState()));
}

return bestUtility;
Expand Down Expand Up @@ -253,7 +256,7 @@ public void debug(PartialJointVariableState state) {
System.out.println("___*******END MIN FUNCTION RESULT*******___");

}

@Override
public String toString() {
return "Minimising" + super.toString();
Expand Down
24 changes: 11 additions & 13 deletions src/main/java/maxSumController/io/GlobalConflictsMetric.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package maxSumController.io;

import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import maxSumController.DiscreteInternalFunction;
import maxSumController.DiscreteVariableState;
import maxSumController.Function;
import maxSumController.GlobalMetric;
Expand Down Expand Up @@ -43,22 +41,22 @@ public double evaluate(MaxSumController<?, ?, ?> controller) {
return conflicts / 2;
}



private Set<DiscreteVariable<?>> getNeighbouringVariables(
InternalVariable<?, ?> variable) {
Set<DiscreteVariable<?>> neighbours = new HashSet<DiscreteVariable<?>>();
Set<Function> functions = variable.getFunctionDependencies();
int vid = Integer.valueOf(variable.getName().substring(1));

for (Function function : functions) {
if (vid == Integer.valueOf(function.getName().substring(1))) {
DiscreteInternalFunction ifunction = (DiscreteInternalFunction) function;
neighbours
.addAll((Collection<? extends DiscreteVariable<?>>) ifunction
.getVariableDependencies());
}
}
return neighbours;
// for (Function function : functions) {
// if (vid == Integer.valueOf(function.getName().substring(1))) {
// DiscreteInternalFunction ifunction = (DiscreteInternalFunction)
// function;
// neighbours
// .addAll((Collection<? extends DiscreteVariable<?>>) ifunction
// .getVariableDependencies());
// }
// }
throw new IllegalArgumentException("Not implemented");
// return neighbours;
}
}

0 comments on commit 243531d

Please sign in to comment.