Changeset 1111 for applications/doprava
- Timestamp:
- 06/20/10 23:58:00 (14 years ago)
- Location:
- applications/doprava
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/doprava/Zlicingw.cfg
r1089 r1111 38 38 stage_names = ("601_F1","601_F2","601_F3"); 39 39 stage_times = [30,30,20]; 40 passive=1; 40 41 } 41 42 ); … … 59 60 // If present, overwrites stop_time. Ensures corrent termination of simulation 60 61 // Example: 1 hour = 40 cycles, 6 hours = 240 cycles, 24 hours = 960 61 stop_cycle=5;62 //stop_cycle=5; 62 63 63 64 }; -
applications/doprava/traffic_agent.h
r1070 r1111 190 190 for (int r=0; r<rv_outputs.length(); r++){ 191 191 int str_pos = rv_outputs.name(r).compare(neighbours(i)); 192 if (str_pos> neighbours(i).length()){192 if (str_pos>(int)neighbours(i).length()){ 193 193 rv_neighbours_out(i).add(rv_outputs.subselect(vec_1(r))); 194 194 } -
applications/doprava/traffic_agent_offset.h
r1081 r1111 4 4 5 5 class GreenWaveTrafficAgent : public BaseTrafficAgent { 6 LOG_LEVEL(GreenWaveTrafficAgent,logoffset); 6 7 protected: 7 8 double rating_change; 8 9 int negot_offset; 10 int negot_limit; 9 11 10 12 int actual_time; … … 39 41 bool final_state; 40 42 //bool reset_negot_offset; 43 44 int passive; 41 45 42 46 //! sum of final planned_offset values since last reach of cycle_count … … 501 505 send_requests=false; 502 506 need_exps=true; 503 negot_offset= 8;507 negot_offset=4; 504 508 } 505 509 … … 622 626 planned_rating=count_rating(planned_offset); 623 627 624 for (int i=0;i<neighbours.length();i++) { 625 rv_change_request.add(RV(neighbours(i)+"_change",2)); 626 change_request.set_size(rv_change_request._dsize()); 627 ivec ind=RV(neighbours(i)+"_change",2).dataind(rv_change_request); 628 // offset change 629 change_request(ind(0))=find_best_exps(negot_offset,neighbours(i),rating_change); 630 // rating change 631 change_request(ind(1))=rating_change; 632 } 633 634 if (negot_offset>2) { 635 negot_offset/=2; 628 if (!passive) { 629 630 for (int i=0;i<neighbours.length();i++) { 631 rv_change_request.add(RV(neighbours(i)+"_change",2)); 632 change_request.set_size(rv_change_request._dsize()); 633 ivec ind=RV(neighbours(i)+"_change",2).dataind(rv_change_request); 634 // offset change 635 change_request(ind(0))=find_best_exps(negot_offset,neighbours(i),rating_change); 636 // rating change 637 change_request(ind(1))=rating_change; 638 } 639 640 if (negot_offset>negot_limit) { 641 negot_offset/=2; 636 642 send_requests=true; 643 } 644 else { 645 final_state=true; 646 647 } 637 648 } 638 649 else { … … 687 698 total_offset=0; 688 699 689 negot_offset=8; 700 negot_offset=4; 701 negot_limit=1; 702 703 passive=0; 690 704 691 705 // load from file … … 694 708 //UI::get(green_starts, set, "green_starts", UI::compulsory); 695 709 UI::get(last_offset, set, "offset", UI::compulsory); 710 UI::get(passive, set, "passive", UI::optional); 696 711 697 712 for (int i=0;i<lanes.length();i++) { … … 704 719 } 705 720 outputs.set_size(rv_outputs._dsize()); 721 722 log_level[logoffset]=true; 706 723 } 707 724 … … 731 748 } 732 749 750 //void log_register(logger &l, const string &prefix){ 751 // if ( log_level[logoffset]){ 752 // l.add_vector ( log_level, logoffset, RV("mujoffset",1), prefix ); 753 // } 754 //} 755 //void log_write() const { 756 // if (log_level[logoffset]){ 757 // log_level.store(logoffset, (double)planned_offset); 758 // //log_level.store(logoffset, planned_rating); 759 // } 760 //} 761 762 733 763 734 764 };