|
@@ -590,6 +590,8 @@ public class PSOAlgotihm implements Algorithm {
|
|
for(DecoratedNetwork net : state.getNetworkList()) {
|
|
for(DecoratedNetwork net : state.getNetworkList()) {
|
|
object_fitness += net.getConsumerList().stream().map(con -> holonObjectSupplyPenaltyFunction(con.getSupplyBarPercentage()) + inactiveHolonElementPenalty(con.getModel())).reduce(0.0, (a, b) -> (a + b));
|
|
object_fitness += net.getConsumerList().stream().map(con -> holonObjectSupplyPenaltyFunction(con.getSupplyBarPercentage()) + inactiveHolonElementPenalty(con.getModel())).reduce(0.0, (a, b) -> (a + b));
|
|
//warum war das im network fitness und nicht hier im Object fitness??
|
|
//warum war das im network fitness und nicht hier im Object fitness??
|
|
|
|
+ object_fitness += net.getConsumerList().stream().map(con -> StateToDouble(con.getState())).reduce(0.0, (a,b) -> (a+b));
|
|
|
|
+ //System.out.println("objectfitness for statestuff: " + object_fitness);
|
|
object_fitness += net.getPassivNoEnergyList().stream().map(con -> 1000.0).reduce(0.0, (a, b) -> (a + b));
|
|
object_fitness += net.getPassivNoEnergyList().stream().map(con -> 1000.0).reduce(0.0, (a, b) -> (a + b));
|
|
object_fitness += net.getSupplierList().stream().map(sup -> inactiveHolonElementPenalty(sup.getModel())).reduce(0.0, (a, b) -> (a + b));
|
|
object_fitness += net.getSupplierList().stream().map(sup -> inactiveHolonElementPenalty(sup.getModel())).reduce(0.0, (a, b) -> (a + b));
|
|
object_fitness += net.getConsumerSelfSuppliedList().stream().map(con -> inactiveHolonElementPenalty(con.getModel())).reduce(0.0, (a, b) -> (a + b));
|
|
object_fitness += net.getConsumerSelfSuppliedList().stream().map(con -> inactiveHolonElementPenalty(con.getModel())).reduce(0.0, (a, b) -> (a + b));
|
|
@@ -611,8 +613,8 @@ public class PSOAlgotihm implements Algorithm {
|
|
int maxElements = obj.getElements().size();
|
|
int maxElements = obj.getElements().size();
|
|
|
|
|
|
//result = (float) Math.pow((maxElements -activeElements),2)*10;
|
|
//result = (float) Math.pow((maxElements -activeElements),2)*10;
|
|
- result = (float) Math.pow(5, 4* (maxElements -activeElements)/maxElements) - 1 ;
|
|
|
|
-
|
|
|
|
|
|
+ result = (float) Math.pow(5, 4* ( (float) maxElements - (float) activeElements)/ (float) maxElements) - 1 ;
|
|
|
|
+ //System.out.println("max: " + maxElements + " active: " + activeElements + " results in penalty: " + result);
|
|
return result;
|
|
return result;
|
|
|
|
|
|
}
|
|
}
|
|
@@ -655,15 +657,15 @@ public class PSOAlgotihm implements Algorithm {
|
|
private double StateToDouble(HolonObjectState state) {
|
|
private double StateToDouble(HolonObjectState state) {
|
|
switch (state) {
|
|
switch (state) {
|
|
case NOT_SUPPLIED:
|
|
case NOT_SUPPLIED:
|
|
- return 10.0;
|
|
|
|
|
|
+ return 300.0;
|
|
case NO_ENERGY:
|
|
case NO_ENERGY:
|
|
- return 15.0;
|
|
|
|
|
|
+ return 100.0;
|
|
case OVER_SUPPLIED:
|
|
case OVER_SUPPLIED:
|
|
- return 5.0;
|
|
|
|
|
|
+ return 200.0;
|
|
case PARTIALLY_SUPPLIED:
|
|
case PARTIALLY_SUPPLIED:
|
|
- return 3.0;
|
|
|
|
|
|
+ return 100.0;
|
|
case PRODUCER:
|
|
case PRODUCER:
|
|
- return 2.0;
|
|
|
|
|
|
+ return 0;
|
|
case SUPPLIED:
|
|
case SUPPLIED:
|
|
return 0;
|
|
return 0;
|
|
default:
|
|
default:
|