change scorer formula
This commit is contained in:
@@ -93,13 +93,13 @@ public class Scorer {
|
|||||||
LOG.trace("Compute transit score fuel={}", fuel);
|
LOG.trace("Compute transit score fuel={}", fuel);
|
||||||
double profit = maxProfit;
|
double profit = maxProfit;
|
||||||
profit -= profile.getFuelPrice() * fuel / profile.getShip().getCargo();
|
profit -= profile.getFuelPrice() * fuel / profile.getShip().getCargo();
|
||||||
double score = 1;
|
|
||||||
score -= profile.getLandMult();
|
|
||||||
score -= profile.getJumpMult();
|
|
||||||
score = score * profit;
|
|
||||||
if (avgDistance > 0) {
|
if (avgDistance > 0) {
|
||||||
score -= - avgProfit * profile.getDistanceMult();
|
profit -= - avgProfit * profile.getDistanceMult();
|
||||||
}
|
}
|
||||||
|
if (profile.getLandMult() > 0){
|
||||||
|
profit = profit / profile.getLandMult();
|
||||||
|
}
|
||||||
|
double score = profit * (1 - profile.getJumpMult()/profile.getJumps());
|
||||||
LOG.trace("score={}", score);
|
LOG.trace("score={}", score);
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
@@ -108,20 +108,15 @@ public class Scorer {
|
|||||||
LOG.trace("Compute score distance={}, profit={}, jumps={}, lands={}, fuel={}", distance, profit, jumps, lands, fuel);
|
LOG.trace("Compute score distance={}, profit={}, jumps={}, lands={}, fuel={}", distance, profit, jumps, lands, fuel);
|
||||||
profit -= profile.getFuelPrice() * fuel;
|
profit -= profile.getFuelPrice() * fuel;
|
||||||
profit = profit / profile.getShip().getCargo();
|
profit = profit / profile.getShip().getCargo();
|
||||||
double score = 1;
|
if (avgDistance > 0) {
|
||||||
if (profit > 0) {
|
profit -= avgProfit * profile.getDistanceMult() * (distance - avgDistance) / avgDistance;
|
||||||
score -= profile.getJumpMult() * (jumps - 1);
|
}
|
||||||
score -= profile.getLandMult() * lands;
|
double score = profit;
|
||||||
if (score == 0) {
|
if (profit > 0){
|
||||||
score = profit;
|
if (lands > 0 && profile.getLandMult() > 0){
|
||||||
} else {
|
score = profit / (lands * profile.getLandMult());
|
||||||
score = score * profit;
|
|
||||||
}
|
}
|
||||||
if (avgDistance > 0) {
|
score -= profile.getJumpMult()/profile.getJumps() * score * jumps;
|
||||||
score -= avgProfit * profile.getDistanceMult() * (distance - avgDistance) / avgDistance;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
score = profit;
|
|
||||||
}
|
}
|
||||||
LOG.trace("score={}", score);
|
LOG.trace("score={}", score);
|
||||||
return score;
|
return score;
|
||||||
@@ -184,7 +179,7 @@ public class Scorer {
|
|||||||
|
|
||||||
private void computeScore(){
|
private void computeScore(){
|
||||||
score = (getSellProfit() + getBuyProfit())/2;
|
score = (getSellProfit() + getBuyProfit())/2;
|
||||||
score = Scorer.this.getScore(vendor, score, 0, 0, 0);
|
score = Scorer.this.getScore(vendor, score, 0, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -17,11 +17,12 @@ public class Profile {
|
|||||||
public Profile(Ship ship) {
|
public Profile(Ship ship) {
|
||||||
this.ship = ship;
|
this.ship = ship;
|
||||||
refill = true;
|
refill = true;
|
||||||
|
jumps = 6;
|
||||||
scoreOrdersCount = 5;
|
scoreOrdersCount = 5;
|
||||||
distanceMult = 0.08;
|
distanceMult = 0.8;
|
||||||
landMult = 0.95;
|
landMult = 0.95;
|
||||||
fuelPrice = 100;
|
fuelPrice = 100;
|
||||||
jumpMult = 0.008;
|
jumpMult = 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getBalance() {
|
public double getBalance() {
|
||||||
|
|||||||
@@ -145,9 +145,9 @@ public class ScorerTest extends Assert {
|
|||||||
assertTrue(score1 > score2);
|
assertTrue(score1 > score2);
|
||||||
assertTrue(score2 > score3);
|
assertTrue(score2 > score3);
|
||||||
|
|
||||||
score1 = scorer.getScore(scorer.getAvgDistance(), scorer.getAvgProfit(), 1, 0, 4);
|
score1 = scorer.getScore(scorer.getAvgDistance(), scorer.getAvgProfit(), 1, 1, 4);
|
||||||
score2 = scorer.getScore(scorer.getAvgDistance(), scorer.getAvgProfit(), 1, 1, 4);
|
score2 = scorer.getScore(scorer.getAvgDistance(), scorer.getAvgProfit(), 1, 2, 4);
|
||||||
score3 = scorer.getScore(scorer.getAvgDistance(), scorer.getAvgProfit(), 1, 2, 4);
|
score3 = scorer.getScore(scorer.getAvgDistance(), scorer.getAvgProfit(), 1, 3, 4);
|
||||||
assertTrue(score1 > score2);
|
assertTrue(score1 > score2);
|
||||||
assertTrue(score2 > score3);
|
assertTrue(score2 > score3);
|
||||||
|
|
||||||
@@ -187,6 +187,22 @@ public class ScorerTest extends Assert {
|
|||||||
assertTrue(transitScore < score2);
|
assertTrue(transitScore < score2);
|
||||||
assertTrue(transitScore > score3);
|
assertTrue(transitScore > score3);
|
||||||
|
|
||||||
|
score = scorer.getScore(scorer.getAvgDistance(), scorer.getAvgProfit(), 4, 2, 4);
|
||||||
|
score1 = scorer.getScore(scorer.getAvgDistance(), scorer.getAvgProfit()*1.2, 6, 2, 4);
|
||||||
|
score2 = scorer.getScore(scorer.getAvgDistance(), scorer.getAvgProfit(), 6, 2, 4);
|
||||||
|
score3 = scorer.getScore(scorer.getAvgDistance(), scorer.getAvgProfit()*1.4, 6, 2, 4);
|
||||||
|
assertTrue(score > score1);
|
||||||
|
assertTrue(score > score2);
|
||||||
|
assertTrue(score < score3);
|
||||||
|
|
||||||
|
score = scorer.getScore(scorer.getAvgDistance(), scorer.getAvgProfit(), 4, 2, 4);
|
||||||
|
score1 = scorer.getScore(scorer.getAvgDistance(), scorer.getAvgProfit()*1.9, 4, 4, 4);
|
||||||
|
score2 = scorer.getScore(scorer.getAvgDistance(), scorer.getAvgProfit(), 4, 4, 4);
|
||||||
|
score3 = scorer.getScore(scorer.getAvgDistance(), scorer.getAvgProfit()*2.1, 4, 4, 4);
|
||||||
|
assertTrue(score >= score1);
|
||||||
|
assertTrue(score > score2);
|
||||||
|
assertTrue(score < score3);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
|||||||
Reference in New Issue
Block a user