improve graph nodes
parent
a2db6b7765
commit
f8bdb9902b
|
|
@ -128,6 +128,7 @@ public class Test {
|
||||||
new Production(Database.IronPlate, 1));
|
new Production(Database.IronPlate, 1));
|
||||||
planFor("p3_acu", new Production(Database.AdaptiveControlUnit, 1));
|
planFor("p3_acu", new Production(Database.AdaptiveControlUnit, 1));
|
||||||
planFor("p3_me", new Production(Database.ModularEngine, 1));
|
planFor("p3_me", new Production(Database.ModularEngine, 1));
|
||||||
|
planFor("p3_me_acu", new Production(Database.ModularEngine, 1), new Production(Database.AdaptiveControlUnit, 1));
|
||||||
planFor("p3_vf", new Production(Database.VersatileFrameWork, 1));
|
planFor("p3_vf", new Production(Database.VersatileFrameWork, 1));
|
||||||
planFor("screw", new Production(Database.ReinforcedIronPlate, 1));
|
planFor("screw", new Production(Database.ReinforcedIronPlate, 1));
|
||||||
planFor("rotor", new Production(Database.Rotor, 1));
|
planFor("rotor", new Production(Database.Rotor, 1));
|
||||||
|
|
|
||||||
|
|
@ -106,8 +106,15 @@ public class Utils {
|
||||||
if (item.isRaw()) {
|
if (item.isRaw()) {
|
||||||
m.put("peripheries", DefaultAttribute.createAttribute(2));
|
m.put("peripheries", DefaultAttribute.createAttribute(2));
|
||||||
}
|
}
|
||||||
Double required = sum.outgoingEdgesOf(item).stream().map(ProductionEdge::getTotalRequired).reduce(Double::sum).orElseGet(() -> 0.0);
|
double required = sum.outgoingEdgesOf(item).stream().map(ProductionEdge::getTotalRequired).reduce(Double::sum).orElseGet(() -> Double.NaN);
|
||||||
String label = "%s \n(%.1f)" .formatted(item.getName(), required );
|
double instances = sum.outgoingEdgesOf(item).stream().map(ProductionEdge::getInstances).reduce(Double::sum).orElseGet(() -> Double.NaN);
|
||||||
|
String buildingName = item.getRecipe().getBuilding().getName();
|
||||||
|
if (Double.isNaN(required) || Double.isNaN(instances)) {
|
||||||
|
required = -sum.incomingEdgesOf(item).stream().map(ProductionEdge::getTotalRequired).reduce(Double::sum).orElseGet(() -> Double.NaN);
|
||||||
|
instances = 0;
|
||||||
|
buildingName = "";
|
||||||
|
}
|
||||||
|
String label = "%s \n(%.1f||%.1f)\n%s".formatted(item.getName(), required, instances,buildingName);
|
||||||
m.put("label", DefaultAttribute.createAttribute(label));
|
m.put("label", DefaultAttribute.createAttribute(label));
|
||||||
return m;
|
return m;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -199,6 +199,7 @@ public class Recipe {
|
||||||
buildGraph.incomingEdgesOf(item)
|
buildGraph.incomingEdgesOf(item)
|
||||||
.stream()
|
.stream()
|
||||||
.map(buildGraph::getEdgeSource)
|
.map(buildGraph::getEdgeSource)
|
||||||
|
//.filter(item1 -> !item.getRecipe().isByProduct(item1))
|
||||||
.forEach(queue::add);
|
.forEach(queue::add);
|
||||||
}
|
}
|
||||||
// *this* item
|
// *this* item
|
||||||
|
|
@ -211,13 +212,15 @@ public class Recipe {
|
||||||
// product is by-product, no forward dependency
|
// product is by-product, no forward dependency
|
||||||
System.out.println("BY-PRODUCT " + item.getName() + " -> " + product.getName() + "... " + queue);
|
System.out.println("BY-PRODUCT " + item.getName() + " -> " + product.getName() + "... " + queue);
|
||||||
byProducts.add(product);
|
byProducts.add(product);
|
||||||
|
//visited.add(product);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (queue.contains(product) || productWantedPerMinute == null) {
|
if (queue.contains(product) || productWantedPerMinute == null) {
|
||||||
// defer update, no all usages are expanded yet
|
// defer update, no all usages are expanded yet
|
||||||
System.err.println("product still queued or productWantedPerMinute null for '" + product.getName() + "' from '" + item.getName() + "'");
|
System.err.println("product still queued or productWantedPerMinute null for '" + product.getName() + "' from '" + item.getName() + "'");
|
||||||
sum = 0;
|
sum = 0;
|
||||||
queue.add(item);
|
//if (!item.getRecipe().isByProduct(product)){
|
||||||
|
queue.add(item);//}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
double amountNeeded = buildGraph.getEdgeWeight(edge);
|
double amountNeeded = buildGraph.getEdgeWeight(edge);
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,8 @@ class ItemTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void productionUraniumFuelRod(){
|
void productionUraniumFuelRod(){
|
||||||
test(Database.UraniumFuelRod, "uranium_fuel_rod");
|
//test(Database.UraniumFuelRod, "uranium_fuel_rod");
|
||||||
|
fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue