Fix 導引演算法
This commit is contained in:
parent
61642d9846
commit
85095457cc
@ -1353,6 +1353,16 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) {
|
||||
// 取得本次採用的教材風格
|
||||
$materialMode = $sact->getMaterialStyle();
|
||||
|
||||
// 是否已經學完了
|
||||
if($sact->getRemainingPointTotal() <= 0) {
|
||||
$isEnd = true;
|
||||
|
||||
$recommandResult = array();
|
||||
$recommandTotal = 0;
|
||||
}
|
||||
else {
|
||||
$isEnd = false;
|
||||
|
||||
// 取得推薦的學習點
|
||||
$recommand = new Recommand\RecommandPoint();
|
||||
$recommandResult = $recommand->recommand($currentTId, $saId);
|
||||
@ -1363,12 +1373,6 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) {
|
||||
else {
|
||||
$result_recommand_total = $recommandTotal;
|
||||
}
|
||||
// 是否已經學完了
|
||||
if($sact->getRemainingPointTotal() <= 0) {
|
||||
$isEnd = true;
|
||||
}
|
||||
else {
|
||||
$isEnd = false;
|
||||
}
|
||||
|
||||
// 製作
|
||||
|
@ -128,6 +128,7 @@ class RecommandPoint
|
||||
{
|
||||
$this->activity = new Study\StudyActivity($activity_number);
|
||||
$themeID = $this->activity->getThemeId();
|
||||
$enableVirtual = $this->activity->isEnableVirtual();
|
||||
$this->theme = new Study\Theme($themeID);
|
||||
$this->gamma = $this->computeNormalizationParameter($themeID);
|
||||
$pointList = $this->recommand->queryEdgeByID($current_point);
|
||||
@ -137,30 +138,40 @@ class RecommandPoint
|
||||
$pathCost = 0;
|
||||
$VirtualPathCost = 0;
|
||||
$recommand = array();
|
||||
$isEntity = true;
|
||||
for($i=0;$i<count($targetList);$i++)
|
||||
{
|
||||
$next_point = $targetList[$i]["next_point"];
|
||||
$moveTime = $targetList[$i]["move_time"];
|
||||
$nextPoint = new Target\Target($next_point);
|
||||
$weight = $this->theme->getWeightByNextTarget($next_point);
|
||||
|
||||
if($nextPoint->isFullPeople())
|
||||
{
|
||||
$pastCost = 0;
|
||||
$pathCost = 0;
|
||||
$virtualCost = RecommandPoint::ALPHA * $this->gamma * ($weight/$nextPoint->getLearnTime());
|
||||
$isEntity=false;
|
||||
|
||||
if($enableVirtual) {
|
||||
array_push($recommand,array("nextPoint" => $next_point,
|
||||
"isEntity" => $isEntity,
|
||||
"PathCost" => $pathCost,
|
||||
"VirtualCost" => $virtualCost));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$isEntity=true;
|
||||
if($nextPoint->isNumberOfPeopleZero()) $Rj = 0;
|
||||
else $Rj = $nextPoint->getMj()/$nextPoint->getPLj();
|
||||
$pathCost = RecommandPoint::ALPHA * $this->gamma * ($weight * ($nextPoint->getS()-$Rj+1)/($moveTime + $nextPoint->getLearnTime()));
|
||||
$virtualCost = RecommandPoint::ALPHA * $this->gamma * ($weight/$nextPoint->getLearnTime());
|
||||
}
|
||||
array_push($recommand,array("nextPoint"=>$next_point,
|
||||
|
||||
array_push($recommand,array("nextPoint" => $next_point,
|
||||
"isEntity" => $isEntity,
|
||||
"PathCost"=>$pathCost,
|
||||
"VirtualCost"=>$virtualCost));
|
||||
"PathCost" => $pathCost,
|
||||
"VirtualCost" => $virtualCost));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(count($recommand) >= 1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user