|
@@ -46,7 +46,7 @@ public class PidLambdaContainer {
|
|
@Value("${model.oss.pid.filename.lambda:pid/lambda.txt}")
|
|
@Value("${model.oss.pid.filename.lambda:pid/lambda.txt}")
|
|
String lambdaFileName = "";
|
|
String lambdaFileName = "";
|
|
|
|
|
|
- @Value("${model.oss.pid.v2.filename.dCpa:pid/dCpaV2.txt}")
|
|
|
|
|
|
+ @Value("${model.oss.pid.v2.filename.dCpa:pid/dCpa.txt}")
|
|
String dCpaFileName = "";
|
|
String dCpaFileName = "";
|
|
|
|
|
|
@Value("${ad.model.pid.kp:0.4}")
|
|
@Value("${ad.model.pid.kp:0.4}")
|
|
@@ -108,9 +108,7 @@ public class PidLambdaContainer {
|
|
Double cpa=0d;
|
|
Double cpa=0d;
|
|
Double realCost=0d;
|
|
Double realCost=0d;
|
|
Double latestRealCPA=0d;
|
|
Double latestRealCPA=0d;
|
|
-// double et=0d;
|
|
|
|
double sumE=0d;
|
|
double sumE=0d;
|
|
-// double ve=0d;
|
|
|
|
while ((line = bufferedReader.readLine()) != null){
|
|
while ((line = bufferedReader.readLine()) != null){
|
|
try {
|
|
try {
|
|
String[] cols=line.split(",");
|
|
String[] cols=line.split(",");
|
|
@@ -123,12 +121,15 @@ public class PidLambdaContainer {
|
|
conversion=Double.parseDouble(cols[1]);
|
|
conversion=Double.parseDouble(cols[1]);
|
|
cpa=Double.parseDouble(cols[2]);
|
|
cpa=Double.parseDouble(cols[2]);
|
|
realCost=Double.parseDouble(cols[3]);
|
|
realCost=Double.parseDouble(cols[3]);
|
|
- if(conversion<5d){
|
|
|
|
- conversion=1d;
|
|
|
|
|
|
+ if(conversion<3d){
|
|
|
|
+ temp.put(creativeId,cacheItem);
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
latestRealCPA=realCost/conversion;
|
|
latestRealCPA=realCost/conversion;
|
|
Double lambdaNew =cacheItem.calculate(kp,ki,kd,cpa,latestRealCPA);
|
|
Double lambdaNew =cacheItem.calculate(kp,ki,kd,cpa,latestRealCPA);
|
|
-
|
|
|
|
|
|
+ if(lambdaNew<0.5){
|
|
|
|
+ lambdaNew=0.5;
|
|
|
|
+ }
|
|
cacheItem.lambda=lambdaNew;
|
|
cacheItem.lambda=lambdaNew;
|
|
cacheItem.latestRealCpa=latestRealCPA;
|
|
cacheItem.latestRealCpa=latestRealCPA;
|
|
cacheItem.sumError=sumE;
|
|
cacheItem.sumError=sumE;
|