public function updateBiaya(request $request)
 {
     foreach ($request->h as $k => $v) {
         \App\Models\heuristic::find($k)->update(['hCost' => $v]);
     }
     $kota = kota::all();
     return view('home', ['kota' => $kota]);
     //        dd($request->h);
 }
Пример #2
0
 public function hitungBiaya()
 {
     //menghitung fValue dari kota yang dibuka
     //
     if (null === $this->currentGCost) {
         $this->currentGCost = 0;
     }
     //counting fValue
     foreach ($this->nextNodeID as $next) {
         echo 'calc f of ' . $next . PHP_EOL;
         $dest = \App\Models\kota::find($next);
         $gcost = \App\Models\real::where('idKotaTujuan', $next)->where('idKotaAsal', $this->currentEval)->pluck('gCost');
         $hcost = $dest->hCost->hCost;
         $this->fValue[$next] = $this->currentGCost + $gcost + $hcost;
     }
 }
 public function getNodeName()
 {
     $this->result = '';
     foreach ($this->closed as $key) {
         $kota = \App\Models\kota::find($key);
         $this->result = $this->result . $kota->namaKota . ' - ';
     }
     return $this->result;
 }
Пример #4
0
 public function createModel($id)
 {
     try {
         $this->model = kota::find($id);
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }