<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lguo7</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lguo7"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Lguo7"/>
	<updated>2026-06-23T17:06:23Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113611</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113611"/>
		<updated>2017-11-15T16:11:29Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Navin Venugopal (nvenugo2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Sathwick Goparapu (sgopara@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of M4 reviewers (here M4 represents some constant)&lt;br /&gt;
** Each reviewer is assigned a maximum of M3 papers to review (here M3 represents some constant)&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
   For every topic j : &lt;br /&gt;
      For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
         Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
         B(i) = 1/S(i)&lt;br /&gt;
         Calculate C(i,j)                &lt;br /&gt;
         Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
&lt;br /&gt;
In the algorithm above, the Calculate C(i,j) involves the following:&lt;br /&gt;
&lt;br /&gt;
C(i,j) = 1/N * &amp;amp;sum; [ M1 -S(i) ] &lt;br /&gt;
&lt;br /&gt;
where we do the summation from i = 1 to i = N&lt;br /&gt;
&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
Situation in case of a priority tie: In the case that the algorithm groups all students preferring specific topic together and finds that there are more students in the cluster than the maximum team size M1, it evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of the resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
=Understanding the Flows=&lt;br /&gt;
Essentially, we have to design from scratch. Hence, we first describe the use cases, before going into the design phase.&lt;br /&gt;
&lt;br /&gt;
===Use Case===&lt;br /&gt;
Actors: &lt;br /&gt;
* Conference Reviewer: Submits a preference list of papers and reviews assigned papers&lt;br /&gt;
* Conference Administrator: Responsible for the assignment of topics to the reviewers&lt;br /&gt;
&lt;br /&gt;
Scenario&lt;br /&gt;
&lt;br /&gt;
The case of reviewers submitting a list of preferred topics and the administrator running the assignment process. For our project, the main modification would be concentrating on Use Case 4 and 5.&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Choose and submit preference to be reviewed====&lt;br /&gt;
 Use Case Id: 1&lt;br /&gt;
 Use Case Description: Participants choose the preference for conference review topics and submit it&lt;br /&gt;
 Actors: Participants&lt;br /&gt;
 Pre Conditions: Conference papers are presented and submitted, and the participants are eligible for reviewing&lt;br /&gt;
 Post Conditions: Conference committee members can view participants preference and run bidding algorithm on it&lt;br /&gt;
&lt;br /&gt;
====Saving bidder information into database====&lt;br /&gt;
 Use Case Id: 2&lt;br /&gt;
 Use Case Description: bidding preferences and related participants information are processed and saved to database&lt;br /&gt;
 Actors: None&lt;br /&gt;
 Triggered by: Use Case 1&lt;br /&gt;
 Pre Conditions: participants preferences are submitted&lt;br /&gt;
 Post Conditions: information can be retrieved and used by bidding algorithm&lt;br /&gt;
====View list of topics====&lt;br /&gt;
 Use Case Id: 3&lt;br /&gt;
 Use Case Description: participants can view list of topic available for conference paper topic&lt;br /&gt;
 Actors: Participants&lt;br /&gt;
====Run bidding process====&lt;br /&gt;
 Use Case Id: 4&lt;br /&gt;
 Use Case Description: Committee members can run bidding algorithm on application to help assigning the conference paper topics to &lt;br /&gt;
 participants&lt;br /&gt;
 Actors: Conference Committee&lt;br /&gt;
 Pre Conditions: preferences must be submitted by participants&lt;br /&gt;
 Post Conditions: the bidding result can be used for paper assignment&lt;br /&gt;
====Choosing and assigning paper to bidders====&lt;br /&gt;
 Use Case Id: 5&lt;br /&gt;
 Use Case Description: System assigns participants to conference paper topics according to bidding result&lt;br /&gt;
 Actors: None&lt;br /&gt;
 Triggered by: Use Case 4&lt;br /&gt;
 Pre Conditions: bidding algorithm has run and result has been returned&lt;br /&gt;
 Post Conditions: Participants can view topics been assigned to them&lt;br /&gt;
====Change assignment of review using CRUD actions====&lt;br /&gt;
 Use Case Id: 6&lt;br /&gt;
 Use Case Description: Conference committee members can change assignment result manually&lt;br /&gt;
 Actors: Conference Committee&lt;br /&gt;
 Pre Conditions: topic assignment has been done&lt;br /&gt;
 Post Conditions: changes on bidding result is visible to participants and other committee members&lt;br /&gt;
&lt;br /&gt;
=== Data Flow Diagram ===&lt;br /&gt;
Below is the Data Flow Diagram for process flows of the project. The diagram shows the process of bidding algorithm that we proposed to use for conference paper review assignment.&lt;br /&gt;
[[File:Webp.net-resizeimage (1).png]]&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
The changes in the first sub section below were prior to the mentor meeting, where we had a major change in our problem statement.&lt;br /&gt;
Earlier, we assumed that we only had to change the existing code, which is reflected above. &lt;br /&gt;
&lt;br /&gt;
However, with the new requirements, in addition we need to add completely new code.&lt;br /&gt;
&lt;br /&gt;
== Changing Existing Files ==&lt;br /&gt;
This sub section details what is to be changed in the existing code.&lt;br /&gt;
=== Files to be changed === &lt;br /&gt;
*lottery_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Current Code ===&lt;br /&gt;
This is current code for bidding assignment. The code will basically get target assignment and then get all topics and teams for the assignment. Then it will assign priority of each team-topic pair according to user preference  for each user, and append it to priority information list. Afterward it sends priority information along with maximum team size information to web-server and rearranging the priority order according to top-trading cycle algorithm, and pass returned result to create_new_teams_for_bidding_response function for bidding handling on topics with preferences and run_intelligent_bid function for bidding handling for leftover assignment as well as cleaning up.&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Proposed Changes ===&lt;br /&gt;
&lt;br /&gt;
To accommodate this code to fit our needs, we have proposed to add 3 new variable&lt;br /&gt;
&lt;br /&gt;
  new_intelligent_property&lt;br /&gt;
  topic_per_team&lt;br /&gt;
  team_per_topic&lt;br /&gt;
&lt;br /&gt;
new_intelligent_property will check if an assignment is using conference paper bidding or team assignment bidding, it will be true if bidding is on conference paper review and false if bidding is on team assignment; topic_per_team will record required number of topics that can be chosen per a team; and team_per_topic will record required number of teams that can be assigned to a topic. &lt;br /&gt;
&lt;br /&gt;
=== Proposed Code ===&lt;br /&gt;
&lt;br /&gt;
Then we will change the run_intelligent_assignment function to implementation as below:&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      if new_intelligent_property&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids }&lt;br /&gt;
      else&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    if !new_intelligent_property&lt;br /&gt;
      data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
      url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
      begin&lt;br /&gt;
        response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
        # store each summary in a hashmap and use the question as the key&lt;br /&gt;
        teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
        create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
        run_intelligent_bid(assignment)&lt;br /&gt;
      rescue =&amp;gt; err&lt;br /&gt;
        flash[:error] = err.message&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      run_conference_bid(teams, assignment, topic_per_team, team_per_topic)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Additional Changes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With this change, we will have to add a new function: run_conference_bid(teams, assignment), with pseudo-code as shown below:&lt;br /&gt;
&lt;br /&gt;
  def run_conference_bid teams, assignment, topic_per_team, team_per_topic&lt;br /&gt;
    set topic_set to false;&lt;br /&gt;
    for each team in teams&lt;br /&gt;
      append the team in team_list&lt;br /&gt;
      retrieve bidding ranks of each team&lt;br /&gt;
      sum all rank values in list&lt;br /&gt;
      for each topic priority/rank value in ranks list&lt;br /&gt;
        if topic_set is false&lt;br /&gt;
           append topic_id to topic_list&lt;br /&gt;
        end if&lt;br /&gt;
        calculate percentage of the rank value in comparison to sum of rank values &lt;br /&gt;
        if sum is 0 &lt;br /&gt;
          change percentage to 1/length_of_rank_list&lt;br /&gt;
        end if&lt;br /&gt;
        score rank value by doing (percent_rank_values *(number_of_topics^2) + (number_of_topics^2) / length_of_rank_list)&lt;br /&gt;
        append [team_id, score] to team_scores dictionary with team_id as key&lt;br /&gt;
      end for&lt;br /&gt;
      set topic_set to true&lt;br /&gt;
    end for&lt;br /&gt;
    sort team_scores dictionary by values/scores in descending order&lt;br /&gt;
    for score in team_scores&lt;br /&gt;
      if team not in team_list or topic not in topic_list&lt;br /&gt;
        remove score&lt;br /&gt;
        continue to next iteration&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id to topic_assignment list&lt;br /&gt;
      if number of occurrences of current topic in topic_assignment is same as topic_per_team&lt;br /&gt;
        remove this topic_id from topic_list&lt;br /&gt;
      end if&lt;br /&gt;
      append team_id to team_assignment list&lt;br /&gt;
      if number of occurrences of current team in team_assignment is same as team_per_topic&lt;br /&gt;
        remove this team_id from team_list&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id and team_id pair to team_bids&lt;br /&gt;
    end for&lt;br /&gt;
    save sign up information stored in team_bids to database&lt;br /&gt;
  end def&lt;br /&gt;
&lt;br /&gt;
=Test Plan=&lt;br /&gt;
&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
    1. Log in as a participants/student&lt;br /&gt;
&lt;br /&gt;
    2. Go to Assignment&lt;br /&gt;
&lt;br /&gt;
    3. Go to Other's works and check preferred conference paper topics to bid on reviewing&lt;br /&gt;
&lt;br /&gt;
    4. Click submit and wait for bidding deadline&lt;br /&gt;
&lt;br /&gt;
    5. After deadline reaches, go back to assignment and click on Other's work to view topics assigned for reviewing&lt;br /&gt;
&lt;br /&gt;
===Automated Test Cases===&lt;br /&gt;
* TDD and Feature Test cases to be written. For instance we would do Rspec test on cases below:&lt;br /&gt;
** Test on score calculation, see if the calculation gives right scoring distribution when no preference is given, when one preference is given, and when multiple preferences are given;&lt;br /&gt;
** Test on preference levels matching, check if the algorithm is match first, second, third, and so on preferences and evaluating them correctly;&lt;br /&gt;
** Test if teams per topic or topics per team can exceed required number by assigning many team with same first preference and assigning many team with multiple preferences (preference number per team &amp;gt; number of topics/2);&lt;br /&gt;
* For the Rspec tests, we will have to create object of team, assignment, and ranks. A sample team object in JSON format would be:&lt;br /&gt;
  {&amp;quot;users&amp;quot;:[{&amp;quot;ranks&amp;quot;:[1,0,2,3], &amp;quot;pid&amp;quot;:1023}],&amp;quot;max_team_size&amp;quot;:1}&lt;br /&gt;
* The objects would be generated inside the spec file lottery_controller_spec.rb using model object initializer;&lt;br /&gt;
&lt;br /&gt;
===Edge cases===&lt;br /&gt;
&lt;br /&gt;
* Case 1: No reviewer submits a list of preferred topics to review&lt;br /&gt;
&lt;br /&gt;
* Case 2: All reviewers submits exactly the same list of topics to review.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113610</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113610"/>
		<updated>2017-11-15T16:09:33Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Data Flow Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Navin&lt;br /&gt;
&lt;br /&gt;
Sathwick (sgopara@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of M4 reviewers (here M4 represents some constant)&lt;br /&gt;
** Each reviewer is assigned a maximum of M3 papers to review (here M3 represents some constant)&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
   For every topic j : &lt;br /&gt;
      For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
         Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
         B(i) = 1/S(i)&lt;br /&gt;
         Calculate C(i,j)                &lt;br /&gt;
         Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
&lt;br /&gt;
In the algorithm above, the Calculate C(i,j) involves the following:&lt;br /&gt;
&lt;br /&gt;
C(i,j) = 1/N * &amp;amp;sum; [ M1 -S(i) ] &lt;br /&gt;
&lt;br /&gt;
where we do the summation from i = 1 to i = N&lt;br /&gt;
&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
Situation in case of a priority tie: In the case that the algorithm groups all students preferring specific topic together and finds that there are more students in the cluster than the maximum team size M1, it evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of the resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
=Understanding the Flows=&lt;br /&gt;
Essentially, we have to design from scratch. Hence, we first describe the use cases, before going into the design phase.&lt;br /&gt;
&lt;br /&gt;
===Use Case===&lt;br /&gt;
Actors: &lt;br /&gt;
* Conference Reviewer: Submits a preference list of papers and reviews assigned papers&lt;br /&gt;
* Conference Administrator: Responsible for the assignment of topics to the reviewers&lt;br /&gt;
&lt;br /&gt;
Scenario&lt;br /&gt;
&lt;br /&gt;
The case of reviewers submitting a list of preferred topics and the administrator running the assignment process. For our project, the main modification would be concentrating on Use Case 4 and 5.&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Choose and submit preference to be reviewed====&lt;br /&gt;
 Use Case Id: 1&lt;br /&gt;
 Use Case Description: Participants choose the preference for conference review topics and submit it&lt;br /&gt;
 Actors: Participants&lt;br /&gt;
 Pre Conditions: Conference papers are presented and submitted, and the participants are eligible for reviewing&lt;br /&gt;
 Post Conditions: Conference committee members can view participants preference and run bidding algorithm on it&lt;br /&gt;
&lt;br /&gt;
====Saving bidder information into database====&lt;br /&gt;
 Use Case Id: 2&lt;br /&gt;
 Use Case Description: bidding preferences and related participants information are processed and saved to database&lt;br /&gt;
 Actors: None&lt;br /&gt;
 Triggered by: Use Case 1&lt;br /&gt;
 Pre Conditions: participants preferences are submitted&lt;br /&gt;
 Post Conditions: information can be retrieved and used by bidding algorithm&lt;br /&gt;
====View list of topics====&lt;br /&gt;
 Use Case Id: 3&lt;br /&gt;
 Use Case Description: participants can view list of topic available for conference paper topic&lt;br /&gt;
 Actors: Participants&lt;br /&gt;
====Run bidding process====&lt;br /&gt;
 Use Case Id: 4&lt;br /&gt;
 Use Case Description: Committee members can run bidding algorithm on application to help assigning the conference paper topics to &lt;br /&gt;
 participants&lt;br /&gt;
 Actors: Conference Committee&lt;br /&gt;
 Pre Conditions: preferences must be submitted by participants&lt;br /&gt;
 Post Conditions: the bidding result can be used for paper assignment&lt;br /&gt;
====Choosing and assigning paper to bidders====&lt;br /&gt;
 Use Case Id: 5&lt;br /&gt;
 Use Case Description: System assigns participants to conference paper topics according to bidding result&lt;br /&gt;
 Actors: None&lt;br /&gt;
 Triggered by: Use Case 4&lt;br /&gt;
 Pre Conditions: bidding algorithm has run and result has been returned&lt;br /&gt;
 Post Conditions: Participants can view topics been assigned to them&lt;br /&gt;
====Change assignment of review using CRUD actions====&lt;br /&gt;
 Use Case Id: 6&lt;br /&gt;
 Use Case Description: Conference committee members can change assignment result manually&lt;br /&gt;
 Actors: Conference Committee&lt;br /&gt;
 Pre Conditions: topic assignment has been done&lt;br /&gt;
 Post Conditions: changes on bidding result is visible to participants and other committee members&lt;br /&gt;
&lt;br /&gt;
=== Data Flow Diagram ===&lt;br /&gt;
Below is the Data Flow Diagram for process flows of the project. The diagram shows the process of bidding algorithm that we proposed to use for conference paper review assignment.&lt;br /&gt;
[[File:Webp.net-resizeimage (1).png]]&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
The changes in the first sub section below were prior to the mentor meeting, where we had a major change in our problem statement.&lt;br /&gt;
Earlier, we assumed that we only had to change the existing code, which is reflected above. &lt;br /&gt;
&lt;br /&gt;
However, with the new requirements, in addition we need to add completely new code.&lt;br /&gt;
&lt;br /&gt;
== Changing Existing Files ==&lt;br /&gt;
This sub section details what is to be changed in the existing code.&lt;br /&gt;
=== Files to be changed === &lt;br /&gt;
*lottery_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Current Code ===&lt;br /&gt;
This is current code for bidding assignment. The code will basically get target assignment and then get all topics and teams for the assignment. Then it will assign priority of each team-topic pair according to user preference  for each user, and append it to priority information list. Afterward it sends priority information along with maximum team size information to web-server and rearranging the priority order according to top-trading cycle algorithm, and pass returned result to create_new_teams_for_bidding_response function for bidding handling on topics with preferences and run_intelligent_bid function for bidding handling for leftover assignment as well as cleaning up.&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Proposed Changes ===&lt;br /&gt;
&lt;br /&gt;
To accommodate this code to fit our needs, we have proposed to add 3 new variable&lt;br /&gt;
&lt;br /&gt;
  new_intelligent_property&lt;br /&gt;
  topic_per_team&lt;br /&gt;
  team_per_topic&lt;br /&gt;
&lt;br /&gt;
new_intelligent_property will check if an assignment is using conference paper bidding or team assignment bidding, it will be true if bidding is on conference paper review and false if bidding is on team assignment; topic_per_team will record required number of topics that can be chosen per a team; and team_per_topic will record required number of teams that can be assigned to a topic. &lt;br /&gt;
&lt;br /&gt;
=== Proposed Code ===&lt;br /&gt;
&lt;br /&gt;
Then we will change the run_intelligent_assignment function to implementation as below:&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      if new_intelligent_property&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids }&lt;br /&gt;
      else&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    if !new_intelligent_property&lt;br /&gt;
      data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
      url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
      begin&lt;br /&gt;
        response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
        # store each summary in a hashmap and use the question as the key&lt;br /&gt;
        teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
        create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
        run_intelligent_bid(assignment)&lt;br /&gt;
      rescue =&amp;gt; err&lt;br /&gt;
        flash[:error] = err.message&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      run_conference_bid(teams, assignment, topic_per_team, team_per_topic)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Additional Changes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With this change, we will have to add a new function: run_conference_bid(teams, assignment), with pseudo-code as shown below:&lt;br /&gt;
&lt;br /&gt;
  def run_conference_bid teams, assignment, topic_per_team, team_per_topic&lt;br /&gt;
    set topic_set to false;&lt;br /&gt;
    for each team in teams&lt;br /&gt;
      append the team in team_list&lt;br /&gt;
      retrieve bidding ranks of each team&lt;br /&gt;
      sum all rank values in list&lt;br /&gt;
      for each topic priority/rank value in ranks list&lt;br /&gt;
        if topic_set is false&lt;br /&gt;
           append topic_id to topic_list&lt;br /&gt;
        end if&lt;br /&gt;
        calculate percentage of the rank value in comparison to sum of rank values &lt;br /&gt;
        if sum is 0 &lt;br /&gt;
          change percentage to 1/length_of_rank_list&lt;br /&gt;
        end if&lt;br /&gt;
        score rank value by doing (percent_rank_values *(number_of_topics^2) + (number_of_topics^2) / length_of_rank_list)&lt;br /&gt;
        append [team_id, score] to team_scores dictionary with team_id as key&lt;br /&gt;
      end for&lt;br /&gt;
      set topic_set to true&lt;br /&gt;
    end for&lt;br /&gt;
    sort team_scores dictionary by values/scores in descending order&lt;br /&gt;
    for score in team_scores&lt;br /&gt;
      if team not in team_list or topic not in topic_list&lt;br /&gt;
        remove score&lt;br /&gt;
        continue to next iteration&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id to topic_assignment list&lt;br /&gt;
      if number of occurrences of current topic in topic_assignment is same as topic_per_team&lt;br /&gt;
        remove this topic_id from topic_list&lt;br /&gt;
      end if&lt;br /&gt;
      append team_id to team_assignment list&lt;br /&gt;
      if number of occurrences of current team in team_assignment is same as team_per_topic&lt;br /&gt;
        remove this team_id from team_list&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id and team_id pair to team_bids&lt;br /&gt;
    end for&lt;br /&gt;
    save sign up information stored in team_bids to database&lt;br /&gt;
  end def&lt;br /&gt;
&lt;br /&gt;
=Test Plan=&lt;br /&gt;
&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
    1. Log in as a participants/student&lt;br /&gt;
&lt;br /&gt;
    2. Go to Assignment&lt;br /&gt;
&lt;br /&gt;
    3. Go to Other's works and check preferred conference paper topics to bid on reviewing&lt;br /&gt;
&lt;br /&gt;
    4. Click submit and wait for bidding deadline&lt;br /&gt;
&lt;br /&gt;
    5. After deadline reaches, go back to assignment and click on Other's work to view topics assigned for reviewing&lt;br /&gt;
&lt;br /&gt;
===Automated Test Cases===&lt;br /&gt;
* TDD and Feature Test cases to be written. For instance we would do Rspec test on cases below:&lt;br /&gt;
** Test on score calculation, see if the calculation gives right scoring distribution when no preference is given, when one preference is given, and when multiple preferences are given;&lt;br /&gt;
** Test on preference levels matching, check if the algorithm is match first, second, third, and so on preferences and evaluating them correctly;&lt;br /&gt;
** Test if teams per topic or topics per team can exceed required number by assigning many team with same first preference and assigning many team with multiple preferences (preference number per team &amp;gt; number of topics/2);&lt;br /&gt;
* For the Rspec tests, we will have to create object of team, assignment, and ranks. A sample team object in JSON format would be:&lt;br /&gt;
  {&amp;quot;users&amp;quot;:[{&amp;quot;ranks&amp;quot;:[1,0,2,3], &amp;quot;pid&amp;quot;:1023}],&amp;quot;max_team_size&amp;quot;:1}&lt;br /&gt;
* The objects would be generated inside the spec file lottery_controller_spec.rb using model object initializer;&lt;br /&gt;
&lt;br /&gt;
===Edge cases===&lt;br /&gt;
&lt;br /&gt;
* Case 1: No reviewer submits a list of preferred topics to review&lt;br /&gt;
&lt;br /&gt;
* Case 2: All reviewers submits exactly the same list of topics to review.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113609</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113609"/>
		<updated>2017-11-15T16:07:51Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Use Case */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Navin&lt;br /&gt;
&lt;br /&gt;
Sathwick (sgopara@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of M4 reviewers (here M4 represents some constant)&lt;br /&gt;
** Each reviewer is assigned a maximum of M3 papers to review (here M3 represents some constant)&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
   For every topic j : &lt;br /&gt;
      For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
         Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
         B(i) = 1/S(i)&lt;br /&gt;
         Calculate C(i,j)                &lt;br /&gt;
         Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
&lt;br /&gt;
In the algorithm above, the Calculate C(i,j) involves the following:&lt;br /&gt;
&lt;br /&gt;
C(i,j) = 1/N * &amp;amp;sum; [ M1 -S(i) ] &lt;br /&gt;
&lt;br /&gt;
where we do the summation from i = 1 to i = N&lt;br /&gt;
&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
Situation in case of a priority tie: In the case that the algorithm groups all students preferring specific topic together and finds that there are more students in the cluster than the maximum team size M1, it evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of the resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
=Understanding the Flows=&lt;br /&gt;
Essentially, we have to design from scratch. Hence, we first describe the use cases, before going into the design phase.&lt;br /&gt;
&lt;br /&gt;
===Use Case===&lt;br /&gt;
Actors: &lt;br /&gt;
* Conference Reviewer: Submits a preference list of papers and reviews assigned papers&lt;br /&gt;
* Conference Administrator: Responsible for the assignment of topics to the reviewers&lt;br /&gt;
&lt;br /&gt;
Scenario&lt;br /&gt;
&lt;br /&gt;
The case of reviewers submitting a list of preferred topics and the administrator running the assignment process. For our project, the main modification would be concentrating on Use Case 4 and 5.&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Choose and submit preference to be reviewed====&lt;br /&gt;
 Use Case Id: 1&lt;br /&gt;
 Use Case Description: Participants choose the preference for conference review topics and submit it&lt;br /&gt;
 Actors: Participants&lt;br /&gt;
 Pre Conditions: Conference papers are presented and submitted, and the participants are eligible for reviewing&lt;br /&gt;
 Post Conditions: Conference committee members can view participants preference and run bidding algorithm on it&lt;br /&gt;
&lt;br /&gt;
====Saving bidder information into database====&lt;br /&gt;
 Use Case Id: 2&lt;br /&gt;
 Use Case Description: bidding preferences and related participants information are processed and saved to database&lt;br /&gt;
 Actors: None&lt;br /&gt;
 Triggered by: Use Case 1&lt;br /&gt;
 Pre Conditions: participants preferences are submitted&lt;br /&gt;
 Post Conditions: information can be retrieved and used by bidding algorithm&lt;br /&gt;
====View list of topics====&lt;br /&gt;
 Use Case Id: 3&lt;br /&gt;
 Use Case Description: participants can view list of topic available for conference paper topic&lt;br /&gt;
 Actors: Participants&lt;br /&gt;
====Run bidding process====&lt;br /&gt;
 Use Case Id: 4&lt;br /&gt;
 Use Case Description: Committee members can run bidding algorithm on application to help assigning the conference paper topics to &lt;br /&gt;
 participants&lt;br /&gt;
 Actors: Conference Committee&lt;br /&gt;
 Pre Conditions: preferences must be submitted by participants&lt;br /&gt;
 Post Conditions: the bidding result can be used for paper assignment&lt;br /&gt;
====Choosing and assigning paper to bidders====&lt;br /&gt;
 Use Case Id: 5&lt;br /&gt;
 Use Case Description: System assigns participants to conference paper topics according to bidding result&lt;br /&gt;
 Actors: None&lt;br /&gt;
 Triggered by: Use Case 4&lt;br /&gt;
 Pre Conditions: bidding algorithm has run and result has been returned&lt;br /&gt;
 Post Conditions: Participants can view topics been assigned to them&lt;br /&gt;
====Change assignment of review using CRUD actions====&lt;br /&gt;
 Use Case Id: 6&lt;br /&gt;
 Use Case Description: Conference committee members can change assignment result manually&lt;br /&gt;
 Actors: Conference Committee&lt;br /&gt;
 Pre Conditions: topic assignment has been done&lt;br /&gt;
 Post Conditions: changes on bidding result is visible to participants and other committee members&lt;br /&gt;
&lt;br /&gt;
=== Data Flow Diagram ===&lt;br /&gt;
Below is the Data Flow Diagram for process flows of the project.&lt;br /&gt;
[[File:Webp.net-resizeimage (1).png]]&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
The changes in the first sub section below were prior to the mentor meeting, where we had a major change in our problem statement.&lt;br /&gt;
Earlier, we assumed that we only had to change the existing code, which is reflected above. &lt;br /&gt;
&lt;br /&gt;
However, with the new requirements, in addition we need to add completely new code.&lt;br /&gt;
&lt;br /&gt;
== Changing Existing Files ==&lt;br /&gt;
This sub section details what is to be changed in the existing code.&lt;br /&gt;
=== Files to be changed === &lt;br /&gt;
*lottery_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Current Code ===&lt;br /&gt;
This is current code for bidding assignment. The code will basically get target assignment and then get all topics and teams for the assignment. Then it will assign priority of each team-topic pair according to user preference  for each user, and append it to priority information list. Afterward it sends priority information along with maximum team size information to web-server and rearranging the priority order according to top-trading cycle algorithm, and pass returned result to create_new_teams_for_bidding_response function for bidding handling on topics with preferences and run_intelligent_bid function for bidding handling for leftover assignment as well as cleaning up.&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Proposed Changes ===&lt;br /&gt;
&lt;br /&gt;
To accommodate this code to fit our needs, we have proposed to add 3 new variable&lt;br /&gt;
&lt;br /&gt;
  new_intelligent_property&lt;br /&gt;
  topic_per_team&lt;br /&gt;
  team_per_topic&lt;br /&gt;
&lt;br /&gt;
new_intelligent_property will check if an assignment is using conference paper bidding or team assignment bidding, it will be true if bidding is on conference paper review and false if bidding is on team assignment; topic_per_team will record required number of topics that can be chosen per a team; and team_per_topic will record required number of teams that can be assigned to a topic. &lt;br /&gt;
&lt;br /&gt;
=== Proposed Code ===&lt;br /&gt;
&lt;br /&gt;
Then we will change the run_intelligent_assignment function to implementation as below:&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      if new_intelligent_property&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids }&lt;br /&gt;
      else&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    if !new_intelligent_property&lt;br /&gt;
      data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
      url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
      begin&lt;br /&gt;
        response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
        # store each summary in a hashmap and use the question as the key&lt;br /&gt;
        teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
        create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
        run_intelligent_bid(assignment)&lt;br /&gt;
      rescue =&amp;gt; err&lt;br /&gt;
        flash[:error] = err.message&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      run_conference_bid(teams, assignment, topic_per_team, team_per_topic)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Additional Changes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With this change, we will have to add a new function: run_conference_bid(teams, assignment), with pseudo-code as shown below:&lt;br /&gt;
&lt;br /&gt;
  def run_conference_bid teams, assignment, topic_per_team, team_per_topic&lt;br /&gt;
    set topic_set to false;&lt;br /&gt;
    for each team in teams&lt;br /&gt;
      append the team in team_list&lt;br /&gt;
      retrieve bidding ranks of each team&lt;br /&gt;
      sum all rank values in list&lt;br /&gt;
      for each topic priority/rank value in ranks list&lt;br /&gt;
        if topic_set is false&lt;br /&gt;
           append topic_id to topic_list&lt;br /&gt;
        end if&lt;br /&gt;
        calculate percentage of the rank value in comparison to sum of rank values &lt;br /&gt;
        if sum is 0 &lt;br /&gt;
          change percentage to 1/length_of_rank_list&lt;br /&gt;
        end if&lt;br /&gt;
        score rank value by doing (percent_rank_values *(number_of_topics^2) + (number_of_topics^2) / length_of_rank_list)&lt;br /&gt;
        append [team_id, score] to team_scores dictionary with team_id as key&lt;br /&gt;
      end for&lt;br /&gt;
      set topic_set to true&lt;br /&gt;
    end for&lt;br /&gt;
    sort team_scores dictionary by values/scores in descending order&lt;br /&gt;
    for score in team_scores&lt;br /&gt;
      if team not in team_list or topic not in topic_list&lt;br /&gt;
        remove score&lt;br /&gt;
        continue to next iteration&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id to topic_assignment list&lt;br /&gt;
      if number of occurrences of current topic in topic_assignment is same as topic_per_team&lt;br /&gt;
        remove this topic_id from topic_list&lt;br /&gt;
      end if&lt;br /&gt;
      append team_id to team_assignment list&lt;br /&gt;
      if number of occurrences of current team in team_assignment is same as team_per_topic&lt;br /&gt;
        remove this team_id from team_list&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id and team_id pair to team_bids&lt;br /&gt;
    end for&lt;br /&gt;
    save sign up information stored in team_bids to database&lt;br /&gt;
  end def&lt;br /&gt;
&lt;br /&gt;
=Test Plan=&lt;br /&gt;
&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
    1. Log in as a participants/student&lt;br /&gt;
&lt;br /&gt;
    2. Go to Assignment&lt;br /&gt;
&lt;br /&gt;
    3. Go to Other's works and check preferred conference paper topics to bid on reviewing&lt;br /&gt;
&lt;br /&gt;
    4. Click submit and wait for bidding deadline&lt;br /&gt;
&lt;br /&gt;
    5. After deadline reaches, go back to assignment and click on Other's work to view topics assigned for reviewing&lt;br /&gt;
&lt;br /&gt;
===Automated Test Cases===&lt;br /&gt;
* TDD and Feature Test cases to be written. For instance we would do Rspec test on cases below:&lt;br /&gt;
** Test on score calculation, see if the calculation gives right scoring distribution when no preference is given, when one preference is given, and when multiple preferences are given;&lt;br /&gt;
** Test on preference levels matching, check if the algorithm is match first, second, third, and so on preferences and evaluating them correctly;&lt;br /&gt;
** Test if teams per topic or topics per team can exceed required number by assigning many team with same first preference and assigning many team with multiple preferences (preference number per team &amp;gt; number of topics/2);&lt;br /&gt;
* For the Rspec tests, we will have to create object of team, assignment, and ranks. A sample team object in JSON format would be:&lt;br /&gt;
  {&amp;quot;users&amp;quot;:[{&amp;quot;ranks&amp;quot;:[1,0,2,3], &amp;quot;pid&amp;quot;:1023}],&amp;quot;max_team_size&amp;quot;:1}&lt;br /&gt;
* The objects would be generated inside the spec file lottery_controller_spec.rb using model object initializer;&lt;br /&gt;
&lt;br /&gt;
===Edge cases===&lt;br /&gt;
&lt;br /&gt;
* Case 1: No reviewer submits a list of preferred topics to review&lt;br /&gt;
&lt;br /&gt;
* Case 2: All reviewers submits exactly the same list of topics to review.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113608</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113608"/>
		<updated>2017-11-15T16:05:41Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Manual Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Navin&lt;br /&gt;
&lt;br /&gt;
Sathwick (sgopara@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of M4 reviewers (here M4 represents some constant)&lt;br /&gt;
** Each reviewer is assigned a maximum of M3 papers to review (here M3 represents some constant)&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
   For every topic j : &lt;br /&gt;
      For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
         Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
         B(i) = 1/S(i)&lt;br /&gt;
         Calculate C(i,j)                &lt;br /&gt;
         Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
&lt;br /&gt;
In the algorithm above, the Calculate C(i,j) involves the following:&lt;br /&gt;
&lt;br /&gt;
C(i,j) = 1/N * &amp;amp;sum; [ M1 -S(i) ] &lt;br /&gt;
&lt;br /&gt;
where we do the summation from i = 1 to i = N&lt;br /&gt;
&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
Situation in case of a priority tie: In the case that the algorithm groups all students preferring specific topic together and finds that there are more students in the cluster than the maximum team size M1, it evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of the resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
=Understanding the Flows=&lt;br /&gt;
Essentially, we have to design from scratch. Hence, we first describe the use cases, before going into the design phase.&lt;br /&gt;
&lt;br /&gt;
===Use Case===&lt;br /&gt;
Actors: &lt;br /&gt;
* Conference Reviewer: Submits a preference list of papers and reviews assigned papers&lt;br /&gt;
* Conference Administrator: Responsible for the assignment of topics to the reviewers&lt;br /&gt;
&lt;br /&gt;
Scenario&lt;br /&gt;
&lt;br /&gt;
The case of reviewers submitting a list of preferred topics and the administrator running the assignment process.&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Choose and submit preference to be reviewed====&lt;br /&gt;
 Use Case Id: 1&lt;br /&gt;
 Use Case Description: Participants choose the preference for conference review topics and submit it&lt;br /&gt;
 Actors: Participants&lt;br /&gt;
 Pre Conditions: Conference papers are presented and submitted, and the participants are eligible for reviewing&lt;br /&gt;
 Post Conditions: Conference committee members can view participants preference and run bidding algorithm on it&lt;br /&gt;
&lt;br /&gt;
====Saving bidder information into database====&lt;br /&gt;
 Use Case Id: 2&lt;br /&gt;
 Use Case Description: bidding preferences and related participants information are processed and saved to database&lt;br /&gt;
 Actors: None&lt;br /&gt;
 Triggered by: Use Case 1&lt;br /&gt;
 Pre Conditions: participants preferences are submitted&lt;br /&gt;
 Post Conditions: information can be retrieved and used by bidding algorithm&lt;br /&gt;
====View list of topics====&lt;br /&gt;
 Use Case Id: 3&lt;br /&gt;
 Use Case Description: participants can view list of topic available for conference paper topic&lt;br /&gt;
 Actors: Participants&lt;br /&gt;
====Run bidding process====&lt;br /&gt;
 Use Case Id: 4&lt;br /&gt;
 Use Case Description: Committee members can run bidding algorithm on application to help assigning the conference paper topics to &lt;br /&gt;
 participants&lt;br /&gt;
 Actors: Conference Committee&lt;br /&gt;
 Pre Conditions: preferences must be submitted by participants&lt;br /&gt;
 Post Conditions: the bidding result can be used for paper assignment&lt;br /&gt;
====Choosing and assigning paper to bidders====&lt;br /&gt;
 Use Case Id: 5&lt;br /&gt;
 Use Case Description: System assigns participants to conference paper topics according to bidding result&lt;br /&gt;
 Actors: None&lt;br /&gt;
 Triggered by: Use Case 4&lt;br /&gt;
 Pre Conditions: bidding algorithm has run and result has been returned&lt;br /&gt;
 Post Conditions: Participants can view topics been assigned to them&lt;br /&gt;
====Change assignment of review using CRUD actions====&lt;br /&gt;
 Use Case Id: 6&lt;br /&gt;
 Use Case Description: Conference committee members can change assignment result manually&lt;br /&gt;
 Actors: Conference Committee&lt;br /&gt;
 Pre Conditions: topic assignment has been done&lt;br /&gt;
 Post Conditions: changes on bidding result is visible to participants and other committee members&lt;br /&gt;
&lt;br /&gt;
=== Data Flow Diagram ===&lt;br /&gt;
Below is the Data Flow Diagram for process flows of the project.&lt;br /&gt;
[[File:Webp.net-resizeimage (1).png]]&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
The changes in the first sub section below were prior to the mentor meeting, where we had a major change in our problem statement.&lt;br /&gt;
Earlier, we assumed that we only had to change the existing code, which is reflected above. &lt;br /&gt;
&lt;br /&gt;
However, with the new requirements, in addition we need to add completely new code.&lt;br /&gt;
&lt;br /&gt;
== Changing Existing Files ==&lt;br /&gt;
This sub section details what is to be changed in the existing code.&lt;br /&gt;
=== Files to be changed === &lt;br /&gt;
*lottery_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Current Code ===&lt;br /&gt;
This is current code for bidding assignment. The code will basically get target assignment and then get all topics and teams for the assignment. Then it will assign priority of each team-topic pair according to user preference  for each user, and append it to priority information list. Afterward it sends priority information along with maximum team size information to web-server and rearranging the priority order according to top-trading cycle algorithm, and pass returned result to create_new_teams_for_bidding_response function for bidding handling on topics with preferences and run_intelligent_bid function for bidding handling for leftover assignment as well as cleaning up.&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Proposed Changes ===&lt;br /&gt;
&lt;br /&gt;
To accommodate this code to fit our needs, we have proposed to add 3 new variable&lt;br /&gt;
&lt;br /&gt;
  new_intelligent_property&lt;br /&gt;
  topic_per_team&lt;br /&gt;
  team_per_topic&lt;br /&gt;
&lt;br /&gt;
new_intelligent_property will check if an assignment is using conference paper bidding or team assignment bidding, it will be true if bidding is on conference paper review and false if bidding is on team assignment; topic_per_team will record required number of topics that can be chosen per a team; and team_per_topic will record required number of teams that can be assigned to a topic. &lt;br /&gt;
&lt;br /&gt;
=== Proposed Code ===&lt;br /&gt;
&lt;br /&gt;
Then we will change the run_intelligent_assignment function to implementation as below:&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      if new_intelligent_property&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids }&lt;br /&gt;
      else&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    if !new_intelligent_property&lt;br /&gt;
      data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
      url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
      begin&lt;br /&gt;
        response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
        # store each summary in a hashmap and use the question as the key&lt;br /&gt;
        teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
        create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
        run_intelligent_bid(assignment)&lt;br /&gt;
      rescue =&amp;gt; err&lt;br /&gt;
        flash[:error] = err.message&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      run_conference_bid(teams, assignment, topic_per_team, team_per_topic)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Additional Changes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With this change, we will have to add a new function: run_conference_bid(teams, assignment), with pseudo-code as shown below:&lt;br /&gt;
&lt;br /&gt;
  def run_conference_bid teams, assignment, topic_per_team, team_per_topic&lt;br /&gt;
    set topic_set to false;&lt;br /&gt;
    for each team in teams&lt;br /&gt;
      append the team in team_list&lt;br /&gt;
      retrieve bidding ranks of each team&lt;br /&gt;
      sum all rank values in list&lt;br /&gt;
      for each topic priority/rank value in ranks list&lt;br /&gt;
        if topic_set is false&lt;br /&gt;
           append topic_id to topic_list&lt;br /&gt;
        end if&lt;br /&gt;
        calculate percentage of the rank value in comparison to sum of rank values &lt;br /&gt;
        if sum is 0 &lt;br /&gt;
          change percentage to 1/length_of_rank_list&lt;br /&gt;
        end if&lt;br /&gt;
        score rank value by doing (percent_rank_values *(number_of_topics^2) + (number_of_topics^2) / length_of_rank_list)&lt;br /&gt;
        append [team_id, score] to team_scores dictionary with team_id as key&lt;br /&gt;
      end for&lt;br /&gt;
      set topic_set to true&lt;br /&gt;
    end for&lt;br /&gt;
    sort team_scores dictionary by values/scores in descending order&lt;br /&gt;
    for score in team_scores&lt;br /&gt;
      if team not in team_list or topic not in topic_list&lt;br /&gt;
        remove score&lt;br /&gt;
        continue to next iteration&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id to topic_assignment list&lt;br /&gt;
      if number of occurrences of current topic in topic_assignment is same as topic_per_team&lt;br /&gt;
        remove this topic_id from topic_list&lt;br /&gt;
      end if&lt;br /&gt;
      append team_id to team_assignment list&lt;br /&gt;
      if number of occurrences of current team in team_assignment is same as team_per_topic&lt;br /&gt;
        remove this team_id from team_list&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id and team_id pair to team_bids&lt;br /&gt;
    end for&lt;br /&gt;
    save sign up information stored in team_bids to database&lt;br /&gt;
  end def&lt;br /&gt;
&lt;br /&gt;
=Test Plan=&lt;br /&gt;
&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
    1. Log in as a participants/student&lt;br /&gt;
&lt;br /&gt;
    2. Go to Assignment&lt;br /&gt;
&lt;br /&gt;
    3. Go to Other's works and check preferred conference paper topics to bid on reviewing&lt;br /&gt;
&lt;br /&gt;
    4. Click submit and wait for bidding deadline&lt;br /&gt;
&lt;br /&gt;
    5. After deadline reaches, go back to assignment and click on Other's work to view topics assigned for reviewing&lt;br /&gt;
&lt;br /&gt;
===Automated Test Cases===&lt;br /&gt;
* TDD and Feature Test cases to be written. For instance we would do Rspec test on cases below:&lt;br /&gt;
** Test on score calculation, see if the calculation gives right scoring distribution when no preference is given, when one preference is given, and when multiple preferences are given;&lt;br /&gt;
** Test on preference levels matching, check if the algorithm is match first, second, third, and so on preferences and evaluating them correctly;&lt;br /&gt;
** Test if teams per topic or topics per team can exceed required number by assigning many team with same first preference and assigning many team with multiple preferences (preference number per team &amp;gt; number of topics/2);&lt;br /&gt;
* For the Rspec tests, we will have to create object of team, assignment, and ranks. A sample team object in JSON format would be:&lt;br /&gt;
  {&amp;quot;users&amp;quot;:[{&amp;quot;ranks&amp;quot;:[1,0,2,3], &amp;quot;pid&amp;quot;:1023}],&amp;quot;max_team_size&amp;quot;:1}&lt;br /&gt;
* The objects would be generated inside the spec file lottery_controller_spec.rb using model object initializer;&lt;br /&gt;
&lt;br /&gt;
===Edge cases===&lt;br /&gt;
&lt;br /&gt;
* Case 1: No reviewer submits a list of preferred topics to review&lt;br /&gt;
&lt;br /&gt;
* Case 2: All reviewers submits exactly the same list of topics to review.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113607</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113607"/>
		<updated>2017-11-15T16:03:30Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Manual Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Navin&lt;br /&gt;
&lt;br /&gt;
Sathwick (sgopara@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of M4 reviewers (here M4 represents some constant)&lt;br /&gt;
** Each reviewer is assigned a maximum of M3 papers to review (here M3 represents some constant)&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
   For every topic j : &lt;br /&gt;
      For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
         Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
         B(i) = 1/S(i)&lt;br /&gt;
         Calculate C(i,j)                &lt;br /&gt;
         Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
&lt;br /&gt;
In the algorithm above, the Calculate C(i,j) involves the following:&lt;br /&gt;
&lt;br /&gt;
C(i,j) = 1/N * &amp;amp;sum; [ M1 -S(i) ] &lt;br /&gt;
&lt;br /&gt;
where we do the summation from i = 1 to i = N&lt;br /&gt;
&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
Situation in case of a priority tie: In the case that the algorithm groups all students preferring specific topic together and finds that there are more students in the cluster than the maximum team size M1, it evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of the resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
=Understanding the Flows=&lt;br /&gt;
Essentially, we have to design from scratch. Hence, we first describe the use cases, before going into the design phase.&lt;br /&gt;
&lt;br /&gt;
===Use Case===&lt;br /&gt;
Actors: &lt;br /&gt;
* Conference Reviewer: Submits a preference list of papers and reviews assigned papers&lt;br /&gt;
* Conference Administrator: Responsible for the assignment of topics to the reviewers&lt;br /&gt;
&lt;br /&gt;
Scenario&lt;br /&gt;
&lt;br /&gt;
The case of reviewers submitting a list of preferred topics and the administrator running the assignment process.&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Choose and submit preference to be reviewed====&lt;br /&gt;
 Use Case Id: 1&lt;br /&gt;
 Use Case Description: Participants choose the preference for conference review topics and submit it&lt;br /&gt;
 Actors: Participants&lt;br /&gt;
 Pre Conditions: Conference papers are presented and submitted, and the participants are eligible for reviewing&lt;br /&gt;
 Post Conditions: Conference committee members can view participants preference and run bidding algorithm on it&lt;br /&gt;
&lt;br /&gt;
====Saving bidder information into database====&lt;br /&gt;
 Use Case Id: 2&lt;br /&gt;
 Use Case Description: bidding preferences and related participants information are processed and saved to database&lt;br /&gt;
 Actors: None&lt;br /&gt;
 Triggered by: Use Case 1&lt;br /&gt;
 Pre Conditions: participants preferences are submitted&lt;br /&gt;
 Post Conditions: information can be retrieved and used by bidding algorithm&lt;br /&gt;
====View list of topics====&lt;br /&gt;
 Use Case Id: 3&lt;br /&gt;
 Use Case Description: participants can view list of topic available for conference paper topic&lt;br /&gt;
 Actors: Participants&lt;br /&gt;
====Run bidding process====&lt;br /&gt;
 Use Case Id: 4&lt;br /&gt;
 Use Case Description: Committee members can run bidding algorithm on application to help assigning the conference paper topics to &lt;br /&gt;
 participants&lt;br /&gt;
 Actors: Conference Committee&lt;br /&gt;
 Pre Conditions: preferences must be submitted by participants&lt;br /&gt;
 Post Conditions: the bidding result can be used for paper assignment&lt;br /&gt;
====Choosing and assigning paper to bidders====&lt;br /&gt;
 Use Case Id: 5&lt;br /&gt;
 Use Case Description: System assigns participants to conference paper topics according to bidding result&lt;br /&gt;
 Actors: None&lt;br /&gt;
 Triggered by: Use Case 4&lt;br /&gt;
 Pre Conditions: bidding algorithm has run and result has been returned&lt;br /&gt;
 Post Conditions: Participants can view topics been assigned to them&lt;br /&gt;
====Change assignment of review using CRUD actions====&lt;br /&gt;
 Use Case Id: 6&lt;br /&gt;
 Use Case Description: Conference committee members can change assignment result manually&lt;br /&gt;
 Actors: Conference Committee&lt;br /&gt;
 Pre Conditions: topic assignment has been done&lt;br /&gt;
 Post Conditions: changes on bidding result is visible to participants and other committee members&lt;br /&gt;
&lt;br /&gt;
=== Data Flow Diagram ===&lt;br /&gt;
Below is the Data Flow Diagram for process flows of the project.&lt;br /&gt;
[[File:Webp.net-resizeimage (1).png]]&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
The changes in the first sub section below were prior to the mentor meeting, where we had a major change in our problem statement.&lt;br /&gt;
Earlier, we assumed that we only had to change the existing code, which is reflected above. &lt;br /&gt;
&lt;br /&gt;
However, with the new requirements, in addition we need to add completely new code.&lt;br /&gt;
&lt;br /&gt;
== Changing Existing Files ==&lt;br /&gt;
This sub section details what is to be changed in the existing code.&lt;br /&gt;
=== Files to be changed === &lt;br /&gt;
*lottery_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Current Code ===&lt;br /&gt;
This is current code for bidding assignment. The code will basically get target assignment and then get all topics and teams for the assignment. Then it will assign priority of each team-topic pair according to user preference  for each user, and append it to priority information list. Afterward it sends priority information along with maximum team size information to web-server and rearranging the priority order according to top-trading cycle algorithm, and pass returned result to create_new_teams_for_bidding_response function for bidding handling on topics with preferences and run_intelligent_bid function for bidding handling for leftover assignment as well as cleaning up.&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Proposed Changes ===&lt;br /&gt;
&lt;br /&gt;
To accommodate this code to fit our needs, we have proposed to add 3 new variable&lt;br /&gt;
&lt;br /&gt;
  new_intelligent_property&lt;br /&gt;
  topic_per_team&lt;br /&gt;
  team_per_topic&lt;br /&gt;
&lt;br /&gt;
new_intelligent_property will check if an assignment is using conference paper bidding or team assignment bidding, it will be true if bidding is on conference paper review and false if bidding is on team assignment; topic_per_team will record required number of topics that can be chosen per a team; and team_per_topic will record required number of teams that can be assigned to a topic. &lt;br /&gt;
&lt;br /&gt;
=== Proposed Code ===&lt;br /&gt;
&lt;br /&gt;
Then we will change the run_intelligent_assignment function to implementation as below:&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      if new_intelligent_property&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids }&lt;br /&gt;
      else&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    if !new_intelligent_property&lt;br /&gt;
      data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
      url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
      begin&lt;br /&gt;
        response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
        # store each summary in a hashmap and use the question as the key&lt;br /&gt;
        teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
        create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
        run_intelligent_bid(assignment)&lt;br /&gt;
      rescue =&amp;gt; err&lt;br /&gt;
        flash[:error] = err.message&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      run_conference_bid(teams, assignment, topic_per_team, team_per_topic)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Additional Changes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With this change, we will have to add a new function: run_conference_bid(teams, assignment), with pseudo-code as shown below:&lt;br /&gt;
&lt;br /&gt;
  def run_conference_bid teams, assignment, topic_per_team, team_per_topic&lt;br /&gt;
    set topic_set to false;&lt;br /&gt;
    for each team in teams&lt;br /&gt;
      append the team in team_list&lt;br /&gt;
      retrieve bidding ranks of each team&lt;br /&gt;
      sum all rank values in list&lt;br /&gt;
      for each topic priority/rank value in ranks list&lt;br /&gt;
        if topic_set is false&lt;br /&gt;
           append topic_id to topic_list&lt;br /&gt;
        end if&lt;br /&gt;
        calculate percentage of the rank value in comparison to sum of rank values &lt;br /&gt;
        if sum is 0 &lt;br /&gt;
          change percentage to 1/length_of_rank_list&lt;br /&gt;
        end if&lt;br /&gt;
        score rank value by doing (percent_rank_values *(number_of_topics^2) + (number_of_topics^2) / length_of_rank_list)&lt;br /&gt;
        append [team_id, score] to team_scores dictionary with team_id as key&lt;br /&gt;
      end for&lt;br /&gt;
      set topic_set to true&lt;br /&gt;
    end for&lt;br /&gt;
    sort team_scores dictionary by values/scores in descending order&lt;br /&gt;
    for score in team_scores&lt;br /&gt;
      if team not in team_list or topic not in topic_list&lt;br /&gt;
        remove score&lt;br /&gt;
        continue to next iteration&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id to topic_assignment list&lt;br /&gt;
      if number of occurrences of current topic in topic_assignment is same as topic_per_team&lt;br /&gt;
        remove this topic_id from topic_list&lt;br /&gt;
      end if&lt;br /&gt;
      append team_id to team_assignment list&lt;br /&gt;
      if number of occurrences of current team in team_assignment is same as team_per_topic&lt;br /&gt;
        remove this team_id from team_list&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id and team_id pair to team_bids&lt;br /&gt;
    end for&lt;br /&gt;
    save sign up information stored in team_bids to database&lt;br /&gt;
  end def&lt;br /&gt;
&lt;br /&gt;
=Test Plan=&lt;br /&gt;
&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
1. Log in as a participants/student&lt;br /&gt;
&lt;br /&gt;
2. Go to Assignment&lt;br /&gt;
&lt;br /&gt;
3. Go to Other's works and check preferred conference paper topics to bid on reviewing&lt;br /&gt;
&lt;br /&gt;
4. Click submit and wait for bidding deadline&lt;br /&gt;
&lt;br /&gt;
5. After deadline reaches, go back to assignment and click on Other's work to view topics assigned for reviewing&lt;br /&gt;
&lt;br /&gt;
===Automated Test Cases===&lt;br /&gt;
* TDD and Feature Test cases to be written. For instance we would do Rspec test on cases below:&lt;br /&gt;
** Test on score calculation, see if the calculation gives right scoring distribution when no preference is given, when one preference is given, and when multiple preferences are given;&lt;br /&gt;
** Test on preference levels matching, check if the algorithm is match first, second, third, and so on preferences and evaluating them correctly;&lt;br /&gt;
** Test if teams per topic or topics per team can exceed required number by assigning many team with same first preference and assigning many team with multiple preferences (preference number per team &amp;gt; number of topics/2);&lt;br /&gt;
* For the Rspec tests, we will have to create object of team, assignment, and ranks. A sample team object in JSON format would be:&lt;br /&gt;
  {&amp;quot;users&amp;quot;:[{&amp;quot;ranks&amp;quot;:[1,0,2,3], &amp;quot;pid&amp;quot;:1023}],&amp;quot;max_team_size&amp;quot;:1}&lt;br /&gt;
* The objects would be generated inside the spec file lottery_controller_spec.rb using model object initializer;&lt;br /&gt;
&lt;br /&gt;
===Edge cases===&lt;br /&gt;
&lt;br /&gt;
* Case 1: No reviewer submits a list of preferred topics to review&lt;br /&gt;
&lt;br /&gt;
* Case 2: All reviewers submits exactly the same list of topics to review.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113606</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113606"/>
		<updated>2017-11-15T16:02:07Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Navin&lt;br /&gt;
&lt;br /&gt;
Sathwick (sgopara@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of M4 reviewers (here M4 represents some constant)&lt;br /&gt;
** Each reviewer is assigned a maximum of M3 papers to review (here M3 represents some constant)&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
   For every topic j : &lt;br /&gt;
      For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
         Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
         B(i) = 1/S(i)&lt;br /&gt;
         Calculate C(i,j)                &lt;br /&gt;
         Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
&lt;br /&gt;
In the algorithm above, the Calculate C(i,j) involves the following:&lt;br /&gt;
&lt;br /&gt;
C(i,j) = 1/N * &amp;amp;sum; [ M1 -S(i) ] &lt;br /&gt;
&lt;br /&gt;
where we do the summation from i = 1 to i = N&lt;br /&gt;
&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
Situation in case of a priority tie: In the case that the algorithm groups all students preferring specific topic together and finds that there are more students in the cluster than the maximum team size M1, it evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of the resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
=Understanding the Flows=&lt;br /&gt;
Essentially, we have to design from scratch. Hence, we first describe the use cases, before going into the design phase.&lt;br /&gt;
&lt;br /&gt;
===Use Case===&lt;br /&gt;
Actors: &lt;br /&gt;
* Conference Reviewer: Submits a preference list of papers and reviews assigned papers&lt;br /&gt;
* Conference Administrator: Responsible for the assignment of topics to the reviewers&lt;br /&gt;
&lt;br /&gt;
Scenario&lt;br /&gt;
&lt;br /&gt;
The case of reviewers submitting a list of preferred topics and the administrator running the assignment process.&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Choose and submit preference to be reviewed====&lt;br /&gt;
 Use Case Id: 1&lt;br /&gt;
 Use Case Description: Participants choose the preference for conference review topics and submit it&lt;br /&gt;
 Actors: Participants&lt;br /&gt;
 Pre Conditions: Conference papers are presented and submitted, and the participants are eligible for reviewing&lt;br /&gt;
 Post Conditions: Conference committee members can view participants preference and run bidding algorithm on it&lt;br /&gt;
&lt;br /&gt;
====Saving bidder information into database====&lt;br /&gt;
 Use Case Id: 2&lt;br /&gt;
 Use Case Description: bidding preferences and related participants information are processed and saved to database&lt;br /&gt;
 Actors: None&lt;br /&gt;
 Triggered by: Use Case 1&lt;br /&gt;
 Pre Conditions: participants preferences are submitted&lt;br /&gt;
 Post Conditions: information can be retrieved and used by bidding algorithm&lt;br /&gt;
====View list of topics====&lt;br /&gt;
 Use Case Id: 3&lt;br /&gt;
 Use Case Description: participants can view list of topic available for conference paper topic&lt;br /&gt;
 Actors: Participants&lt;br /&gt;
====Run bidding process====&lt;br /&gt;
 Use Case Id: 4&lt;br /&gt;
 Use Case Description: Committee members can run bidding algorithm on application to help assigning the conference paper topics to &lt;br /&gt;
 participants&lt;br /&gt;
 Actors: Conference Committee&lt;br /&gt;
 Pre Conditions: preferences must be submitted by participants&lt;br /&gt;
 Post Conditions: the bidding result can be used for paper assignment&lt;br /&gt;
====Choosing and assigning paper to bidders====&lt;br /&gt;
 Use Case Id: 5&lt;br /&gt;
 Use Case Description: System assigns participants to conference paper topics according to bidding result&lt;br /&gt;
 Actors: None&lt;br /&gt;
 Triggered by: Use Case 4&lt;br /&gt;
 Pre Conditions: bidding algorithm has run and result has been returned&lt;br /&gt;
 Post Conditions: Participants can view topics been assigned to them&lt;br /&gt;
====Change assignment of review using CRUD actions====&lt;br /&gt;
 Use Case Id: 6&lt;br /&gt;
 Use Case Description: Conference committee members can change assignment result manually&lt;br /&gt;
 Actors: Conference Committee&lt;br /&gt;
 Pre Conditions: topic assignment has been done&lt;br /&gt;
 Post Conditions: changes on bidding result is visible to participants and other committee members&lt;br /&gt;
&lt;br /&gt;
=== Data Flow Diagram ===&lt;br /&gt;
Below is the Data Flow Diagram for process flows of the project.&lt;br /&gt;
[[File:Webp.net-resizeimage (1).png]]&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
The changes in the first sub section below were prior to the mentor meeting, where we had a major change in our problem statement.&lt;br /&gt;
Earlier, we assumed that we only had to change the existing code, which is reflected above. &lt;br /&gt;
&lt;br /&gt;
However, with the new requirements, in addition we need to add completely new code.&lt;br /&gt;
&lt;br /&gt;
== Changing Existing Files ==&lt;br /&gt;
This sub section details what is to be changed in the existing code.&lt;br /&gt;
=== Files to be changed === &lt;br /&gt;
*lottery_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Current Code ===&lt;br /&gt;
This is current code for bidding assignment. The code will basically get target assignment and then get all topics and teams for the assignment. Then it will assign priority of each team-topic pair according to user preference  for each user, and append it to priority information list. Afterward it sends priority information along with maximum team size information to web-server and rearranging the priority order according to top-trading cycle algorithm, and pass returned result to create_new_teams_for_bidding_response function for bidding handling on topics with preferences and run_intelligent_bid function for bidding handling for leftover assignment as well as cleaning up.&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Proposed Changes ===&lt;br /&gt;
&lt;br /&gt;
To accommodate this code to fit our needs, we have proposed to add 3 new variable&lt;br /&gt;
&lt;br /&gt;
  new_intelligent_property&lt;br /&gt;
  topic_per_team&lt;br /&gt;
  team_per_topic&lt;br /&gt;
&lt;br /&gt;
new_intelligent_property will check if an assignment is using conference paper bidding or team assignment bidding, it will be true if bidding is on conference paper review and false if bidding is on team assignment; topic_per_team will record required number of topics that can be chosen per a team; and team_per_topic will record required number of teams that can be assigned to a topic. &lt;br /&gt;
&lt;br /&gt;
=== Proposed Code ===&lt;br /&gt;
&lt;br /&gt;
Then we will change the run_intelligent_assignment function to implementation as below:&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      if new_intelligent_property&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids }&lt;br /&gt;
      else&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    if !new_intelligent_property&lt;br /&gt;
      data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
      url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
      begin&lt;br /&gt;
        response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
        # store each summary in a hashmap and use the question as the key&lt;br /&gt;
        teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
        create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
        run_intelligent_bid(assignment)&lt;br /&gt;
      rescue =&amp;gt; err&lt;br /&gt;
        flash[:error] = err.message&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      run_conference_bid(teams, assignment, topic_per_team, team_per_topic)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Additional Changes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With this change, we will have to add a new function: run_conference_bid(teams, assignment), with pseudo-code as shown below:&lt;br /&gt;
&lt;br /&gt;
  def run_conference_bid teams, assignment, topic_per_team, team_per_topic&lt;br /&gt;
    set topic_set to false;&lt;br /&gt;
    for each team in teams&lt;br /&gt;
      append the team in team_list&lt;br /&gt;
      retrieve bidding ranks of each team&lt;br /&gt;
      sum all rank values in list&lt;br /&gt;
      for each topic priority/rank value in ranks list&lt;br /&gt;
        if topic_set is false&lt;br /&gt;
           append topic_id to topic_list&lt;br /&gt;
        end if&lt;br /&gt;
        calculate percentage of the rank value in comparison to sum of rank values &lt;br /&gt;
        if sum is 0 &lt;br /&gt;
          change percentage to 1/length_of_rank_list&lt;br /&gt;
        end if&lt;br /&gt;
        score rank value by doing (percent_rank_values *(number_of_topics^2) + (number_of_topics^2) / length_of_rank_list)&lt;br /&gt;
        append [team_id, score] to team_scores dictionary with team_id as key&lt;br /&gt;
      end for&lt;br /&gt;
      set topic_set to true&lt;br /&gt;
    end for&lt;br /&gt;
    sort team_scores dictionary by values/scores in descending order&lt;br /&gt;
    for score in team_scores&lt;br /&gt;
      if team not in team_list or topic not in topic_list&lt;br /&gt;
        remove score&lt;br /&gt;
        continue to next iteration&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id to topic_assignment list&lt;br /&gt;
      if number of occurrences of current topic in topic_assignment is same as topic_per_team&lt;br /&gt;
        remove this topic_id from topic_list&lt;br /&gt;
      end if&lt;br /&gt;
      append team_id to team_assignment list&lt;br /&gt;
      if number of occurrences of current team in team_assignment is same as team_per_topic&lt;br /&gt;
        remove this team_id from team_list&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id and team_id pair to team_bids&lt;br /&gt;
    end for&lt;br /&gt;
    save sign up information stored in team_bids to database&lt;br /&gt;
  end def&lt;br /&gt;
&lt;br /&gt;
=Test Plan=&lt;br /&gt;
&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
====1. Log in as a participants/student====&lt;br /&gt;
====2. Go to Assignment====&lt;br /&gt;
====3. Go to Other's works and check preferred conference paper topics to bid on reviewing====&lt;br /&gt;
====4. Click submit and wait for bidding deadline====&lt;br /&gt;
====5. After deadline reaches, go back to assignment and click on Other's work to view topics assigned for reviewing====&lt;br /&gt;
&lt;br /&gt;
===Automated Test Cases===&lt;br /&gt;
* TDD and Feature Test cases to be written. For instance we would do Rspec test on cases below:&lt;br /&gt;
** Test on score calculation, see if the calculation gives right scoring distribution when no preference is given, when one preference is given, and when multiple preferences are given;&lt;br /&gt;
** Test on preference levels matching, check if the algorithm is match first, second, third, and so on preferences and evaluating them correctly;&lt;br /&gt;
** Test if teams per topic or topics per team can exceed required number by assigning many team with same first preference and assigning many team with multiple preferences (preference number per team &amp;gt; number of topics/2);&lt;br /&gt;
* For the Rspec tests, we will have to create object of team, assignment, and ranks. A sample team object in JSON format would be:&lt;br /&gt;
  {&amp;quot;users&amp;quot;:[{&amp;quot;ranks&amp;quot;:[1,0,2,3], &amp;quot;pid&amp;quot;:1023}],&amp;quot;max_team_size&amp;quot;:1}&lt;br /&gt;
* The objects would be generated inside the spec file lottery_controller_spec.rb using model object initializer;&lt;br /&gt;
&lt;br /&gt;
===Edge cases===&lt;br /&gt;
&lt;br /&gt;
* Case 1: No reviewer submits a list of preferred topics to review&lt;br /&gt;
&lt;br /&gt;
* Case 2: All reviewers submits exactly the same list of topics to review.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113605</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113605"/>
		<updated>2017-11-15T16:01:13Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Navin&lt;br /&gt;
&lt;br /&gt;
Sathwick (sgopara@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of M4 reviewers (here M4 represents some constant)&lt;br /&gt;
** Each reviewer is assigned a maximum of M3 papers to review (here M3 represents some constant)&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
   For every topic j : &lt;br /&gt;
      For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
         Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
         B(i) = 1/S(i)&lt;br /&gt;
         Calculate C(i,j)                &lt;br /&gt;
         Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
&lt;br /&gt;
In the algorithm above, the Calculate C(i,j) involves the following:&lt;br /&gt;
&lt;br /&gt;
C(i,j) = 1/N * &amp;amp;sum; [ M1 -S(i) ] &lt;br /&gt;
&lt;br /&gt;
where we do the summation from i = 1 to i = N&lt;br /&gt;
&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
Situation in case of a priority tie: In the case that the algorithm groups all students preferring specific topic together and finds that there are more students in the cluster than the maximum team size M1, it evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of the resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
=Understanding the Flows=&lt;br /&gt;
Essentially, we have to design from scratch. Hence, we first describe the use cases, before going into the design phase.&lt;br /&gt;
&lt;br /&gt;
===Use Case===&lt;br /&gt;
Actors: &lt;br /&gt;
* Conference Reviewer: Submits a preference list of papers and reviews assigned papers&lt;br /&gt;
* Conference Administrator: Responsible for the assignment of topics to the reviewers&lt;br /&gt;
&lt;br /&gt;
Scenario&lt;br /&gt;
&lt;br /&gt;
The case of reviewers submitting a list of preferred topics and the administrator running the assignment process.&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Choose and submit preference to be reviewed====&lt;br /&gt;
 Use Case Id: 1&lt;br /&gt;
 Use Case Description: Participants choose the preference for conference review topics and submit it&lt;br /&gt;
 Actors: Participants&lt;br /&gt;
 Pre Conditions: Conference papers are presented and submitted, and the participants are eligible for reviewing&lt;br /&gt;
 Post Conditions: Conference committee members can view participants preference and run bidding algorithm on it&lt;br /&gt;
&lt;br /&gt;
====Saving bidder information into database====&lt;br /&gt;
 Use Case Id: 2&lt;br /&gt;
 Use Case Description: bidding preferences and related participants information are processed and saved to database&lt;br /&gt;
 Actors: None&lt;br /&gt;
 Triggered by: Use Case 1&lt;br /&gt;
 Pre Conditions: participants preferences are submitted&lt;br /&gt;
 Post Conditions: information can be retrieved and used by bidding algorithm&lt;br /&gt;
====View list of topics====&lt;br /&gt;
 Use Case Id: 3&lt;br /&gt;
 Use Case Description: participants can view list of topic available for conference paper topic&lt;br /&gt;
 Actors: Participants&lt;br /&gt;
====Run bidding process====&lt;br /&gt;
 Use Case Id: 4&lt;br /&gt;
 Use Case Description: Committee members can run bidding algorithm on application to help assigning the conference paper topics to &lt;br /&gt;
 participants&lt;br /&gt;
 Actors: Conference Committee&lt;br /&gt;
 Pre Conditions: preferences must be submitted by participants&lt;br /&gt;
 Post Conditions: the bidding result can be used for paper assignment&lt;br /&gt;
====Choosing and assigning paper to bidders====&lt;br /&gt;
 Use Case Id: 5&lt;br /&gt;
 Use Case Description: System assigns participants to conference paper topics according to bidding result&lt;br /&gt;
 Actors: None&lt;br /&gt;
 Triggered by: Use Case 4&lt;br /&gt;
 Pre Conditions: bidding algorithm has run and result has been returned&lt;br /&gt;
 Post Conditions: Participants can view topics been assigned to them&lt;br /&gt;
====Change assignment of review using CRUD actions====&lt;br /&gt;
 Use Case Id: 6&lt;br /&gt;
 Use Case Description: Conference committee members can change assignment result manually&lt;br /&gt;
 Actors: Conference Committee&lt;br /&gt;
 Pre Conditions: topic assignment has been done&lt;br /&gt;
 Post Conditions: changes on bidding result is visible to participants and other committee members&lt;br /&gt;
&lt;br /&gt;
=== Data Flow Diagram ===&lt;br /&gt;
Below is the Data Flow Diagram for process flows of the project.&lt;br /&gt;
[[File:Webp.net-resizeimage (1).png]]&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
The changes in the first sub section below were prior to the mentor meeting, where we had a major change in our problem statement.&lt;br /&gt;
Earlier, we assumed that we only had to change the existing code, which is reflected above. &lt;br /&gt;
&lt;br /&gt;
However, with the new requirements, in addition we need to add completely new code.&lt;br /&gt;
&lt;br /&gt;
== Changing Existing Files ==&lt;br /&gt;
This sub section details what is to be changed in the existing code.&lt;br /&gt;
=== Files to be changed === &lt;br /&gt;
*lottery_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Current Code ===&lt;br /&gt;
This is current code for bidding assignment. The code will basically get target assignment and then get all topics and teams for the assignment. Then it will assign priority of each team-topic pair according to user preference  for each user, and append it to priority information list. Afterward it sends priority information along with maximum team size information to web-server and rearranging the priority order according to top-trading cycle algorithm, and pass returned result to create_new_teams_for_bidding_response function for bidding handling on topics with preferences and run_intelligent_bid function for bidding handling for leftover assignment as well as cleaning up.&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Proposed Changes ===&lt;br /&gt;
&lt;br /&gt;
To accommodate this code to fit our needs, we have proposed to add 3 new variable&lt;br /&gt;
&lt;br /&gt;
  new_intelligent_property&lt;br /&gt;
  topic_per_team&lt;br /&gt;
  team_per_topic&lt;br /&gt;
&lt;br /&gt;
new_intelligent_property will check if an assignment is using conference paper bidding or team assignment bidding, it will be true if bidding is on conference paper review and false if bidding is on team assignment; topic_per_team will record required number of topics that can be chosen per a team; and team_per_topic will record required number of teams that can be assigned to a topic. &lt;br /&gt;
&lt;br /&gt;
=== Proposed Code ===&lt;br /&gt;
&lt;br /&gt;
Then we will change the run_intelligent_assignment function to implementation as below:&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      if new_intelligent_property&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids }&lt;br /&gt;
      else&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    if !new_intelligent_property&lt;br /&gt;
      data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
      url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
      begin&lt;br /&gt;
        response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
        # store each summary in a hashmap and use the question as the key&lt;br /&gt;
        teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
        create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
        run_intelligent_bid(assignment)&lt;br /&gt;
      rescue =&amp;gt; err&lt;br /&gt;
        flash[:error] = err.message&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      run_conference_bid(teams, assignment, topic_per_team, team_per_topic)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Additional Changes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With this change, we will have to add a new function: run_conference_bid(teams, assignment), with pseudo-code as shown below:&lt;br /&gt;
&lt;br /&gt;
  def run_conference_bid teams, assignment, topic_per_team, team_per_topic&lt;br /&gt;
    set topic_set to false;&lt;br /&gt;
    for each team in teams&lt;br /&gt;
      append the team in team_list&lt;br /&gt;
      retrieve bidding ranks of each team&lt;br /&gt;
      sum all rank values in list&lt;br /&gt;
      for each topic priority/rank value in ranks list&lt;br /&gt;
        if topic_set is false&lt;br /&gt;
           append topic_id to topic_list&lt;br /&gt;
        end if&lt;br /&gt;
        calculate percentage of the rank value in comparison to sum of rank values &lt;br /&gt;
        if sum is 0 &lt;br /&gt;
          change percentage to 1/length_of_rank_list&lt;br /&gt;
        end if&lt;br /&gt;
        score rank value by doing (percent_rank_values *(number_of_topics^2) + (number_of_topics^2) / length_of_rank_list)&lt;br /&gt;
        append [team_id, score] to team_scores dictionary with team_id as key&lt;br /&gt;
      end for&lt;br /&gt;
      set topic_set to true&lt;br /&gt;
    end for&lt;br /&gt;
    sort team_scores dictionary by values/scores in descending order&lt;br /&gt;
    for score in team_scores&lt;br /&gt;
      if team not in team_list or topic not in topic_list&lt;br /&gt;
        remove score&lt;br /&gt;
        continue to next iteration&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id to topic_assignment list&lt;br /&gt;
      if number of occurrences of current topic in topic_assignment is same as topic_per_team&lt;br /&gt;
        remove this topic_id from topic_list&lt;br /&gt;
      end if&lt;br /&gt;
      append team_id to team_assignment list&lt;br /&gt;
      if number of occurrences of current team in team_assignment is same as team_per_topic&lt;br /&gt;
        remove this team_id from team_list&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id and team_id pair to team_bids&lt;br /&gt;
    end for&lt;br /&gt;
    save sign up information stored in team_bids to database&lt;br /&gt;
  end def&lt;br /&gt;
&lt;br /&gt;
=Test Plan=&lt;br /&gt;
&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
1. Log in as a participants/student&lt;br /&gt;
2. Go to Assignment &lt;br /&gt;
3. Go to Other's works and check preferred conference paper topics to bid on reviewing&lt;br /&gt;
4. Click submit and wait for bidding deadline&lt;br /&gt;
5. After deadline reaches, go back to assignment and click on Other's work to view topics assigned for reviewing&lt;br /&gt;
&lt;br /&gt;
===Automated Test Cases===&lt;br /&gt;
* TDD and Feature Test cases to be written. For instance we would do Rspec test on cases below:&lt;br /&gt;
** Test on score calculation, see if the calculation gives right scoring distribution when no preference is given, when one preference is given, and when multiple preferences are given;&lt;br /&gt;
** Test on preference levels matching, check if the algorithm is match first, second, third, and so on preferences and evaluating them correctly;&lt;br /&gt;
** Test if teams per topic or topics per team can exceed required number by assigning many team with same first preference and assigning many team with multiple preferences (preference number per team &amp;gt; number of topics/2);&lt;br /&gt;
* For the Rspec tests, we will have to create object of team, assignment, and ranks. A sample team object in JSON format would be:&lt;br /&gt;
  {&amp;quot;users&amp;quot;:[{&amp;quot;ranks&amp;quot;:[1,0,2,3], &amp;quot;pid&amp;quot;:1023}],&amp;quot;max_team_size&amp;quot;:1}&lt;br /&gt;
* The objects would be generated inside the spec file lottery_controller_spec.rb using model object initializer;&lt;br /&gt;
&lt;br /&gt;
===Edge cases===&lt;br /&gt;
&lt;br /&gt;
* Case 1: No reviewer submits a list of preferred topics to review&lt;br /&gt;
&lt;br /&gt;
* Case 2: All reviewers submits exactly the same list of topics to review.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113604</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113604"/>
		<updated>2017-11-15T15:49:37Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Use Case */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Navin&lt;br /&gt;
&lt;br /&gt;
Sathwick (sgopara@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of M4 reviewers (here M4 represents some constant)&lt;br /&gt;
** Each reviewer is assigned a maximum of M3 papers to review (here M3 represents some constant)&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
   For every topic j : &lt;br /&gt;
      For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
         Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
         B(i) = 1/S(i)&lt;br /&gt;
         Calculate C(i,j)                &lt;br /&gt;
         Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
&lt;br /&gt;
In the algorithm above, the Calculate C(i,j) involves the following:&lt;br /&gt;
&lt;br /&gt;
C(i,j) = 1/N * &amp;amp;sum; [ M1 -S(i) ] &lt;br /&gt;
&lt;br /&gt;
where we do the summation from i = 1 to i = N&lt;br /&gt;
&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
Situation in case of a priority tie: In the case that the algorithm groups all students preferring specific topic together and finds that there are more students in the cluster than the maximum team size M1, it evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of the resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
=Understanding the Flows=&lt;br /&gt;
Essentially, we have to design from scratch. Hence, we first describe the use cases, before going into the design phase.&lt;br /&gt;
&lt;br /&gt;
===Use Case===&lt;br /&gt;
Actors: &lt;br /&gt;
* Conference Reviewer: Submits a preference list of papers and reviews assigned papers&lt;br /&gt;
* Conference Administrator: Responsible for the assignment of topics to the reviewers&lt;br /&gt;
&lt;br /&gt;
Scenario&lt;br /&gt;
&lt;br /&gt;
The case of reviewers submitting a list of preferred topics and the administrator running the assignment process.&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Choose and submit preference to be reviewed====&lt;br /&gt;
 Use Case Id: 1&lt;br /&gt;
 Use Case Description: Participants choose the preference for conference review topics and submit it&lt;br /&gt;
 Actors: Participants&lt;br /&gt;
 Pre Conditions: Conference papers are presented and submitted, and the participants are eligible for reviewing&lt;br /&gt;
 Post Conditions: Conference committee members can view participants preference and run bidding algorithm on it&lt;br /&gt;
&lt;br /&gt;
====Saving bidder information into database====&lt;br /&gt;
 Use Case Id: 2&lt;br /&gt;
 Use Case Description: bidding preferences and related participants information are processed and saved to database&lt;br /&gt;
 Actors: None&lt;br /&gt;
 Triggered by: Use Case 1&lt;br /&gt;
 Pre Conditions: participants preferences are submitted&lt;br /&gt;
 Post Conditions: information can be retrieved and used by bidding algorithm&lt;br /&gt;
====View list of topics====&lt;br /&gt;
 Use Case Id: 3&lt;br /&gt;
 Use Case Description: participants can view list of topic available for conference paper topic&lt;br /&gt;
 Actors: Participants&lt;br /&gt;
====Run bidding process====&lt;br /&gt;
 Use Case Id: 4&lt;br /&gt;
 Use Case Description: Committee members can run bidding algorithm on application to help assigning the conference paper topics to &lt;br /&gt;
 participants&lt;br /&gt;
 Actors: Conference Committee&lt;br /&gt;
 Pre Conditions: preferences must be submitted by participants&lt;br /&gt;
 Post Conditions: the bidding result can be used for paper assignment&lt;br /&gt;
====Choosing and assigning paper to bidders====&lt;br /&gt;
 Use Case Id: 5&lt;br /&gt;
 Use Case Description: System assigns participants to conference paper topics according to bidding result&lt;br /&gt;
 Actors: None&lt;br /&gt;
 Triggered by: Use Case 4&lt;br /&gt;
 Pre Conditions: bidding algorithm has run and result has been returned&lt;br /&gt;
 Post Conditions: Participants can view topics been assigned to them&lt;br /&gt;
====Change assignment of review using CRUD actions====&lt;br /&gt;
 Use Case Id: 6&lt;br /&gt;
 Use Case Description: Conference committee members can change assignment result manually&lt;br /&gt;
 Actors: Conference Committee&lt;br /&gt;
 Pre Conditions: topic assignment has been done&lt;br /&gt;
 Post Conditions: changes on bidding result is visible to participants and other committee members&lt;br /&gt;
&lt;br /&gt;
=== Data Flow Diagram ===&lt;br /&gt;
Below is the Data Flow Diagram for process flows of the project.&lt;br /&gt;
[[File:Webp.net-resizeimage (1).png]]&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
The changes in the first sub section below were prior to the mentor meeting, where we had a major change in our problem statement.&lt;br /&gt;
Earlier, we assumed that we only had to change the existing code, which is reflected above. &lt;br /&gt;
&lt;br /&gt;
However, with the new requirements, in addition we need to add completely new code.&lt;br /&gt;
&lt;br /&gt;
== Changing Existing Files ==&lt;br /&gt;
This sub section details what is to be changed in the existing code.&lt;br /&gt;
=== Files to be changed === &lt;br /&gt;
*lottery_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Current Code ===&lt;br /&gt;
This is current code for bidding assignment. The code will basically get target assignment and then get all topics and teams for the assignment. Then it will assign priority of each team-topic pair according to user preference  for each user, and append it to priority information list. Afterward it sends priority information along with maximum team size information to web-server and rearranging the priority order according to top-trading cycle algorithm, and pass returned result to create_new_teams_for_bidding_response function for bidding handling on topics with preferences and run_intelligent_bid function for bidding handling for leftover assignment as well as cleaning up.&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Proposed Changes ===&lt;br /&gt;
&lt;br /&gt;
To accommodate this code to fit our needs, we have proposed to add 3 new variable&lt;br /&gt;
&lt;br /&gt;
  new_intelligent_property&lt;br /&gt;
  topic_per_team&lt;br /&gt;
  team_per_topic&lt;br /&gt;
&lt;br /&gt;
new_intelligent_property will check if an assignment is using conference paper bidding or team assignment bidding, it will be true if bidding is on conference paper review and false if bidding is on team assignment; topic_per_team will record required number of topics that can be chosen per a team; and team_per_topic will record required number of teams that can be assigned to a topic. &lt;br /&gt;
&lt;br /&gt;
=== Proposed Code ===&lt;br /&gt;
&lt;br /&gt;
Then we will change the run_intelligent_assignment function to implementation as below:&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      if new_intelligent_property&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids }&lt;br /&gt;
      else&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    if !new_intelligent_property&lt;br /&gt;
      data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
      url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
      begin&lt;br /&gt;
        response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
        # store each summary in a hashmap and use the question as the key&lt;br /&gt;
        teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
        create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
        run_intelligent_bid(assignment)&lt;br /&gt;
      rescue =&amp;gt; err&lt;br /&gt;
        flash[:error] = err.message&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      run_conference_bid(teams, assignment, topic_per_team, team_per_topic)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Additional Changes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With this change, we will have to add a new function: run_conference_bid(teams, assignment), with pseudo-code as shown below:&lt;br /&gt;
&lt;br /&gt;
  def run_conference_bid teams, assignment, topic_per_team, team_per_topic&lt;br /&gt;
    set topic_set to false;&lt;br /&gt;
    for each team in teams&lt;br /&gt;
      append the team in team_list&lt;br /&gt;
      retrieve bidding ranks of each team&lt;br /&gt;
      sum all rank values in list&lt;br /&gt;
      for each topic priority/rank value in ranks list&lt;br /&gt;
        if topic_set is false&lt;br /&gt;
           append topic_id to topic_list&lt;br /&gt;
        end if&lt;br /&gt;
        calculate percentage of the rank value in comparison to sum of rank values &lt;br /&gt;
        if sum is 0 &lt;br /&gt;
          change percentage to 1/length_of_rank_list&lt;br /&gt;
        end if&lt;br /&gt;
        score rank value by doing (percent_rank_values *(number_of_topics^2) + (number_of_topics^2) / length_of_rank_list)&lt;br /&gt;
        append [team_id, score] to team_scores dictionary with team_id as key&lt;br /&gt;
      end for&lt;br /&gt;
      set topic_set to true&lt;br /&gt;
    end for&lt;br /&gt;
    sort team_scores dictionary by values/scores in descending order&lt;br /&gt;
    for score in team_scores&lt;br /&gt;
      if team not in team_list or topic not in topic_list&lt;br /&gt;
        remove score&lt;br /&gt;
        continue to next iteration&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id to topic_assignment list&lt;br /&gt;
      if number of occurrences of current topic in topic_assignment is same as topic_per_team&lt;br /&gt;
        remove this topic_id from topic_list&lt;br /&gt;
      end if&lt;br /&gt;
      append team_id to team_assignment list&lt;br /&gt;
      if number of occurrences of current team in team_assignment is same as team_per_topic&lt;br /&gt;
        remove this team_id from team_list&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id and team_id pair to team_bids&lt;br /&gt;
    end for&lt;br /&gt;
    save sign up information stored in team_bids to database&lt;br /&gt;
  end def&lt;br /&gt;
&lt;br /&gt;
=Test Plan=&lt;br /&gt;
&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
===Automated Test Cases===&lt;br /&gt;
* TDD and Feature Test cases to be written. For instance we would do Rspec test on cases below:&lt;br /&gt;
** Test on score calculation, see if the calculation gives right scoring distribution when no preference is given, when one preference is given, and when multiple preferences are given;&lt;br /&gt;
** Test on preference levels matching, check if the algorithm is match first, second, third, and so on preferences and evaluating them correctly;&lt;br /&gt;
** Test if teams per topic or topics per team can exceed required number by assigning many team with same first preference and assigning many team with multiple preferences (preference number per team &amp;gt; number of topics/2);&lt;br /&gt;
* For the Rspec tests, we will have to create object of team, assignment, and ranks. A sample team object in JSON format would be:&lt;br /&gt;
  {&amp;quot;users&amp;quot;:[{&amp;quot;ranks&amp;quot;:[1,0,2,3], &amp;quot;pid&amp;quot;:1023}],&amp;quot;max_team_size&amp;quot;:1}&lt;br /&gt;
* The objects would be generated inside the spec file lottery_controller_spec.rb using model object initializer;&lt;br /&gt;
&lt;br /&gt;
===Edge cases===&lt;br /&gt;
&lt;br /&gt;
* Case 1: No reviewer submits a list of preferred topics to review&lt;br /&gt;
&lt;br /&gt;
* Case 2: All reviewers submits exactly the same list of topics to review.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113603</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113603"/>
		<updated>2017-11-15T15:48:30Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Choose and submit preference to be reviewed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Navin&lt;br /&gt;
&lt;br /&gt;
Sathwick (sgopara@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of M4 reviewers (here M4 represents some constant)&lt;br /&gt;
** Each reviewer is assigned a maximum of M3 papers to review (here M3 represents some constant)&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
   For every topic j : &lt;br /&gt;
      For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
         Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
         B(i) = 1/S(i)&lt;br /&gt;
         Calculate C(i,j)                &lt;br /&gt;
         Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
&lt;br /&gt;
In the algorithm above, the Calculate C(i,j) involves the following:&lt;br /&gt;
&lt;br /&gt;
C(i,j) = 1/N * &amp;amp;sum; [ M1 -S(i) ] &lt;br /&gt;
&lt;br /&gt;
where we do the summation from i = 1 to i = N&lt;br /&gt;
&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
Situation in case of a priority tie: In the case that the algorithm groups all students preferring specific topic together and finds that there are more students in the cluster than the maximum team size M1, it evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of the resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
=Understanding the Flows=&lt;br /&gt;
Essentially, we have to design from scratch. Hence, we first describe the use cases, before going into the design phase.&lt;br /&gt;
&lt;br /&gt;
===Use Case===&lt;br /&gt;
Actors: &lt;br /&gt;
* Conference Reviewer: Submits a preference list of papers and reviews assigned papers&lt;br /&gt;
* Conference Administrator: Responsible for the assignment of topics to the reviewers&lt;br /&gt;
&lt;br /&gt;
Scenario&lt;br /&gt;
&lt;br /&gt;
The case of reviewers submitting a list of preferred topics and the administrator running the assignment process.&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Choose and submit preference to be reviewed====&lt;br /&gt;
 Use Case Id: 1&lt;br /&gt;
 Use Case Description: Participants choose the preference for conference review topics and submit it&lt;br /&gt;
 Actors: Participants&lt;br /&gt;
 Pre Conditions: Conference papers are presented and submitted, and the participants are eligible for reviewing&lt;br /&gt;
 Post Conditions: Conference committee members can view participants preference and run bidding algorithm on it&lt;br /&gt;
&lt;br /&gt;
====Saving bidder information into database====&lt;br /&gt;
Use Case Id: 2&lt;br /&gt;
Use Case Description: bidding preferences and related participants information are processed and saved to database&lt;br /&gt;
Actors: None&lt;br /&gt;
Triggered by: Use Case 1&lt;br /&gt;
Pre Conditions: participants preferences are submitted&lt;br /&gt;
Post Conditions: information can be retrieved and used by bidding algorithm&lt;br /&gt;
====View list of topics====&lt;br /&gt;
Use Case Id: 3&lt;br /&gt;
Use Case Description: participants can view list of topic available for conference paper topic&lt;br /&gt;
Actors: Participants&lt;br /&gt;
====Run bidding process====&lt;br /&gt;
Use Case Id: 4&lt;br /&gt;
Use Case Description: Committee members can run bidding algorithm on application to help assigning the conference paper topics to participants&lt;br /&gt;
Actors: Conference Committee&lt;br /&gt;
Pre Conditions: preferences must be submitted by participants&lt;br /&gt;
Post Conditions: the bidding result can be used for paper assignment&lt;br /&gt;
====Choosing and assigning paper to bidders====&lt;br /&gt;
Use Case Id: 5&lt;br /&gt;
Use Case Description: System assigns participants to conference paper topics according to bidding result&lt;br /&gt;
Actors: None&lt;br /&gt;
Triggered by: Use Case 4&lt;br /&gt;
Pre Conditions: bidding algorithm has run and result has been returned&lt;br /&gt;
Post Conditions: Participants can view topics been assigned to them&lt;br /&gt;
====Change assignment of review using CRUD actions====&lt;br /&gt;
Use Case Id: 6&lt;br /&gt;
Use Case Description: Conference committee members can change assignment result manually&lt;br /&gt;
Actors: Conference Committee&lt;br /&gt;
Pre Conditions: topic assignment has been done&lt;br /&gt;
Post Conditions: changes on bidding result is visible to participants and other committee members&lt;br /&gt;
&lt;br /&gt;
=== Data Flow Diagram ===&lt;br /&gt;
Below is the Data Flow Diagram for process flows of the project.&lt;br /&gt;
[[File:Webp.net-resizeimage (1).png]]&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
The changes in the first sub section below were prior to the mentor meeting, where we had a major change in our problem statement.&lt;br /&gt;
Earlier, we assumed that we only had to change the existing code, which is reflected above. &lt;br /&gt;
&lt;br /&gt;
However, with the new requirements, in addition we need to add completely new code.&lt;br /&gt;
&lt;br /&gt;
== Changing Existing Files ==&lt;br /&gt;
This sub section details what is to be changed in the existing code.&lt;br /&gt;
=== Files to be changed === &lt;br /&gt;
*lottery_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Current Code ===&lt;br /&gt;
This is current code for bidding assignment. The code will basically get target assignment and then get all topics and teams for the assignment. Then it will assign priority of each team-topic pair according to user preference  for each user, and append it to priority information list. Afterward it sends priority information along with maximum team size information to web-server and rearranging the priority order according to top-trading cycle algorithm, and pass returned result to create_new_teams_for_bidding_response function for bidding handling on topics with preferences and run_intelligent_bid function for bidding handling for leftover assignment as well as cleaning up.&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Proposed Changes ===&lt;br /&gt;
&lt;br /&gt;
To accommodate this code to fit our needs, we have proposed to add 3 new variable&lt;br /&gt;
&lt;br /&gt;
  new_intelligent_property&lt;br /&gt;
  topic_per_team&lt;br /&gt;
  team_per_topic&lt;br /&gt;
&lt;br /&gt;
new_intelligent_property will check if an assignment is using conference paper bidding or team assignment bidding, it will be true if bidding is on conference paper review and false if bidding is on team assignment; topic_per_team will record required number of topics that can be chosen per a team; and team_per_topic will record required number of teams that can be assigned to a topic. &lt;br /&gt;
&lt;br /&gt;
=== Proposed Code ===&lt;br /&gt;
&lt;br /&gt;
Then we will change the run_intelligent_assignment function to implementation as below:&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      if new_intelligent_property&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids }&lt;br /&gt;
      else&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    if !new_intelligent_property&lt;br /&gt;
      data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
      url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
      begin&lt;br /&gt;
        response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
        # store each summary in a hashmap and use the question as the key&lt;br /&gt;
        teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
        create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
        run_intelligent_bid(assignment)&lt;br /&gt;
      rescue =&amp;gt; err&lt;br /&gt;
        flash[:error] = err.message&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      run_conference_bid(teams, assignment, topic_per_team, team_per_topic)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Additional Changes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With this change, we will have to add a new function: run_conference_bid(teams, assignment), with pseudo-code as shown below:&lt;br /&gt;
&lt;br /&gt;
  def run_conference_bid teams, assignment, topic_per_team, team_per_topic&lt;br /&gt;
    set topic_set to false;&lt;br /&gt;
    for each team in teams&lt;br /&gt;
      append the team in team_list&lt;br /&gt;
      retrieve bidding ranks of each team&lt;br /&gt;
      sum all rank values in list&lt;br /&gt;
      for each topic priority/rank value in ranks list&lt;br /&gt;
        if topic_set is false&lt;br /&gt;
           append topic_id to topic_list&lt;br /&gt;
        end if&lt;br /&gt;
        calculate percentage of the rank value in comparison to sum of rank values &lt;br /&gt;
        if sum is 0 &lt;br /&gt;
          change percentage to 1/length_of_rank_list&lt;br /&gt;
        end if&lt;br /&gt;
        score rank value by doing (percent_rank_values *(number_of_topics^2) + (number_of_topics^2) / length_of_rank_list)&lt;br /&gt;
        append [team_id, score] to team_scores dictionary with team_id as key&lt;br /&gt;
      end for&lt;br /&gt;
      set topic_set to true&lt;br /&gt;
    end for&lt;br /&gt;
    sort team_scores dictionary by values/scores in descending order&lt;br /&gt;
    for score in team_scores&lt;br /&gt;
      if team not in team_list or topic not in topic_list&lt;br /&gt;
        remove score&lt;br /&gt;
        continue to next iteration&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id to topic_assignment list&lt;br /&gt;
      if number of occurrences of current topic in topic_assignment is same as topic_per_team&lt;br /&gt;
        remove this topic_id from topic_list&lt;br /&gt;
      end if&lt;br /&gt;
      append team_id to team_assignment list&lt;br /&gt;
      if number of occurrences of current team in team_assignment is same as team_per_topic&lt;br /&gt;
        remove this team_id from team_list&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id and team_id pair to team_bids&lt;br /&gt;
    end for&lt;br /&gt;
    save sign up information stored in team_bids to database&lt;br /&gt;
  end def&lt;br /&gt;
&lt;br /&gt;
=Test Plan=&lt;br /&gt;
&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
===Automated Test Cases===&lt;br /&gt;
* TDD and Feature Test cases to be written. For instance we would do Rspec test on cases below:&lt;br /&gt;
** Test on score calculation, see if the calculation gives right scoring distribution when no preference is given, when one preference is given, and when multiple preferences are given;&lt;br /&gt;
** Test on preference levels matching, check if the algorithm is match first, second, third, and so on preferences and evaluating them correctly;&lt;br /&gt;
** Test if teams per topic or topics per team can exceed required number by assigning many team with same first preference and assigning many team with multiple preferences (preference number per team &amp;gt; number of topics/2);&lt;br /&gt;
* For the Rspec tests, we will have to create object of team, assignment, and ranks. A sample team object in JSON format would be:&lt;br /&gt;
  {&amp;quot;users&amp;quot;:[{&amp;quot;ranks&amp;quot;:[1,0,2,3], &amp;quot;pid&amp;quot;:1023}],&amp;quot;max_team_size&amp;quot;:1}&lt;br /&gt;
* The objects would be generated inside the spec file lottery_controller_spec.rb using model object initializer;&lt;br /&gt;
&lt;br /&gt;
===Edge cases===&lt;br /&gt;
&lt;br /&gt;
* Case 1: No reviewer submits a list of preferred topics to review&lt;br /&gt;
&lt;br /&gt;
* Case 2: All reviewers submits exactly the same list of topics to review.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113602</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113602"/>
		<updated>2017-11-15T15:47:57Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Use Case */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Navin&lt;br /&gt;
&lt;br /&gt;
Sathwick (sgopara@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of M4 reviewers (here M4 represents some constant)&lt;br /&gt;
** Each reviewer is assigned a maximum of M3 papers to review (here M3 represents some constant)&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
   For every topic j : &lt;br /&gt;
      For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
         Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
         B(i) = 1/S(i)&lt;br /&gt;
         Calculate C(i,j)                &lt;br /&gt;
         Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
&lt;br /&gt;
In the algorithm above, the Calculate C(i,j) involves the following:&lt;br /&gt;
&lt;br /&gt;
C(i,j) = 1/N * &amp;amp;sum; [ M1 -S(i) ] &lt;br /&gt;
&lt;br /&gt;
where we do the summation from i = 1 to i = N&lt;br /&gt;
&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
Situation in case of a priority tie: In the case that the algorithm groups all students preferring specific topic together and finds that there are more students in the cluster than the maximum team size M1, it evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of the resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
=Understanding the Flows=&lt;br /&gt;
Essentially, we have to design from scratch. Hence, we first describe the use cases, before going into the design phase.&lt;br /&gt;
&lt;br /&gt;
===Use Case===&lt;br /&gt;
Actors: &lt;br /&gt;
* Conference Reviewer: Submits a preference list of papers and reviews assigned papers&lt;br /&gt;
* Conference Administrator: Responsible for the assignment of topics to the reviewers&lt;br /&gt;
&lt;br /&gt;
Scenario&lt;br /&gt;
&lt;br /&gt;
The case of reviewers submitting a list of preferred topics and the administrator running the assignment process.&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Choose and submit preference to be reviewed====&lt;br /&gt;
Use Case Id: 1&lt;br /&gt;
Use Case Description: Participants choose the preference for conference review topics and submit it&lt;br /&gt;
Actors: Participants&lt;br /&gt;
Pre Conditions: Conference papers are presented and submitted, and the participants are eligible for reviewing&lt;br /&gt;
Post Conditions: Conference committee members can view participants preference and run bidding algorithm on it&lt;br /&gt;
====Saving bidder information into database====&lt;br /&gt;
Use Case Id: 2&lt;br /&gt;
Use Case Description: bidding preferences and related participants information are processed and saved to database&lt;br /&gt;
Actors: None&lt;br /&gt;
Triggered by: Use Case 1&lt;br /&gt;
Pre Conditions: participants preferences are submitted&lt;br /&gt;
Post Conditions: information can be retrieved and used by bidding algorithm&lt;br /&gt;
====View list of topics====&lt;br /&gt;
Use Case Id: 3&lt;br /&gt;
Use Case Description: participants can view list of topic available for conference paper topic&lt;br /&gt;
Actors: Participants&lt;br /&gt;
====Run bidding process====&lt;br /&gt;
Use Case Id: 4&lt;br /&gt;
Use Case Description: Committee members can run bidding algorithm on application to help assigning the conference paper topics to participants&lt;br /&gt;
Actors: Conference Committee&lt;br /&gt;
Pre Conditions: preferences must be submitted by participants&lt;br /&gt;
Post Conditions: the bidding result can be used for paper assignment&lt;br /&gt;
====Choosing and assigning paper to bidders====&lt;br /&gt;
Use Case Id: 5&lt;br /&gt;
Use Case Description: System assigns participants to conference paper topics according to bidding result&lt;br /&gt;
Actors: None&lt;br /&gt;
Triggered by: Use Case 4&lt;br /&gt;
Pre Conditions: bidding algorithm has run and result has been returned&lt;br /&gt;
Post Conditions: Participants can view topics been assigned to them&lt;br /&gt;
====Change assignment of review using CRUD actions====&lt;br /&gt;
Use Case Id: 6&lt;br /&gt;
Use Case Description: Conference committee members can change assignment result manually&lt;br /&gt;
Actors: Conference Committee&lt;br /&gt;
Pre Conditions: topic assignment has been done&lt;br /&gt;
Post Conditions: changes on bidding result is visible to participants and other committee members&lt;br /&gt;
&lt;br /&gt;
=== Data Flow Diagram ===&lt;br /&gt;
Below is the Data Flow Diagram for process flows of the project.&lt;br /&gt;
[[File:Webp.net-resizeimage (1).png]]&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
The changes in the first sub section below were prior to the mentor meeting, where we had a major change in our problem statement.&lt;br /&gt;
Earlier, we assumed that we only had to change the existing code, which is reflected above. &lt;br /&gt;
&lt;br /&gt;
However, with the new requirements, in addition we need to add completely new code.&lt;br /&gt;
&lt;br /&gt;
== Changing Existing Files ==&lt;br /&gt;
This sub section details what is to be changed in the existing code.&lt;br /&gt;
=== Files to be changed === &lt;br /&gt;
*lottery_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Current Code ===&lt;br /&gt;
This is current code for bidding assignment. The code will basically get target assignment and then get all topics and teams for the assignment. Then it will assign priority of each team-topic pair according to user preference  for each user, and append it to priority information list. Afterward it sends priority information along with maximum team size information to web-server and rearranging the priority order according to top-trading cycle algorithm, and pass returned result to create_new_teams_for_bidding_response function for bidding handling on topics with preferences and run_intelligent_bid function for bidding handling for leftover assignment as well as cleaning up.&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Proposed Changes ===&lt;br /&gt;
&lt;br /&gt;
To accommodate this code to fit our needs, we have proposed to add 3 new variable&lt;br /&gt;
&lt;br /&gt;
  new_intelligent_property&lt;br /&gt;
  topic_per_team&lt;br /&gt;
  team_per_topic&lt;br /&gt;
&lt;br /&gt;
new_intelligent_property will check if an assignment is using conference paper bidding or team assignment bidding, it will be true if bidding is on conference paper review and false if bidding is on team assignment; topic_per_team will record required number of topics that can be chosen per a team; and team_per_topic will record required number of teams that can be assigned to a topic. &lt;br /&gt;
&lt;br /&gt;
=== Proposed Code ===&lt;br /&gt;
&lt;br /&gt;
Then we will change the run_intelligent_assignment function to implementation as below:&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      if new_intelligent_property&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids }&lt;br /&gt;
      else&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    if !new_intelligent_property&lt;br /&gt;
      data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
      url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
      begin&lt;br /&gt;
        response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
        # store each summary in a hashmap and use the question as the key&lt;br /&gt;
        teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
        create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
        run_intelligent_bid(assignment)&lt;br /&gt;
      rescue =&amp;gt; err&lt;br /&gt;
        flash[:error] = err.message&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      run_conference_bid(teams, assignment, topic_per_team, team_per_topic)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Additional Changes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With this change, we will have to add a new function: run_conference_bid(teams, assignment), with pseudo-code as shown below:&lt;br /&gt;
&lt;br /&gt;
  def run_conference_bid teams, assignment, topic_per_team, team_per_topic&lt;br /&gt;
    set topic_set to false;&lt;br /&gt;
    for each team in teams&lt;br /&gt;
      append the team in team_list&lt;br /&gt;
      retrieve bidding ranks of each team&lt;br /&gt;
      sum all rank values in list&lt;br /&gt;
      for each topic priority/rank value in ranks list&lt;br /&gt;
        if topic_set is false&lt;br /&gt;
           append topic_id to topic_list&lt;br /&gt;
        end if&lt;br /&gt;
        calculate percentage of the rank value in comparison to sum of rank values &lt;br /&gt;
        if sum is 0 &lt;br /&gt;
          change percentage to 1/length_of_rank_list&lt;br /&gt;
        end if&lt;br /&gt;
        score rank value by doing (percent_rank_values *(number_of_topics^2) + (number_of_topics^2) / length_of_rank_list)&lt;br /&gt;
        append [team_id, score] to team_scores dictionary with team_id as key&lt;br /&gt;
      end for&lt;br /&gt;
      set topic_set to true&lt;br /&gt;
    end for&lt;br /&gt;
    sort team_scores dictionary by values/scores in descending order&lt;br /&gt;
    for score in team_scores&lt;br /&gt;
      if team not in team_list or topic not in topic_list&lt;br /&gt;
        remove score&lt;br /&gt;
        continue to next iteration&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id to topic_assignment list&lt;br /&gt;
      if number of occurrences of current topic in topic_assignment is same as topic_per_team&lt;br /&gt;
        remove this topic_id from topic_list&lt;br /&gt;
      end if&lt;br /&gt;
      append team_id to team_assignment list&lt;br /&gt;
      if number of occurrences of current team in team_assignment is same as team_per_topic&lt;br /&gt;
        remove this team_id from team_list&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id and team_id pair to team_bids&lt;br /&gt;
    end for&lt;br /&gt;
    save sign up information stored in team_bids to database&lt;br /&gt;
  end def&lt;br /&gt;
&lt;br /&gt;
=Test Plan=&lt;br /&gt;
&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
===Automated Test Cases===&lt;br /&gt;
* TDD and Feature Test cases to be written. For instance we would do Rspec test on cases below:&lt;br /&gt;
** Test on score calculation, see if the calculation gives right scoring distribution when no preference is given, when one preference is given, and when multiple preferences are given;&lt;br /&gt;
** Test on preference levels matching, check if the algorithm is match first, second, third, and so on preferences and evaluating them correctly;&lt;br /&gt;
** Test if teams per topic or topics per team can exceed required number by assigning many team with same first preference and assigning many team with multiple preferences (preference number per team &amp;gt; number of topics/2);&lt;br /&gt;
* For the Rspec tests, we will have to create object of team, assignment, and ranks. A sample team object in JSON format would be:&lt;br /&gt;
  {&amp;quot;users&amp;quot;:[{&amp;quot;ranks&amp;quot;:[1,0,2,3], &amp;quot;pid&amp;quot;:1023}],&amp;quot;max_team_size&amp;quot;:1}&lt;br /&gt;
* The objects would be generated inside the spec file lottery_controller_spec.rb using model object initializer;&lt;br /&gt;
&lt;br /&gt;
===Edge cases===&lt;br /&gt;
&lt;br /&gt;
* Case 1: No reviewer submits a list of preferred topics to review&lt;br /&gt;
&lt;br /&gt;
* Case 2: All reviewers submits exactly the same list of topics to review.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113601</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113601"/>
		<updated>2017-11-15T15:20:17Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Data Flow Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Navin&lt;br /&gt;
&lt;br /&gt;
Sathwick (sgopara@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of M4 reviewers (here M4 represents some constant)&lt;br /&gt;
** Each reviewer is assigned a maximum of M3 papers to review (here M3 represents some constant)&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
   For every topic j : &lt;br /&gt;
      For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
         Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
         B(i) = 1/S(i)&lt;br /&gt;
         Calculate C(i,j)                &lt;br /&gt;
         Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
&lt;br /&gt;
In the algorithm above, the Calculate C(i,j) involves the following:&lt;br /&gt;
&lt;br /&gt;
C(i,j) = 1/N * &amp;amp;sum; [ M1 -S(i) ] &lt;br /&gt;
&lt;br /&gt;
where we do the summation from i = 1 to i = N&lt;br /&gt;
&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
Situation in case of a priority tie: In the case that the algorithm groups all students preferring specific topic together and finds that there are more students in the cluster than the maximum team size M1, it evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of the resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
=Understanding the Flows=&lt;br /&gt;
Essentially, we have to design from scratch. Hence, we first describe the use cases, before going into the design phase.&lt;br /&gt;
&lt;br /&gt;
===Use Case===&lt;br /&gt;
Actors: &lt;br /&gt;
* Conference Reviewer: Submits a preference list of papers and reviews assigned papers&lt;br /&gt;
* Conference Administrator: Responsible for the assignment of topics to the reviewers&lt;br /&gt;
&lt;br /&gt;
Scenario&lt;br /&gt;
&lt;br /&gt;
The case of reviewers submitting a list of preferred topics and the administrator running the assignment process.&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
=== Data Flow Diagram ===&lt;br /&gt;
Below is the Data Flow Diagram for process flows of the project.&lt;br /&gt;
[[File:Webp.net-resizeimage (1).png]]&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
The changes in the first sub section below were prior to the mentor meeting, where we had a major change in our problem statement.&lt;br /&gt;
Earlier, we assumed that we only had to change the existing code, which is reflected above. &lt;br /&gt;
&lt;br /&gt;
However, with the new requirements, in addition we need to add completely new code.&lt;br /&gt;
&lt;br /&gt;
== Changing Existing Files ==&lt;br /&gt;
This sub section details what is to be changed in the existing code.&lt;br /&gt;
=== Files to be changed === &lt;br /&gt;
*lottery_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Current Code ===&lt;br /&gt;
This is current code for bidding assignment. The code will basically get target assignment and then get all topics and teams for the assignment. Then it will assign priority of each team-topic pair according to user preference  for each user, and append it to priority information list. Afterward it sends priority information along with maximum team size information to web-server and rearranging the priority order according to top-trading cycle algorithm, and pass returned result to create_new_teams_for_bidding_response function for bidding handling on topics with preferences and run_intelligent_bid function for bidding handling for leftover assignment as well as cleaning up.&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Proposed Changes ===&lt;br /&gt;
&lt;br /&gt;
To accommodate this code to fit our needs, we have proposed to add 3 new variable&lt;br /&gt;
&lt;br /&gt;
  new_intelligent_property&lt;br /&gt;
  topic_per_team&lt;br /&gt;
  team_per_topic&lt;br /&gt;
&lt;br /&gt;
new_intelligent_property will check if an assignment is using conference paper bidding or team assignment bidding, it will be true if bidding is on conference paper review and false if bidding is on team assignment; topic_per_team will record required number of topics that can be chosen per a team; and team_per_topic will record required number of teams that can be assigned to a topic. &lt;br /&gt;
&lt;br /&gt;
=== Proposed Code ===&lt;br /&gt;
&lt;br /&gt;
Then we will change the run_intelligent_assignment function to implementation as below:&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      if new_intelligent_property&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids }&lt;br /&gt;
      else&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    if !new_intelligent_property&lt;br /&gt;
      data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
      url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
      begin&lt;br /&gt;
        response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
        # store each summary in a hashmap and use the question as the key&lt;br /&gt;
        teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
        create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
        run_intelligent_bid(assignment)&lt;br /&gt;
      rescue =&amp;gt; err&lt;br /&gt;
        flash[:error] = err.message&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      run_conference_bid(teams, assignment, topic_per_team, team_per_topic)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Additional Changes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With this change, we will have to add a new function: run_conference_bid(teams, assignment), with pseudo-code as shown below:&lt;br /&gt;
&lt;br /&gt;
  def run_conference_bid teams, assignment, topic_per_team, team_per_topic&lt;br /&gt;
    set topic_set to false;&lt;br /&gt;
    for each team in teams&lt;br /&gt;
      append the team in team_list&lt;br /&gt;
      retrieve bidding ranks of each team&lt;br /&gt;
      sum all rank values in list&lt;br /&gt;
      for each topic priority/rank value in ranks list&lt;br /&gt;
        if topic_set is false&lt;br /&gt;
           append topic_id to topic_list&lt;br /&gt;
        end if&lt;br /&gt;
        calculate percentage of the rank value in comparison to sum of rank values &lt;br /&gt;
        if sum is 0 &lt;br /&gt;
          change percentage to 1/length_of_rank_list&lt;br /&gt;
        end if&lt;br /&gt;
        score rank value by doing (percent_rank_values *(number_of_topics^2) + (number_of_topics^2) / length_of_rank_list)&lt;br /&gt;
        append [team_id, score] to team_scores dictionary with team_id as key&lt;br /&gt;
      end for&lt;br /&gt;
      set topic_set to true&lt;br /&gt;
    end for&lt;br /&gt;
    sort team_scores dictionary by values/scores in descending order&lt;br /&gt;
    for score in team_scores&lt;br /&gt;
      if team not in team_list or topic not in topic_list&lt;br /&gt;
        remove score&lt;br /&gt;
        continue to next iteration&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id to topic_assignment list&lt;br /&gt;
      if number of occurrences of current topic in topic_assignment is same as topic_per_team&lt;br /&gt;
        remove this topic_id from topic_list&lt;br /&gt;
      end if&lt;br /&gt;
      append team_id to team_assignment list&lt;br /&gt;
      if number of occurrences of current team in team_assignment is same as team_per_topic&lt;br /&gt;
        remove this team_id from team_list&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id and team_id pair to team_bids&lt;br /&gt;
    end for&lt;br /&gt;
    save sign up information stored in team_bids to database&lt;br /&gt;
  end def&lt;br /&gt;
&lt;br /&gt;
=Test Plan=&lt;br /&gt;
&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
===Automated Test Cases===&lt;br /&gt;
* TDD and Feature Test cases to be written. For instance we would do Rspec test on cases below:&lt;br /&gt;
** Test on score calculation, see if the calculation gives right scoring distribution when no preference is given, when one preference is given, and when multiple preferences are given;&lt;br /&gt;
** Test on preference levels matching, check if the algorithm is match first, second, third, and so on preferences and evaluating them correctly;&lt;br /&gt;
** Test if teams per topic or topics per team can exceed required number by assigning many team with same first preference and assigning many team with multiple preferences (preference number per team &amp;gt; number of topics/2);&lt;br /&gt;
* For the Rspec tests, we will have to create object of team, assignment, and ranks. A sample team object in JSON format would be:&lt;br /&gt;
  {&amp;quot;users&amp;quot;:[{&amp;quot;ranks&amp;quot;:[1,0,2,3], &amp;quot;pid&amp;quot;:1023}],&amp;quot;max_team_size&amp;quot;:1}&lt;br /&gt;
* The objects would be generated inside the spec file lottery_controller_spec.rb using model object initializer;&lt;br /&gt;
&lt;br /&gt;
===Edge cases===&lt;br /&gt;
&lt;br /&gt;
* Case 1: No reviewer submits a list of preferred topics to review&lt;br /&gt;
&lt;br /&gt;
* Case 2: All reviewers submits exactly the same list of topics to review.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113542</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113542"/>
		<updated>2017-11-15T03:57:46Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of M4 reviewers (here M4 represents some constant)&lt;br /&gt;
** Each reviewer is assigned a maximum of M3 papers to review (here M3 represents some constant)&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
   For every topic j : &lt;br /&gt;
      For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
         Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
         B(i) = 1/S(i)&lt;br /&gt;
         Calculate C(i,j)                &lt;br /&gt;
         Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
&lt;br /&gt;
In the algorithm above, the Calculate C(i,j) involves the following:&lt;br /&gt;
&lt;br /&gt;
C(i,j) = 1/N * &amp;amp;sum; [ M1 -S(i) ] &lt;br /&gt;
&lt;br /&gt;
where we do the summation from i = 1 to i = N&lt;br /&gt;
&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
Situation in case of a priority tie: In the case that the algorithm groups all students preferring specific topic together and finds that there are more students in the cluster than the maximum team size M1, it evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of the resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
=Understanding the Flows=&lt;br /&gt;
Essentially, we have to design from scratch. Hence, we first describe the use cases, before going into the design phase.&lt;br /&gt;
&lt;br /&gt;
===Use Case===&lt;br /&gt;
Actors: &lt;br /&gt;
* Conference Reviewer: Submits a preference list of papers and reviews assigned papers&lt;br /&gt;
* Conference Administrator: Responsible for the assignment of topics to the reviewers&lt;br /&gt;
&lt;br /&gt;
Scenario&lt;br /&gt;
&lt;br /&gt;
The case of reviewers submitting a list of preferred topics and the administrator running the assignment process.&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
=== Data Flow Diagram ===&lt;br /&gt;
&lt;br /&gt;
[[File:Data Flow.png]]&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
&lt;br /&gt;
=== Files to be changed === &lt;br /&gt;
*lottery_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Current Code ===&lt;br /&gt;
This is current code for bidding assignment. The code will basically get target assignment and then get all topics and teams for the assignment. Then it will assign priority of each team-topic pair according to user preference  for each user, and append it to priority information list. Afterward it sends priority information along with maximum team size information to web-server and rearranging the priority order according to top-trading cycle algorithm, and pass returned result to create_new_teams_for_bidding_response function for bidding handling on topics with preferences and run_intelligent_bid function for bidding handling for leftover assignment as well as cleaning up.&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Proposed Changes ===&lt;br /&gt;
&lt;br /&gt;
To accommodate this code to fit our needs, we have proposed to add 3 new variable&lt;br /&gt;
&lt;br /&gt;
  new_intelligent_property&lt;br /&gt;
  topic_per_team&lt;br /&gt;
  team_per_topic&lt;br /&gt;
&lt;br /&gt;
new_intelligent_property will check if an assignment is using conference paper bidding or team assignment bidding, it will be true if bidding is on conference paper review and false if bidding is on team assignment; topic_per_team will record required number of topics that can be chosen per a team; and team_per_topic will record required number of teams that can be assigned to a topic. &lt;br /&gt;
&lt;br /&gt;
=== Proposed Code ===&lt;br /&gt;
&lt;br /&gt;
Then we will change the run_intelligent_assignment function to implementation as below:&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      if new_intelligent_property&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids }&lt;br /&gt;
      else&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    if !new_intelligent_property&lt;br /&gt;
      data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
      url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
      begin&lt;br /&gt;
        response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
        # store each summary in a hashmap and use the question as the key&lt;br /&gt;
        teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
        create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
        run_intelligent_bid(assignment)&lt;br /&gt;
      rescue =&amp;gt; err&lt;br /&gt;
        flash[:error] = err.message&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      run_conference_bid(teams, assignment, topic_per_team, team_per_topic)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Additional Changes ===&lt;br /&gt;
The changes above were prior to the mentor meeting, where we had a major change in our problem statement.&lt;br /&gt;
Earlier, we assumed that we only had to change the existing code, which is reflected above. &lt;br /&gt;
&lt;br /&gt;
However, with the new requirements, in addition to the code above, we need to add new code.&lt;br /&gt;
&lt;br /&gt;
With this change, we will have to add a new function: run_conference_bid(teams, assignment), with pseudo-code as shown below:&lt;br /&gt;
&lt;br /&gt;
  def run_conference_bid teams, assignment, topic_per_team, team_per_topic&lt;br /&gt;
    set topic_set to false;&lt;br /&gt;
    for each team in teams&lt;br /&gt;
      append the team in team_list&lt;br /&gt;
      retrieve bidding ranks of each team&lt;br /&gt;
      sum all rank values in list&lt;br /&gt;
      for each topic priority/rank value in ranks list&lt;br /&gt;
        if topic_set is false&lt;br /&gt;
           append topic_id to topic_list&lt;br /&gt;
        end if&lt;br /&gt;
        calculate percentage of the rank value in comparison to sum of rank values &lt;br /&gt;
        if sum is 0 &lt;br /&gt;
          change percentage to 1/length_of_rank_list&lt;br /&gt;
        end if&lt;br /&gt;
        score rank value by doing (percent_rank_values *(number_of_topics^2) + (number_of_topics^2) / length_of_rank_list)&lt;br /&gt;
        append [team_id, score] to team_scores dictionary with team_id as key&lt;br /&gt;
      end for&lt;br /&gt;
      set topic_set to true&lt;br /&gt;
    end for&lt;br /&gt;
    sort team_scores dictionary by values/scores in descending order&lt;br /&gt;
    for score in team_scores&lt;br /&gt;
      if team not in team_list or topic not in topic_list&lt;br /&gt;
        remove score&lt;br /&gt;
        continue to next iteration&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id to topic_assignment list&lt;br /&gt;
      if number of occurrences of current topic in topic_assignment is same as topic_per_team&lt;br /&gt;
        remove this topic_id from topic_list&lt;br /&gt;
      end if&lt;br /&gt;
      append team_id to team_assignment list&lt;br /&gt;
      if number of occurrences of current team in team_assignment is same as team_per_topic&lt;br /&gt;
        remove this team_id from team_list&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id and team_id pair to team_bids&lt;br /&gt;
    end for&lt;br /&gt;
    save sign up information stored in team_bids to database&lt;br /&gt;
  end def&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
====Manual Testing====&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
====Automated Test Cases====&lt;br /&gt;
* TDD and Feature Test cases to be written. For instance we would do Rspec test on cases below:&lt;br /&gt;
** Test on score calculation, see if the calculation gives right scoring distribution when no preference is given, when one preference is given, and when multiple preferences are given;&lt;br /&gt;
** Test on preference levels matching, check if the algorithm is match first, second, third, and so on preferences and evaluating them correctly;&lt;br /&gt;
** Test if teams per topic or topics per team can exceed required number by assigning many team with same first preference and assigning many team with multiple preferences (preference number per team &amp;gt; number of topics/2);&lt;br /&gt;
* For the Rspec tests, we will have to create object of team, assignment, and ranks. A sample team object in JSON format would be:&lt;br /&gt;
  {&amp;quot;users&amp;quot;:[{&amp;quot;ranks&amp;quot;:[1,0,2,3], &amp;quot;pid&amp;quot;:1023}],&amp;quot;max_team_size&amp;quot;:1}&lt;br /&gt;
* The objects would be generated inside the spec file lottery_controller_spec.rb using model object initializer;&lt;br /&gt;
&lt;br /&gt;
=====Edge cases=====&lt;br /&gt;
&lt;br /&gt;
* Case 1: No reviewer submits a list of preferred topics to review&lt;br /&gt;
&lt;br /&gt;
* Case 2: All reviewers submits exactly the same list of topics to review.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113511</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113511"/>
		<updated>2017-11-15T03:47:38Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Files to be changed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of M4 reviewers (here M4 represents some constant)&lt;br /&gt;
** Each reviewer is assigned a maximum of M3 papers to review (here M3 represents some constant)&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
   For every topic j : &lt;br /&gt;
      For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
         Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
         B(i) = 1/S(i)&lt;br /&gt;
         Calculate C(i,j)                &lt;br /&gt;
         Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
&lt;br /&gt;
In the algorithm above, the Calculate C(i,j) involves the following:&lt;br /&gt;
&lt;br /&gt;
C(i,j) = 1/N * &amp;amp;sum; [ M1 -S(i) ] &lt;br /&gt;
&lt;br /&gt;
where we do the summation from i = 1 to i = N&lt;br /&gt;
&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
Situation in case of a priority tie: In the case that the algorithm groups all students preferring specific topic together and finds that there are more students in the cluster than the maximum team size M1, it evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of the resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
=Understanding the Flows=&lt;br /&gt;
Essentially, we have to design from scratch. Hence, we first describe the use cases, before going into the design phase.&lt;br /&gt;
&lt;br /&gt;
===Use Case===&lt;br /&gt;
Actors: &lt;br /&gt;
* Conference Reviewer: Submits a preference list of papers and reviews assigned papers&lt;br /&gt;
* Conference Administrator: Responsible for the assignment of topics to the reviewers&lt;br /&gt;
&lt;br /&gt;
Scenario&lt;br /&gt;
&lt;br /&gt;
The case of reviewers submitting a list of preferred topics and the administrator running the assignment process.&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
=== Data Flow Diagram ===&lt;br /&gt;
&lt;br /&gt;
[[File:Data Flow.png]]&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
&lt;br /&gt;
=== Files to be changed === &lt;br /&gt;
*lottery_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Current Code ===&lt;br /&gt;
This is current code for bidding assignment. The code will basically get target assignment and then get all topics and teams for the assignment. Then it will assign priority of each team-topic pair according to user preference  for each user, and append it to priority information list. Afterward it sends priority information along with maximum team size information to web-server and rearranging the priority order according to top-trading cycle algorithm, and pass returned result to create_new_teams_for_bidding_response function for bidding handling on topics with preferences and run_intelligent_bid function for bidding handling for leftover assignment as well as cleaning up.&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Proposed Changes ===&lt;br /&gt;
&lt;br /&gt;
To accommodate this code to fit our needs, we have proposed to add 3 new variable&lt;br /&gt;
&lt;br /&gt;
  anti_intelligent_property&lt;br /&gt;
  topic_per_team&lt;br /&gt;
  team_per_topic&lt;br /&gt;
&lt;br /&gt;
anti_intelligent_property will check if an assignment is using conference paper bidding or team assignment bidding, it will be true if bidding is on conference paper review and false if bidding is on team assignment; topic_per_team will record required number of topics that can be chosen per a team; and team_per_topic will record required number of teams that can be assigned to a topic. Then we will change the run_intelligent_assignment function to implementation as below:&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      if anti_intelligent_property&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids }&lt;br /&gt;
      else&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    if !anti_intelligent_property&lt;br /&gt;
      data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
      url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
      begin&lt;br /&gt;
        response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
        # store each summary in a hashmap and use the question as the key&lt;br /&gt;
        teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
        create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
        run_intelligent_bid(assignment)&lt;br /&gt;
      rescue =&amp;gt; err&lt;br /&gt;
        flash[:error] = err.message&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      run_conference_bid(teams, assignment, topic_per_team, team_per_topic)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
With this change, we will have to add a new function: run_conference_bid(teams, assignment), with pseudo-code as shown below:&lt;br /&gt;
&lt;br /&gt;
  def run_conference_bid teams, assignment, topic_per_team, team_per_topic&lt;br /&gt;
    set topic_set to false;&lt;br /&gt;
    for each team in teams&lt;br /&gt;
      append the team in team_list&lt;br /&gt;
      retrieve bidding ranks of each team&lt;br /&gt;
      sum all rank values in list&lt;br /&gt;
      for each topic priority/rank value in ranks list&lt;br /&gt;
        if topic_set is false&lt;br /&gt;
           append topic_id to topic_list&lt;br /&gt;
        end if&lt;br /&gt;
        calculate percentage of the rank value in comparison to sum of rank values &lt;br /&gt;
        if sum is 0 &lt;br /&gt;
          change percentage to 1/length_of_rank_list&lt;br /&gt;
        end if&lt;br /&gt;
        score rank value by doing (percent_rank_values *(number_of_topics^2) + (number_of_topics^2) / length_of_rank_list)&lt;br /&gt;
        append [team_id, score] to team_scores dictionary with team_id as key&lt;br /&gt;
      end for&lt;br /&gt;
      set topic_set to true&lt;br /&gt;
    end for&lt;br /&gt;
    sort team_scores dictionary by values/scores in descending order&lt;br /&gt;
    for score in team_scores&lt;br /&gt;
      if team not in team_list or topic not in topic_list&lt;br /&gt;
        remove score&lt;br /&gt;
        continue to next iteration&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id to topic_assignment list&lt;br /&gt;
      if number of occurrences of current topic in topic_assignment is same as topic_per_team&lt;br /&gt;
        remove this topic_id from topic_list&lt;br /&gt;
      end if&lt;br /&gt;
      append team_id to team_assignment list&lt;br /&gt;
      if number of occurrences of current team in team_assignment is same as team_per_topic&lt;br /&gt;
        remove this team_id from team_list&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id and team_id pair to team_bids&lt;br /&gt;
    end for&lt;br /&gt;
    save sign up information stored in team_bids to database&lt;br /&gt;
  end def&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
====Manual Testing====&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
====Automated Test Cases====&lt;br /&gt;
* TDD and Feature Test cases to be written. For instance we would do Rspec test on cases below:&lt;br /&gt;
** Test on score calculation, see if the calculation gives right scoring distribution when no preference is given, when one preference is given, and when multiple preferences are given;&lt;br /&gt;
** Test on preference levels matching, check if the algorithm is match first, second, third, and so on preferences and evaluating them correctly;&lt;br /&gt;
** Test if teams per topic or topics per team can exceed required number by assigning many team with same first preference and assigning many team with multiple preferences (preference number per team &amp;gt; number of topics/2);&lt;br /&gt;
&lt;br /&gt;
=====Edge cases=====&lt;br /&gt;
&lt;br /&gt;
* Case 1: No reviewer submits a list of preferred topics to review&lt;br /&gt;
&lt;br /&gt;
* Case 2: All reviewers submits exactly the same list of topics to review.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113506</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113506"/>
		<updated>2017-11-15T03:43:41Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Automated Test Cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of M4 reviewers (here M4 represents some constant)&lt;br /&gt;
** Each reviewer is assigned a maximum of M3 papers to review (here M3 represents some constant)&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
   For every topic j : &lt;br /&gt;
      For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
         Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
         B(i) = 1/S(i)&lt;br /&gt;
         Calculate C(i,j)                &lt;br /&gt;
         Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
&lt;br /&gt;
In the algorithm above, the Calculate C(i,j) involves the following:&lt;br /&gt;
&lt;br /&gt;
C(i,j) = 1/N * &amp;amp;sum; [ M1 -S(i) ] &lt;br /&gt;
&lt;br /&gt;
where we do the summation from i = 1 to i = N&lt;br /&gt;
&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
Situation in case of a priority tie: In the case that the algorithm groups all students preferring specific topic together and finds that there are more students in the cluster than the maximum team size M1, it evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of the resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
=Understanding the Flows=&lt;br /&gt;
Essentially, we have to design from scratch. Hence, we first describe the use cases, before going into the design phase.&lt;br /&gt;
&lt;br /&gt;
===Use Case===&lt;br /&gt;
Actors: &lt;br /&gt;
* Conference Reviewer: Submits a preference list of papers and reviews assigned papers&lt;br /&gt;
* Conference Administrator: Responsible for the assignment of topics to the reviewers&lt;br /&gt;
&lt;br /&gt;
Scenario&lt;br /&gt;
&lt;br /&gt;
The case of reviewers submitting a list of preferred topics and the administrator running the assignment process.&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
=== Data Flow Diagram ===&lt;br /&gt;
&lt;br /&gt;
[[File:Data Flow.png]]&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
&lt;br /&gt;
=== Files to be changed === &lt;br /&gt;
               lottery_controller.rb&lt;br /&gt;
&lt;br /&gt;
This is current code for bidding assignment. The code will basically get target assignment (conference paper assignment in our case) and then get all topics and teams for the assignment. Then it will assign priority of each team-topic pair according to user preference  for each user, and append it to priority information list. Afterward it sends priority information along with maximem team size information to web-server and rearranging the priority order according to top-trading cycle algorithm, and pass returned result to create_new_teams_for_bidding_response function for bidding handling on topics with preferences and run_intelligent_bid function for bidding handling for leftover assignment as well as cleaning up.&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
To accommodate this code to fit our needs, we have proposed to add 3 new variable&lt;br /&gt;
&lt;br /&gt;
  anti_intelligent_property&lt;br /&gt;
  topic_per_team&lt;br /&gt;
  team_per_topic&lt;br /&gt;
&lt;br /&gt;
anti_intelligent_property will check if an assignment is using conference paper bidding or team assignment bidding, it will be true if bidding is on conference paper review and false if bidding is on team assignment; topic_per_team will record required number of topics that can be chosen per a team; and team_per_topic will record required number of teams that can be assigned to a topic. Then we will change the run_intelligent_assignment function to implementation as below:&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      if anti_intelligent_property&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids }&lt;br /&gt;
      else&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    if !anti_intelligent_property&lt;br /&gt;
      data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
      url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
      begin&lt;br /&gt;
        response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
        # store each summary in a hashmap and use the question as the key&lt;br /&gt;
        teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
        create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
        run_intelligent_bid(assignment)&lt;br /&gt;
      rescue =&amp;gt; err&lt;br /&gt;
        flash[:error] = err.message&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      run_conference_bid(teams, assignment, topic_per_team, team_per_topic)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
With this change, we will have to add a new function: run_conference_bid(teams, assignment), with pseudo-code as shown below:&lt;br /&gt;
&lt;br /&gt;
  def run_conference_bid teams, assignment, topic_per_team, team_per_topic&lt;br /&gt;
    set topic_set to false;&lt;br /&gt;
    for each team in teams&lt;br /&gt;
      append the team in team_list&lt;br /&gt;
      retrieve bidding ranks of each team&lt;br /&gt;
      sum all rank values in list&lt;br /&gt;
      for each topic priority/rank value in ranks list&lt;br /&gt;
        if topic_set is false&lt;br /&gt;
           append topic_id to topic_list&lt;br /&gt;
        end if&lt;br /&gt;
        calculate percentage of the rank value in comparison to sum of rank values &lt;br /&gt;
        if sum is 0 &lt;br /&gt;
          change percentage to 1/length_of_rank_list&lt;br /&gt;
        end if&lt;br /&gt;
        score rank value by doing (percent_rank_values *(number_of_topics^2) + (number_of_topics^2) / length_of_rank_list)&lt;br /&gt;
        append [team_id, score] to team_scores dictionary with team_id as key&lt;br /&gt;
      end for&lt;br /&gt;
      set topic_set to true&lt;br /&gt;
    end for&lt;br /&gt;
    sort team_scores dictionary by values/scores in descending order&lt;br /&gt;
    for score in team_scores&lt;br /&gt;
      if team not in team_list or topic not in topic_list&lt;br /&gt;
        remove score&lt;br /&gt;
        continue to next iteration&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id to topic_assignment list&lt;br /&gt;
      if number of occurrences of current topic in topic_assignment is same as topic_per_team&lt;br /&gt;
        remove this topic_id from topic_list&lt;br /&gt;
      end if&lt;br /&gt;
      append team_id to team_assignment list&lt;br /&gt;
      if number of occurrences of current team in team_assignment is same as team_per_topic&lt;br /&gt;
        remove this team_id from team_list&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id and team_id pair to team_bids&lt;br /&gt;
    end for&lt;br /&gt;
    save sign up information stored in team_bids to database&lt;br /&gt;
  end def&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
====Manual Testing====&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
====Automated Test Cases====&lt;br /&gt;
* TDD and Feature Test cases to be written. For instance we would do Rspec test on cases below:&lt;br /&gt;
** Test on score calculation, see if the calculation gives right scoring distribution when no preference is given, when one preference is given, and when multiple preferences are given;&lt;br /&gt;
** Test on preference levels matching, check if the algorithm is match first, second, third, and so on preferences and evaluating them correctly;&lt;br /&gt;
** Test if teams per topic or topics per team can exceed required number by assigning many team with same first preference and assigning many team with multiple preferences (preference number per team &amp;gt; number of topics/2);&lt;br /&gt;
&lt;br /&gt;
=====Edge cases=====&lt;br /&gt;
&lt;br /&gt;
* Case 1: No reviewer submits a list of preferred topics to review&lt;br /&gt;
&lt;br /&gt;
* Case 2: All reviewers submits exactly the same list of topics to review.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113496</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113496"/>
		<updated>2017-11-15T03:32:21Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of M4 reviewers (here M4 represents some constant)&lt;br /&gt;
** Each reviewer is assigned a maximum of M3 papers to review (here M3 represents some constant)&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
   For every topic j : &lt;br /&gt;
      For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
         Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
         B(i) = 1/S(i)&lt;br /&gt;
         Calculate C(i,j)                &lt;br /&gt;
         Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
&lt;br /&gt;
In the algorithm above, the Calculate C(i,j) involves the following:&lt;br /&gt;
&lt;br /&gt;
C(i,j) = 1/N * &amp;amp;sum; [ M1 -S(i) ] &lt;br /&gt;
&lt;br /&gt;
where we do the summation from i = 1 to i = N&lt;br /&gt;
&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
Situation in case of a priority tie: In the case that the algorithm groups all students preferring specific topic together and finds that there are more students in the cluster than the maximum team size M1, it evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of the resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
=Use Case Diagram=&lt;br /&gt;
Essentially, we have to design from scratch. Hence, we first describe some use cases, before going into the design phase.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Data Flow.png]]&lt;br /&gt;
&lt;br /&gt;
==Files to be Modified==&lt;br /&gt;
&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
&lt;br /&gt;
This is current code for bidding assignment. The code will basically get target assignment (conference paper assignment in our case) and then get all topics and teams for the assignment. Then it will assign priority of each team-topic pair according to user preference  for each user, and append it to priority information list. Afterward it sends priority information along with maximem team size information to web-server and rearranging the priority order according to top-trading cycle algorithm, and pass returned result to create_new_teams_for_bidding_response function for bidding handling on topics with preferences and run_intelligent_bid function for bidding handling for leftover assignment as well as cleaning up.&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
To accommodate this code to fit our needs, we have proposed to add 3 new variable&lt;br /&gt;
&lt;br /&gt;
  anti_intelligent_property&lt;br /&gt;
  topic_per_team&lt;br /&gt;
  team_per_topic&lt;br /&gt;
&lt;br /&gt;
anti_intelligent_property will check if an assignment is using conference paper bidding or team assignment bidding, it will be true if bidding is on conference paper review and false if bidding is on team assignment; topic_per_team will record required number of topics that can be chosen per a team; and team_per_topic will record required number of teams that can be assigned to a topic. Then we will change the run_intelligent_assignment function to implementation as below:&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      if anti_intelligent_property&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids }&lt;br /&gt;
      else&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    if !anti_intelligent_property&lt;br /&gt;
      data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
      url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
      begin&lt;br /&gt;
        response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
        # store each summary in a hashmap and use the question as the key&lt;br /&gt;
        teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
        create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
        run_intelligent_bid(assignment)&lt;br /&gt;
      rescue =&amp;gt; err&lt;br /&gt;
        flash[:error] = err.message&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      run_conference_bid(teams, assignment, topic_per_team, team_per_topic)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
With this change, we will have to add a new function: run_conference_bid(teams, assignment), with pseudo-code as shown below:&lt;br /&gt;
&lt;br /&gt;
  def run_conference_bid teams, assignment, topic_per_team, team_per_topic&lt;br /&gt;
    set topic_set to false;&lt;br /&gt;
    for each team in teams&lt;br /&gt;
      append the team in team_list&lt;br /&gt;
      retrieve bidding ranks of each team&lt;br /&gt;
      sum all rank values in list&lt;br /&gt;
      for each topic priority/rank value in ranks list&lt;br /&gt;
        if topic_set is false&lt;br /&gt;
           append topic_id to topic_list&lt;br /&gt;
        end if&lt;br /&gt;
        calculate percentage of the rank value in comparison to sum of rank values &lt;br /&gt;
        if sum is 0 &lt;br /&gt;
          change percentage to 1/length_of_rank_list&lt;br /&gt;
        end if&lt;br /&gt;
        score rank value by doing (percent_rank_values *(number_of_topics^2) + (number_of_topics^2) / length_of_rank_list)&lt;br /&gt;
        append [team_id, score] to team_scores dictionary with team_id as key&lt;br /&gt;
      end for&lt;br /&gt;
      set topic_set to true&lt;br /&gt;
    end for&lt;br /&gt;
    sort team_scores dictionary by values/scores in descending order&lt;br /&gt;
    for score in team_scores&lt;br /&gt;
      if team not in team_list or topic not in topic_list&lt;br /&gt;
        remove score&lt;br /&gt;
        continue to next iteration&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id to topic_assignment list&lt;br /&gt;
      if number of occurrences of current topic in topic_assignment is same as topic_per_team&lt;br /&gt;
        remove this topic_id from topic_list&lt;br /&gt;
      end if&lt;br /&gt;
      append team_id to team_assignment list&lt;br /&gt;
      if number of occurrences of current team in team_assignment is same as team_per_topic&lt;br /&gt;
        remove this team_id from team_list&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id and team_id pair to team_bids&lt;br /&gt;
    end for&lt;br /&gt;
    save sign up information stored in team_bids to database&lt;br /&gt;
  end def&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
====Manual Testing====&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
====Automated Test Cases====&lt;br /&gt;
* TDD and Feature Test cases to be written. For instance we would do Rspec test on cases below:&lt;br /&gt;
**&lt;br /&gt;
**&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
=====Edge cases=====&lt;br /&gt;
&lt;br /&gt;
* Case 1: No reviewer submits a list of preferred topics to review&lt;br /&gt;
&lt;br /&gt;
* Case 2: All reviewers submits exactly the same list of topics to review.&lt;br /&gt;
&lt;br /&gt;
* Case 3: If a participant is assigned to review a paper in the (topics) preference list but decides to drop the review after the bidding process is done.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113485</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113485"/>
		<updated>2017-11-15T03:26:26Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Files to be Modified */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of M4 reviewers&lt;br /&gt;
** Each reviewer is assigned a maximum of M3 papers to review&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
   For every topic j : &lt;br /&gt;
      For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
         Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
         B(i) = 1/S(i)&lt;br /&gt;
         Calculate C(i,j)                &lt;br /&gt;
         Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
&lt;br /&gt;
In the algorithm above, the Calculate C(i,j) involves the following:&lt;br /&gt;
&lt;br /&gt;
C(i,j) = 1/N * &amp;amp;sum; [ M1 -S(i) ] &lt;br /&gt;
&lt;br /&gt;
where we do the summation from i = 1 to i = N&lt;br /&gt;
&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
Situation in case of a priority tie: In the case that the algorithm groups all students preferring specific topic together and finds that there are more students in the cluster than the maximum team size M1, it evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of the resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
=Use Case Diagram=&lt;br /&gt;
Essentially, we have to design from scratch. Hence, we first describe some use cases, before going into the design phase.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
==Files to be Modified==&lt;br /&gt;
&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
&lt;br /&gt;
This is current code for bidding assignment. The code will basically get target assignment (conference paper assignment in our case) and then get all topics and teams for the assignment. Then it will assign priority of each team-topic pair according to user preference  for each user, and append it to priority information list. Afterward it sends priority information along with maximem team size information to web-server and rearranging the priority order according to top-trading cycle algorithm, and pass returned result to create_new_teams_for_bidding_response function for bidding handling on topics with preferences and run_intelligent_bid function for bidding handling for leftover assignment as well as cleaning up.&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
To accommodate this code to fit our needs, we have proposed to add 3 new variable&lt;br /&gt;
&lt;br /&gt;
  anti_intelligent_property&lt;br /&gt;
  topic_per_team&lt;br /&gt;
  team_per_topic&lt;br /&gt;
&lt;br /&gt;
anti_intelligent_property will check if an assignment is using conference paper bidding or team assignment bidding, it will be true if bidding is on conference paper review and false if bidding is on team assignment; topic_per_team will record required number of topics that can be chosen per a team; and team_per_topic will record required number of teams that can be assigned to a topic. Then we will change the run_intelligent_assignment function to implementation as below:&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      if anti_intelligent_property&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids }&lt;br /&gt;
      else&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    if !anti_intelligent_property&lt;br /&gt;
      data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
      url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
      begin&lt;br /&gt;
        response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
        # store each summary in a hashmap and use the question as the key&lt;br /&gt;
        teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
        create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
        run_intelligent_bid(assignment)&lt;br /&gt;
      rescue =&amp;gt; err&lt;br /&gt;
        flash[:error] = err.message&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      run_conference_bid(teams, assignment, topic_per_team, team_per_topic)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
With this change, we will have to add a new function: run_conference_bid(teams, assignment), with pseudo-code as shown below:&lt;br /&gt;
&lt;br /&gt;
  def run_conference_bid teams, assignment, topic_per_team, team_per_topic&lt;br /&gt;
    set topic_set to false;&lt;br /&gt;
    for each team in teams&lt;br /&gt;
      append the team in team_list&lt;br /&gt;
      retrieve bidding ranks of each team&lt;br /&gt;
      sum all rank values in list&lt;br /&gt;
      for each topic priority/rank value in ranks list&lt;br /&gt;
        if topic_set is false&lt;br /&gt;
           append topic_id to topic_list&lt;br /&gt;
        end if&lt;br /&gt;
        calculate percentage of the rank value in comparison to sum of rank values &lt;br /&gt;
        if sum is 0 &lt;br /&gt;
          change percentage to 1/length_of_rank_list&lt;br /&gt;
        end if&lt;br /&gt;
        score rank value by doing (percent_rank_values *(number_of_topics^2) + (number_of_topics^2) / length_of_rank_list)&lt;br /&gt;
        append [team_id, score] to team_scores dictionary with team_id as key&lt;br /&gt;
      end for&lt;br /&gt;
      set topic_set to true&lt;br /&gt;
    end for&lt;br /&gt;
    sort team_scores dictionary by values/scores in descending order&lt;br /&gt;
    for score in team_scores&lt;br /&gt;
      if team not in team_list or topic not in topic_list&lt;br /&gt;
        remove score&lt;br /&gt;
        continue to next iteration&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id to topic_assignment list&lt;br /&gt;
      if number of occurrences of current topic in topic_assignment is same as topic_per_team&lt;br /&gt;
        remove this topic_id from topic_list&lt;br /&gt;
      end if&lt;br /&gt;
      append team_id to team_assignment list&lt;br /&gt;
      if number of occurrences of current team in team_assignment is same as team_per_topic&lt;br /&gt;
        remove this team_id from team_list&lt;br /&gt;
      end if&lt;br /&gt;
      append topic_id and team_id pair to team_bids&lt;br /&gt;
    end for&lt;br /&gt;
    save sign up information stored in team_bids to database&lt;br /&gt;
  end def&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
====Manual Testing====&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
====Automated Test Cases====&lt;br /&gt;
* TDD and Feature Test cases to be written.&lt;br /&gt;
&lt;br /&gt;
=====Edge cases=====&lt;br /&gt;
&lt;br /&gt;
* Case 1: No reviewer submits a list of preferred topics to review&lt;br /&gt;
&lt;br /&gt;
* Case 2: All reviewers submits exactly the same list of topics to review.&lt;br /&gt;
&lt;br /&gt;
* Case 3: If a participant is assigned to review a paper in the (topics) preference list but decides to drop the review after the bidding process is done.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113435</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113435"/>
		<updated>2017-11-15T02:39:20Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Files to be Modified */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of R reviewers&lt;br /&gt;
** Each reviewer is assigned a maximum of P papers to review&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
'''for each''' ''topic j''':&lt;br /&gt;
   '''for each''' ''position i'' '''that topic j has been placed on (in any preference list'''&lt;br /&gt;
       &lt;br /&gt;
''largest'' ← ''L''[0]&lt;br /&gt;
   '''for each''' ''item'' '''in''' ''L'', '''do'''&lt;br /&gt;
     '''if''' ''item'' &amp;gt; ''largest'', '''then'''&lt;br /&gt;
       ''largest'' ← ''item''&lt;br /&gt;
   '''return''' ''largest''&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For every topic j : &lt;br /&gt;
       For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
              Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
              B(i) = 1/S(i)&lt;br /&gt;
              C(i,j) = 1/N * :&amp;lt;math&amp;gt;\sum_{i \mathop =1}^{N}(M1 -S(i) ).&amp;lt;/math&amp;gt;           &lt;br /&gt;
              *i=1N&lt;br /&gt;
              Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The changes related to this project are required for reviewing conference papers and journals. The users are able to submit their works as either individuals or teams to be scrutinized. The other participants are allowed to review the papers of their interest from the list of submitted papers. The participants are allowed to bid on the papers of their preference in a preference list with the top most entry taking the highest priority. The bidding algorithm already exists as called by a web service in Peerlogic. The goal of this project is to generalize the algorithm for both review and topic based bidding.&lt;br /&gt;
&lt;br /&gt;
===Test &lt;br /&gt;
The existing bidding algorithm used by the application is only available for team assignment bidding. The algorithm itself groups all team members preferring specific topic together, then evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
====Bidding Algorithm Overview====&lt;br /&gt;
&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Our goal here is as follows: &lt;br /&gt;
* To implement a bidding algorithm for conference paper reviewer assignment functionality.&lt;br /&gt;
* To attempt to merge the existing and the new algorithm as much as possible&lt;br /&gt;
&lt;br /&gt;
====Possible Extension====&lt;br /&gt;
&lt;br /&gt;
A possible extension is to combine reviewer assignment by bidding with one of the other assignment methods--instructor assignment, or “automated” assignment, where each new reviewer is assigned one of the least-reviewed submissions so far.  In this case, submissions that are not bid upon would be assigned to reviewers who “show up later,” as would reviews that are not completed by the reviewers who bid on them.&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
==Files to be Modified==&lt;br /&gt;
&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
&lt;br /&gt;
This is current code for bidding assignment. The code will basically get target assignment (conference paper assignment in our case) and then get all topics and teams for the assignment. Then it will assign priority of each team-topic pair according to user preference  for each user, and append it to priority information list. Afterward it sends priority information along with maximem team size information to web-server and rearranging the priority order according to top-trading cycle algorithm, and pass returned result to create_new_teams_for_bidding_response function for bidding handling on topics with preferences and run_intelligent_bid function for bidding handling for leftover assignment as well as cleaning up.&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
To accommodate this code to fit our needs, we have proposed to add a new variable&lt;br /&gt;
&lt;br /&gt;
  anti_intelligent_property&lt;br /&gt;
&lt;br /&gt;
which will be true if bidding is on conference paper review and false if bidding is on team assignment. Then we will change the run_intelligent_assignment function to implementation as below:&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      if anti_intelligent_property&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids }&lt;br /&gt;
      else&lt;br /&gt;
        team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    if !anti_intelligent_property&lt;br /&gt;
      data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
      url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
      begin&lt;br /&gt;
        response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
        # store each summary in a hashmap and use the question as the key&lt;br /&gt;
        teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
        create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
        run_intelligent_bid(assignment)&lt;br /&gt;
      rescue =&amp;gt; err&lt;br /&gt;
        flash[:error] = err.message&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      run_conference_bid(teams, assignment)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
With this change, we will have to add a new function: run_conference_bid(teams, assignment), with pseudo-code as shown below:&lt;br /&gt;
&lt;br /&gt;
  def run_conference_bid teams, assignment function&lt;br /&gt;
    &lt;br /&gt;
  end def&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
====Manual Testing====&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
====Automated Test Cases====&lt;br /&gt;
* TDD and Feature Test cases to be written.&lt;br /&gt;
&lt;br /&gt;
=====Edge cases=====&lt;br /&gt;
&lt;br /&gt;
* Case 1: Users signing up after bidding is done need to be assigned the papers/journals with no or least reviews done.&lt;br /&gt;
&lt;br /&gt;
* Case 2: Extending edge case 1, if somebody doesn't provide a list of topics s(he) wants to review, the topic with the least number of bids is assigned.&lt;br /&gt;
&lt;br /&gt;
* Case 3: If a participant is assigned to review a paper in the (topics) preference list but decides to drop the review after the bidding process is done.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113393</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113393"/>
		<updated>2017-11-15T01:55:22Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Files to be Modified */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of R reviewers&lt;br /&gt;
** Each reviewer is assigned a maximum of P papers to review&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
    For every topic j : &lt;br /&gt;
       For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
              Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
              B(i) = 1/S(i)           &lt;br /&gt;
              C(i,j) = 1N*i=1N(M1 -S(i) ) &lt;br /&gt;
              Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The changes related to this project are required for reviewing conference papers and journals. The users are able to submit their works as either individuals or teams to be scrutinized. The other participants are allowed to review the papers of their interest from the list of submitted papers. The participants are allowed to bid on the papers of their preference in a preference list with the top most entry taking the highest priority. The bidding algorithm already exists as called by a web service in Peerlogic. The goal of this project is to generalize the algorithm for both review and topic based bidding.&lt;br /&gt;
&lt;br /&gt;
===Test &lt;br /&gt;
The existing bidding algorithm used by the application is only available for team assignment bidding. The algorithm itself groups all team members preferring specific topic together, then evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
====Bidding Algorithm Overview====&lt;br /&gt;
&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Our goal here is as follows: &lt;br /&gt;
* To implement a bidding algorithm for conference paper reviewer assignment functionality.&lt;br /&gt;
* To attempt to merge the existing and the new algorithm as much as possible&lt;br /&gt;
&lt;br /&gt;
====Possible Extension====&lt;br /&gt;
&lt;br /&gt;
A possible extension is to combine reviewer assignment by bidding with one of the other assignment methods--instructor assignment, or “automated” assignment, where each new reviewer is assigned one of the least-reviewed submissions so far.  In this case, submissions that are not bid upon would be assigned to reviewers who “show up later,” as would reviews that are not completed by the reviewers who bid on them.&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
==Files to be Modified==&lt;br /&gt;
&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
This is current code for &lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
====Manual Testing====&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
====Automated Test Cases====&lt;br /&gt;
* TDD and Feature Test cases to be written.&lt;br /&gt;
&lt;br /&gt;
=====Edge cases=====&lt;br /&gt;
&lt;br /&gt;
* Case 1: Users signing up after bidding is done need to be assigned the papers/journals with no or least reviews done.&lt;br /&gt;
&lt;br /&gt;
* Case 2: Extending edge case 1, if somebody doesn't provide a list of topics s(he) wants to review, the topic with the least number of bids is assigned.&lt;br /&gt;
&lt;br /&gt;
* Case 3: If a participant is assigned to review a paper in the (topics) preference list but decides to drop the review after the bidding process is done.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113389</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113389"/>
		<updated>2017-11-15T01:50:49Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Files to be Modified */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project describes the work done for the project E17A7, which involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are: &lt;br /&gt;
&lt;br /&gt;
Leiyang Guo (lguo7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Bikram Singh (bsingh8@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. This project is an software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.&lt;br /&gt;
&lt;br /&gt;
===Background of the project===&lt;br /&gt;
As explained above, Expertiza is currently able to support a university course, hosting students and instructors and able to assign and grade projects by the appropriate users.&lt;br /&gt;
&lt;br /&gt;
Expertiza is currently not able to support a conference. The difference between a conference and an university course are several. However the focus of our project is the bidding ability.&lt;br /&gt;
&lt;br /&gt;
In the existing Expertiza functionality, the bidding ability is only for bidding for a project topic. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then posts a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features: &lt;br /&gt;
* Students (not in at team) with close preferences are assigned into a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams the project topic is assigned as per the common project topic preference list&lt;br /&gt;
* Each team is assigned only one topic&lt;br /&gt;
* Each topic (if assigned) is assigned to a maximum of one team&lt;br /&gt;
&lt;br /&gt;
===Description of project===&lt;br /&gt;
As stated above, Expertiza currently is not able to support a conference. This project is not responsible for adding code so as to support a conference. Rather, we are interested in the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.&lt;br /&gt;
&lt;br /&gt;
For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.&lt;br /&gt;
&lt;br /&gt;
Then the basic working of the project assumes: &lt;br /&gt;
* Before the bidding close deadline, reviewers submit a list of papers they wish to review.&lt;br /&gt;
* After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:&lt;br /&gt;
** Each paper (if assigned) is assigned to a maximum of R reviewers&lt;br /&gt;
** Each reviewer is assigned a maximum of P papers to review&lt;br /&gt;
** Assignment of papers is individual, that is no paper is to be reviewed by a &amp;quot;team&amp;quot; of reviewers&lt;br /&gt;
&lt;br /&gt;
=Project Requirements=&lt;br /&gt;
&lt;br /&gt;
In this section we discuss the problem statement, then discuss the existing code and possible changes required. &lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
* To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review. In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially.&lt;br /&gt;
* A possible extension is to add other methods, like a &amp;quot;late reviewer registration&amp;quot; method, in which each new reviewer is assigned one of the least-reviewed submissions so far. Methods like these require an extension of the basic working of the project.&lt;br /&gt;
* The matching algorithm is currently not very sophisticated.  Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment), and could be adapted to this use. However, in the subsequent discussion, as noted above, because the two bidding situations were found different the requirement is to first make the bidding for a conference (using any algorithm) and if time permits, to use a better algorithm like top trading cycles.&lt;br /&gt;
&lt;br /&gt;
===Understanding the Requirements===&lt;br /&gt;
* Objects (being bid on) are often assigned by having the bidders providing a preference list of bids. &lt;br /&gt;
** Expertiza provides a way for students to bid on different assignment topics. This allows the fair topic assignment distribution among students, particularly when multiple students or groups (of students) are bidding on same topic or paper. &lt;br /&gt;
**This is very similar to the kind of bidding that a conference implements for reviewers (who bid for proposed papers)&lt;br /&gt;
* The other requirements are extending the above idea to get new features or an improved algorithm. We discuss these in more detail below. &lt;br /&gt;
&lt;br /&gt;
===Existing Algorithm===&lt;br /&gt;
A course consists of following users: Students, Teacher&lt;br /&gt;
&lt;br /&gt;
Course Project: Students must form teams of a Maximum size M1 and complete the Course Project(s) during the course, guided by the teacher&lt;br /&gt;
&lt;br /&gt;
Selecting topics:&lt;br /&gt;
* Teacher puts out a list of available project topics (let number of topics be N)&lt;br /&gt;
* Making a Preference List with minimum 1 topic, maximum M2 topics: &lt;br /&gt;
** Individual Students (who have not formed teams) make a list of topics they (individually) prefer. &lt;br /&gt;
** Or Every paired teams makes a (combined common) list. &lt;br /&gt;
* Bidding Priority Assignment is as follows:&lt;br /&gt;
    For every topic j : &lt;br /&gt;
       For every position i that topic j can be placed in (any) preference list:&lt;br /&gt;
              Let S(i) = number of students who selected topic j at position i of their (individual) preference list&lt;br /&gt;
              B(i) = 1/S(i)           &lt;br /&gt;
              C(i,j) = 1N*i=1N(M1 -S(i) ) &lt;br /&gt;
              Weight(i,j) = B(i) / C(i,j)&lt;br /&gt;
* Graph drawing is as follows: Draw a graph for every topic j with X axis as the priority position i and the Y axis as the Weights&lt;br /&gt;
* Selecting the topic for the team: A topic can at maximum be assigned only to one team. Some topics may be unassigned&lt;br /&gt;
** Use Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M1 students per team;&lt;br /&gt;
** In case of several students (greater then M1 in number) are together in one cluster, select those students into a team which have collaborated before.  &lt;br /&gt;
** In each graph, only one team will be selected as per the above parameters &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Subsequent Discussion===&lt;br /&gt;
Because the two situations are similar, it was hoped that the conference bidding would call the code of the (existing) assignment bidding. It was also hoped that the conference bidding would be modified to make it more general.&lt;br /&gt;
&lt;br /&gt;
However, in a subsequent meeting with the mentor, it was found that the two bidding algorithms are incompatible.  The existing algorithm will not work for conference bidding are:&lt;br /&gt;
* Team based versus Individual based: The existing algoritm is designed to assign topics to teams, whereas we have to assign topics to individuals&lt;br /&gt;
* The current bidding implementation only returns one bidding result (per graph) each time, whereas expected bidding implementation must be able to return multiple bidding results every time.&lt;br /&gt;
* In the case of a priority tie, the current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will not work for a conference bidding since now there is no collaboration in conference paper review.&lt;br /&gt;
&lt;br /&gt;
In addition since the existing algorithm is partly running on a web-service we cannot directly modify, it will be difficult to modify the code for the conference requirements and later integrate the two.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The changes related to this project are required for reviewing conference papers and journals. The users are able to submit their works as either individuals or teams to be scrutinized. The other participants are allowed to review the papers of their interest from the list of submitted papers. The participants are allowed to bid on the papers of their preference in a preference list with the top most entry taking the highest priority. The bidding algorithm already exists as called by a web service in Peerlogic. The goal of this project is to generalize the algorithm for both review and topic based bidding.&lt;br /&gt;
&lt;br /&gt;
===Test &lt;br /&gt;
The existing bidding algorithm used by the application is only available for team assignment bidding. The algorithm itself groups all team members preferring specific topic together, then evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of resulted evaluation for assigning topics.&lt;br /&gt;
&lt;br /&gt;
====Bidding Algorithm Overview====&lt;br /&gt;
&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Our goal here is as follows: &lt;br /&gt;
* To implement a bidding algorithm for conference paper reviewer assignment functionality.&lt;br /&gt;
* To attempt to merge the existing and the new algorithm as much as possible&lt;br /&gt;
&lt;br /&gt;
====Possible Extension====&lt;br /&gt;
&lt;br /&gt;
A possible extension is to combine reviewer assignment by bidding with one of the other assignment methods--instructor assignment, or “automated” assignment, where each new reviewer is assigned one of the least-reviewed submissions so far.  In this case, submissions that are not bid upon would be assigned to reviewers who “show up later,” as would reviews that are not completed by the reviewers who bid on them.&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
==Files to be Modified==&lt;br /&gt;
&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
&lt;br /&gt;
  def run_intelligent_assignment&lt;br /&gt;
    priority_info = []&lt;br /&gt;
    assignment = Assignment.find_by(id: params[:id])&lt;br /&gt;
    topics = assignment.sign_up_topics&lt;br /&gt;
    teams = assignment.teams&lt;br /&gt;
    teams.each do |team|&lt;br /&gt;
      # grab student id and list of bids&lt;br /&gt;
      bids = []&lt;br /&gt;
      topics.each do |topic|&lt;br /&gt;
        bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)&lt;br /&gt;
        bids &amp;lt;&amp;lt; (bid_record.nil? ? 0 : bid_record.priority ||= 0)&lt;br /&gt;
      end&lt;br /&gt;
      team.users.each { |user| priority_info &amp;lt;&amp;lt; { pid: user.id, ranks: bids } if bids.uniq != [0] }&lt;br /&gt;
    end&lt;br /&gt;
    data = { users: priority_info, max_team_size: assignment.max_team_size }&lt;br /&gt;
    url = WEBSERVICE_CONFIG[&amp;quot;topic_bidding_webservice_url&amp;quot;]&lt;br /&gt;
    begin&lt;br /&gt;
      response = RestClient.post url, data.to_json, content_type: :json, accept: :json&lt;br /&gt;
      # store each summary in a hashmap and use the question as the key&lt;br /&gt;
      teams = JSON.parse(response)[&amp;quot;teams&amp;quot;]&lt;br /&gt;
      create_new_teams_for_bidding_response(teams, assignment)&lt;br /&gt;
      run_intelligent_bid(assignment)&lt;br /&gt;
    rescue =&amp;gt; err&lt;br /&gt;
      flash[:error] = err.message&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
====Manual Testing====&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
====Automated Test Cases====&lt;br /&gt;
* TDD and Feature Test cases to be written.&lt;br /&gt;
&lt;br /&gt;
=====Edge cases=====&lt;br /&gt;
&lt;br /&gt;
* Case 1: Users signing up after bidding is done need to be assigned the papers/journals with no or least reviews done.&lt;br /&gt;
&lt;br /&gt;
* Case 2: Extending edge case 1, if somebody doesn't provide a list of topics s(he) wants to review, the topic with the least number of bids is assigned.&lt;br /&gt;
&lt;br /&gt;
* Case 3: If a participant is assigned to review a paper in the (topics) preference list but decides to drop the review after the bidding process is done.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113222</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113222"/>
		<updated>2017-11-14T09:45:08Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
====Description of project====&lt;br /&gt;
&lt;br /&gt;
Expertiza provides a way for students to bid on different topics for proposed assignment topics. This allows the fair topic distribution among students when multiple students or groups are bidding on same topic or paper.&lt;br /&gt;
&lt;br /&gt;
The changes related to this project are required for reviewing conference papers and journals. The users are able to submit their works as either individuals or teams to be scrutinized. The other participants are allowed to review the papers of their interest from the list of submitted papers. The participants are allowed to bid on the papers of their preference in a preference list with the top most entry taking the highest priority. The bidding algorithm already exists as called by a web service in Peerlogic. The goal of this project is to generalize the algorithm for both review and topic based bidding.&lt;br /&gt;
&lt;br /&gt;
====Bidding Algorithm Overview====&lt;br /&gt;
&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
* Reviews are often assigned by having reviewers bid on papers they want to review.  This is very similar to the kind of bidding that Expertiza implements for topics, and it should be possible to call the same code (which will be modified to make it more general).&lt;br /&gt;
&lt;br /&gt;
* The reviewer bidding for proposed conference papers has not been fully implemented. Currently the bidding process for assigning topics is either manual or automatic. Manual means the instructor assigns topics based on the preference provided by the students.  Automatic assignment means that topics are assigned on the basis of an implemented algorithm, which takes into account some parameters, including intelligent-property.&lt;br /&gt;
&lt;br /&gt;
* Incompatible bidding algorithm. The existing bidding algorithm used by the application is only available for team assignment bidding. The algorithm itself groups all team members preferring specific topic together, then evaluates how frequently these people have worked together in the past through concept of top-trading cycle and obtains the k-mean distribution of resulted evaluation for assigning topics. This algorithm will not work on our implementation for several reasons:&lt;br /&gt;
      1. It is team-based where as our implementation is individual-based. Since the implementation is running on a web-service, we won't &lt;br /&gt;
         be able to modify it as it is not an internal part of Expertiza application;&lt;br /&gt;
      2. The current bidding implementation only returns one bidding result each time, whereas expected bidding implementation must be able &lt;br /&gt;
         to return multiple bidding results every time.&lt;br /&gt;
      3. The current bidding algorithm assigns topic to bidding team that has most members whom have worked together in the past. This will &lt;br /&gt;
         work for our implementation since now each bidding team would only have one person.&lt;br /&gt;
&lt;br /&gt;
Our goal here is as follows: &lt;br /&gt;
* To implement a bidding algorithm for conference paper reviewer assignment functionality.&lt;br /&gt;
* To attempt to merge the existing and the new algorithm as much as possible&lt;br /&gt;
&lt;br /&gt;
====Possible Extension====&lt;br /&gt;
&lt;br /&gt;
A possible extension is to combine reviewer assignment by bidding with one of the other assignment methods--instructor assignment, or “automated” assignment, where each new reviewer is assigned one of the least-reviewed submissions so far.  In this case, submissions that are not bid upon would be assigned to reviewers who “show up later,” as would reviews that are not completed by the reviewers who bid on them.&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
==Files to be Modified==&lt;br /&gt;
&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* New Controller to be specified for review bidding&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
====Manual Testing====&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
====Automated Test Cases====&lt;br /&gt;
* TDD and Feature Test cases to be written.&lt;br /&gt;
&lt;br /&gt;
=====Edge cases=====&lt;br /&gt;
&lt;br /&gt;
* Case 1: Users signing up after bidding is done need to be assigned the papers/journals with no or least reviews done.&lt;br /&gt;
&lt;br /&gt;
* Case 2: Extending edge case 1, if somebody doesn't provide a list of topics s(he) wants to review, the topic with the least number of bids is assigned.&lt;br /&gt;
&lt;br /&gt;
* Case 3: If a participant is assigned to review a paper in the (topics) preference list but decides to drop the review after the bidding process is done.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113221</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113221"/>
		<updated>2017-11-14T09:05:20Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Bidding Algorithm Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
====Description of project====&lt;br /&gt;
&lt;br /&gt;
Expertiza provides a way for students to bid on different topics for proposed assignment topics. This allows the fair topic distribution among students when multiple students or groups are bidding on same topic or paper.&lt;br /&gt;
&lt;br /&gt;
The changes related to this project are required for reviewing conference papers and journals. The users are able to submit their works as either individuals or teams to be scrutinized. The other participants are allowed to review the papers of their interest from the list of submitted papers. The participants are allowed to bid on the papers of their preference in a preference list with the top most entry taking the highest priority. The bidding algorithm already exists as called by a web service in Peerlogic. The goal of this project is to generalize the algorithm for both review and topic based bidding.&lt;br /&gt;
&lt;br /&gt;
====Bidding Algorithm Overview====&lt;br /&gt;
&lt;br /&gt;
Currently, the Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
* Reviews are often assigned by having reviewers bid on papers they want to review.  This is very similar to the kind of bidding that Expertiza implements for topics, and it should be possible to call the same code (which will be modified to make it more general).&lt;br /&gt;
&lt;br /&gt;
* The reviewer bidding for proposed conference papers has not been fully implemented. Currently the bidding process for assigning topics is either manual or automatic. Manual means the instructor assigns topics based on the preference provided by the students.  Automatic assignment means that topics are assigned on the basis of an implemented algorithm, which takes into account some parameters, including intelligent-property.&lt;br /&gt;
&lt;br /&gt;
Our goal here is as follows: &lt;br /&gt;
* To implement a bidding algorithm for conference paper reviewer assignment functionality.&lt;br /&gt;
* To attempt to merge the existing and the new algorithm as much as possible&lt;br /&gt;
&lt;br /&gt;
====Possible Extension====&lt;br /&gt;
&lt;br /&gt;
A possible extension is to combine reviewer assignment by bidding with one of the other assignment methods--instructor assignment, or “automated” assignment, where each new reviewer is assigned one of the least-reviewed submissions so far.  In this case, submissions that are not bid upon would be assigned to reviewers who “show up later,” as would reviews that are not completed by the reviewers who bid on them.&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
==Files to be Modified==&lt;br /&gt;
&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* New Controller to be specified for review bidding&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
====Manual Testing====&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
====Automated Test Cases====&lt;br /&gt;
* TDD and Feature Test cases to be written.&lt;br /&gt;
&lt;br /&gt;
=====Edge cases=====&lt;br /&gt;
&lt;br /&gt;
* Case 1: Users signing up after bidding is done need to be assigned the papers/journals with no or least reviews done.&lt;br /&gt;
&lt;br /&gt;
* Case 2: Extending edge case 1, if somebody doesn't provide a list of topics s(he) wants to review, the topic with the least number of bids is assigned.&lt;br /&gt;
&lt;br /&gt;
* Case 3: If a participant is assigned to review a paper in the (topics) preference list but decides to drop the review after the bidding process is done.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113220</id>
		<title>CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E17A7_Allow_Reviewers_to_bid_on_what_to_review&amp;diff=113220"/>
		<updated>2017-11-14T09:04:15Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Bidding Algorithm Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
====Description of project====&lt;br /&gt;
&lt;br /&gt;
Expertiza provides a way for students to bid on different topics for proposed assignment topics. This allows the fair topic distribution among students when multiple students or groups are bidding on same topic or paper.&lt;br /&gt;
&lt;br /&gt;
The changes related to this project are required for reviewing conference papers and journals. The users are able to submit their works as either individuals or teams to be scrutinized. The other participants are allowed to review the papers of their interest from the list of submitted papers. The participants are allowed to bid on the papers of their preference in a preference list with the top most entry taking the highest priority. The bidding algorithm already exists as called by a web service in Peerlogic. The goal of this project is to generalize the algorithm for both review and topic based bidding.&lt;br /&gt;
&lt;br /&gt;
====Bidding Algorithm Overview====&lt;br /&gt;
=====Current Bidding Algorithm=====&lt;br /&gt;
The Bidding algorithm implementation is based on k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. The approach to meeting these criteria is addressed by mining student preferences for topics with a clustering approach, and then matching them in groups to topics that suit their shared interests. You can read about it in detail [https://docs.google.com/document/d/1hyJjqfdSPi0NjzLFygUodVLVqABIE2Lu-RBDMkUDvUs/edit?usp=sharing| here].&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
* Reviews are often assigned by having reviewers bid on papers they want to review.  This is very similar to the kind of bidding that Expertiza implements for topics, and it should be possible to call the same code (which will be modified to make it more general).&lt;br /&gt;
&lt;br /&gt;
* The reviewer bidding for proposed conference papers has not been fully implemented. Currently the bidding process for assigning topics is either manual or automatic. Manual means the instructor assigns topics based on the preference provided by the students.  Automatic assignment means that topics are assigned on the basis of an implemented algorithm, which takes into account some parameters, including intelligent-property.&lt;br /&gt;
&lt;br /&gt;
Our goal here is as follows: &lt;br /&gt;
* To implement a bidding algorithm for conference paper reviewer assignment functionality.&lt;br /&gt;
* To attempt to merge the existing and the new algorithm as much as possible&lt;br /&gt;
&lt;br /&gt;
====Possible Extension====&lt;br /&gt;
&lt;br /&gt;
A possible extension is to combine reviewer assignment by bidding with one of the other assignment methods--instructor assignment, or “automated” assignment, where each new reviewer is assigned one of the least-reviewed submissions so far.  In this case, submissions that are not bid upon would be assigned to reviewers who “show up later,” as would reviews that are not completed by the reviewers who bid on them.&lt;br /&gt;
&lt;br /&gt;
==Use Case Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:UML_01.png]]&lt;br /&gt;
&lt;br /&gt;
==Files to be Modified==&lt;br /&gt;
&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* New Controller to be specified for review bidding&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
====Manual Testing====&lt;br /&gt;
* UI testing of the implemented functionality to be done.&lt;br /&gt;
&lt;br /&gt;
====Automated Test Cases====&lt;br /&gt;
* TDD and Feature Test cases to be written.&lt;br /&gt;
&lt;br /&gt;
=====Edge cases=====&lt;br /&gt;
&lt;br /&gt;
* Case 1: Users signing up after bidding is done need to be assigned the papers/journals with no or least reviews done.&lt;br /&gt;
&lt;br /&gt;
* Case 2: Extending edge case 1, if somebody doesn't provide a list of topics s(he) wants to review, the topic with the least number of bids is assigned.&lt;br /&gt;
&lt;br /&gt;
* Case 3: If a participant is assigned to review a paper in the (topics) preference list but decides to drop the review after the bidding process is done.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=112008</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=112008"/>
		<updated>2017-11-06T19:40:52Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error_1787.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
Git Original link&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
Git Revised link&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza/tree/Bronzeproject&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores are not calculated on dividing with total reviews given, instead calculated using total non null reviews given. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Pattern Usage  ==&lt;br /&gt;
We implemented using the MVC (Model View Controller) pattern. We felt it was the pattern used in expertiza , usage of same pattern would be much easier.&lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average (vm_q1 object);&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation (vm_q2 object).&lt;br /&gt;
&lt;br /&gt;
In addition, we have also tested the initialization of VmQuestionResponseRow object with 5 parameters and 6 parameters to ensure the initialization process works as intended (see in code for vm_q1 and vm_q3 objects). However, due to decrease in coverage for the test (after we added it, the coverage dropped by 0.4%), we have reverted it back to original 2 test cases. The additional test cases can be found below in snapshots, and original test cases with highest coverage in on github.&lt;br /&gt;
&lt;br /&gt;
test file: vm_question_response_rows_spec.rb;&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, the topic is fixing and modification on Expertize team score calculation mechanism. For this project, a meeting once every week for 2 weeks with TA was proceeded. The main focus for the first one and half week involves setting up the environment on the machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, which were solved through file tracing, problem identifying, and debugging. For the rest of these a little over 2 weeks period, several issues were identified with the project. The main issue for program include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, it was identified that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Comparison of code changes can be seen in Pull request.&lt;br /&gt;
&lt;br /&gt;
The issue can be solved by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below (note: not_null_reviews.zero? check are used two times in order to pass the github check on coding, as combining these two lines into one (row_average_score = (row_average_score / not_null_reviews).round(2) unless not_null_reviews.zero?) would resulting in failing on github check, while the other solution which is putting both line into an unless block would not have any benefit execution efficiency wise).&lt;br /&gt;
&lt;br /&gt;
Code after first modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Code after second modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code_2.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where an extra parameter - score row - is needed during object initialization process. It would be a more efficient constructor to use when retrieving scores from database as it allows program to initialize a VmQuestionResponseRow object now with a list of AssignmentScore objects instead of having to initialize to an empty list and putting in AssignmentScore objects one by one through a loop. (Note: the implementation for using constructor with extra parameter in project is not implemented as it is originally not part of our requirement)&lt;br /&gt;
&lt;br /&gt;
== Test implementation ==&lt;br /&gt;
&lt;br /&gt;
Afterward, several tests were performed for the model class modifications using RSpec, with some of the code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:rspec1787_1.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:rspec1787_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:rspec1787_3.png]]&lt;br /&gt;
&lt;br /&gt;
For this project, techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc, were used.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=112007</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=112007"/>
		<updated>2017-11-06T19:39:48Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error_1787.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
Git Original link&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
Git Revised link&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza/tree/Bronzeproject&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores are not calculated on dividing with total reviews given, instead calculated using total non null reviews given. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Pattern Usage  ==&lt;br /&gt;
We implemented using the MVC (Model View Controller) pattern. We felt it was the pattern used in expertiza , usage of same pattern would be much easier.&lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average (vm_q1 object);&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation (vm_q2 object).&lt;br /&gt;
&lt;br /&gt;
In addition, we have also tested the initialization of VmQuestionResponseRow object with 5 parameters and 6 parameters to ensure the initialization process works as intended (see in code for vm_q1 and vm_q3 objects). However, due to decrease in coverage for the test (after we added it, the coverage dropped by 0.4%), we have reverted it back to original 2 test cases.&lt;br /&gt;
&lt;br /&gt;
test file: vm_question_response_rows_spec.rb;&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, the topic is fixing and modification on Expertize team score calculation mechanism. For this project, a meeting once every week for 2 weeks with TA was proceeded. The main focus for the first one and half week involves setting up the environment on the machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, which were solved through file tracing, problem identifying, and debugging. For the rest of these a little over 2 weeks period, several issues were identified with the project. The main issue for program include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, it was identified that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Comparison of code changes can be seen in Pull request.&lt;br /&gt;
&lt;br /&gt;
The issue can be solved by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below (note: not_null_reviews.zero? check are used two times in order to pass the github check on coding, as combining these two lines into one (row_average_score = (row_average_score / not_null_reviews).round(2) unless not_null_reviews.zero?) would resulting in failing on github check, while the other solution which is putting both line into an unless block would not have any benefit execution efficiency wise).&lt;br /&gt;
&lt;br /&gt;
Code after first modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Code after second modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code_2.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where an extra parameter - score row - is needed during object initialization process. It would be a more efficient constructor to use when retrieving scores from database as it allows program to initialize a VmQuestionResponseRow object now with a list of AssignmentScore objects instead of having to initialize to an empty list and putting in AssignmentScore objects one by one through a loop. (Note: the implementation for using constructor with extra parameter in project is not implemented as it is originally not part of our requirement)&lt;br /&gt;
&lt;br /&gt;
== Test implementation ==&lt;br /&gt;
&lt;br /&gt;
Afterward, several tests were performed for the model class modifications using RSpec, with some of the code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:rspec1787_1.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:rspec1787_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:rspec1787_3.png]]&lt;br /&gt;
&lt;br /&gt;
For this project, techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc, were used.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=112006</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=112006"/>
		<updated>2017-11-06T19:25:49Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Test implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error_1787.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
Git Original link&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
Git Revised link&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza/tree/Bronzeproject&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores are not calculated on dividing with total reviews given, instead calculated using total non null reviews given. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Pattern Usage  ==&lt;br /&gt;
We implemented using the MVC (Model View Controller) pattern. We felt it was the pattern used in expertiza , usage of same pattern would be much easier.&lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average (vm_q1 object);&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation (vm_q2 object).&lt;br /&gt;
&lt;br /&gt;
In addition, we have also tested the initialization of VmQuestionResponseRow object with 5 parameters and 6 parameters to ensure the initialization process works as intended (see in code for vm_q1 and vm_q3 objects).&lt;br /&gt;
&lt;br /&gt;
test file: vm_question_response_rows_spec.rb;&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, the topic is fixing and modification on Expertize team score calculation mechanism. For this project, a meeting once every week for 2 weeks with TA was proceeded. The main focus for the first one and half week involves setting up the environment on the machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, which were solved through file tracing, problem identifying, and debugging. For the rest of these a little over 2 weeks period, several issues were identified with the project. The main issue for program include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, it was identified that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Comparison of code changes can be seen in Pull request.&lt;br /&gt;
&lt;br /&gt;
The issue can be solved by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below (note: not_null_reviews.zero? check are used two times in order to pass the github check on coding, as combining these two lines into one (row_average_score = (row_average_score / not_null_reviews).round(2) unless not_null_reviews.zero?) would resulting in failing on github check, while the other solution which is putting both line into an unless block would not have any benefit execution efficiency wise).&lt;br /&gt;
&lt;br /&gt;
Code after first modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Code after second modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code_2.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where an extra parameter - score row - is needed during object initialization process. It would be a more efficient constructor to use when retrieving scores from database as it allows program to initialize a VmQuestionResponseRow object now with a list of AssignmentScore objects instead of having to initialize to an empty list and putting in AssignmentScore objects one by one through a loop. (Note: the implementation for using constructor with extra parameter in project is not implemented as it is originally not part of our requirement)&lt;br /&gt;
&lt;br /&gt;
== Test implementation ==&lt;br /&gt;
&lt;br /&gt;
Afterward, several tests were performed for the model class modifications using RSpec, with some of the code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:rspec1787_1.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:rspec1787_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:rspec1787_3.png]]&lt;br /&gt;
&lt;br /&gt;
For this project, techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc, were used.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Rspec1787_3.png&amp;diff=112005</id>
		<title>File:Rspec1787 3.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Rspec1787_3.png&amp;diff=112005"/>
		<updated>2017-11-06T19:25:07Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Rspec1787_2.png&amp;diff=112004</id>
		<title>File:Rspec1787 2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Rspec1787_2.png&amp;diff=112004"/>
		<updated>2017-11-06T19:24:58Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Rspec1787_1.png&amp;diff=112003</id>
		<title>File:Rspec1787 1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Rspec1787_1.png&amp;diff=112003"/>
		<updated>2017-11-06T19:24:07Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=112002</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=112002"/>
		<updated>2017-11-06T19:18:25Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error_1787.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
Git Original link&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
Git Revised link&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza/tree/Bronzeproject&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores are not calculated on dividing with total reviews given, instead calculated using total non null reviews given. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Pattern Usage  ==&lt;br /&gt;
We implemented using the MVC (Model View Controller) pattern. We felt it was the pattern used in expertiza , usage of same pattern would be much easier.&lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average (vm_q1 object);&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation (vm_q2 object).&lt;br /&gt;
&lt;br /&gt;
In addition, we have also tested the initialization of VmQuestionResponseRow object with 5 parameters and 6 parameters to ensure the initialization process works as intended (see in code for vm_q1 and vm_q3 objects).&lt;br /&gt;
&lt;br /&gt;
test file: vm_question_response_rows_spec.rb;&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, the topic is fixing and modification on Expertize team score calculation mechanism. For this project, a meeting once every week for 2 weeks with TA was proceeded. The main focus for the first one and half week involves setting up the environment on the machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, which were solved through file tracing, problem identifying, and debugging. For the rest of these a little over 2 weeks period, several issues were identified with the project. The main issue for program include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, it was identified that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Comparison of code changes can be seen in Pull request.&lt;br /&gt;
&lt;br /&gt;
The issue can be solved by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below (note: not_null_reviews.zero? check are used two times in order to pass the github check on coding, as combining these two lines into one (row_average_score = (row_average_score / not_null_reviews).round(2) unless not_null_reviews.zero?) would resulting in failing on github check, while the other solution which is putting both line into an unless block would not have any benefit execution efficiency wise).&lt;br /&gt;
&lt;br /&gt;
Code after first modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Code after second modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code_2.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where an extra parameter - score row - is needed during object initialization process. It would be a more efficient constructor to use when retrieving scores from database as it allows program to initialize a VmQuestionResponseRow object now with a list of AssignmentScore objects instead of having to initialize to an empty list and putting in AssignmentScore objects one by one through a loop. (Note: the implementation for using constructor with extra parameter in project is not implemented as it is originally not part of our requirement)&lt;br /&gt;
&lt;br /&gt;
== Test implementation ==&lt;br /&gt;
&lt;br /&gt;
Afterward, several tests were performed for the model class modifications using RSpec, with some of the code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Rspec123.png|center]]&lt;br /&gt;
&lt;br /&gt;
For this project, techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc, were used.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=112001</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=112001"/>
		<updated>2017-11-06T19:12:53Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Our Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error_1787.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
Git Original link&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
Git Revised link&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza/tree/Bronzeproject&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores are not calculated on dividing with total reviews given, instead calculated using total non null reviews given. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Pattern Usage  ==&lt;br /&gt;
We implemented using the MVC (Model View Controller) pattern. We felt it was the pattern used in expertiza , usage of same pattern would be much easier.&lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average;&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation.&lt;br /&gt;
&lt;br /&gt;
In addition, we have also tested the initialization of VmQuestionResponseRow object with 5 parameters and 6 parameters to ensure the initialization process works as intended (see code).&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, the topic is fixing and modification on Expertize team score calculation mechanism. For this project, a meeting once every week for 2 weeks with TA was proceeded. The main focus for the first one and half week involves setting up the environment on the machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, which were solved through file tracing, problem identifying, and debugging. For the rest of these a little over 2 weeks period, several issues were identified with the project. The main issue for program include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, it was identified that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Comparison of code changes can be seen in Pull request.&lt;br /&gt;
&lt;br /&gt;
The issue can be solved by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below (note: not_null_reviews.zero? check are used two times in order to pass the github check on coding, as combining these two lines into one (row_average_score = (row_average_score / not_null_reviews).round(2) unless not_null_reviews.zero?) would resulting in failing on github check, while the other solution which is putting both line into an unless block would not have any benefit execution efficiency wise).&lt;br /&gt;
&lt;br /&gt;
Code after first modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Code after second modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code_2.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where an extra parameter - score row - is needed during object initialization process. It would be a more efficient constructor to use when retrieving scores from database as it allows program to initialize a VmQuestionResponseRow object now with a list of AssignmentScore objects instead of having to initialize to an empty list and putting in AssignmentScore objects one by one through a loop. (Note: the implementation for using constructor with extra parameter in project is not implemented as it is originally not part of our requirement)&lt;br /&gt;
&lt;br /&gt;
== Test implementation ==&lt;br /&gt;
&lt;br /&gt;
Afterward, several tests were performed for the model class modifications using RSpec, with some of the code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Rspec123.png|center]]&lt;br /&gt;
&lt;br /&gt;
For this project, techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc, were used.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=111811</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=111811"/>
		<updated>2017-11-05T08:03:50Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Github Link */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error_1787.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
Git Original link&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
Git Revised link&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza/tree/Bronzeproject&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores are not calculated on dividing with total reviews given, instead calculated using total non null reviews given. &lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average;&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation.&lt;br /&gt;
&lt;br /&gt;
In addition, we have also tested the initialization of VmQuestionResponseRow object with 5 parameters and 6 parameters to ensure the initialization process works as intended (see code).&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, the topic is fixing and modification on Expertize team score calculation mechanism. For this project, a meeting once every week for 2 weeks with TA was proceeded. The main focus for the first one and half week involves setting up the environment on the machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, which were solved through file tracing, problem identifying, and debugging. For the rest of these a little over 2 weeks period, several issues were identified with the project. The main issue for program include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, it was identified that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Comparison of code changes can be seen in Pull request.&lt;br /&gt;
&lt;br /&gt;
The issue can be solved by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below (note: not_null_reviews.zero? check are used two times in order to pass the github check on coding, as combining these two lines into one (row_average_score = (row_average_score / not_null_reviews).round(2) unless not_null_reviews.zero?) would resulting in failing on github check, while the other solution which is putting both line into an unless block would not have any benefit execution efficiency wise).&lt;br /&gt;
&lt;br /&gt;
Code after first modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Code after second modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code_2.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where if specific score given is over certain upper-limit x or lower-limit y, the score will be automatically reset to x or y accordingly so that the score will alway be in between x and y. &lt;br /&gt;
&lt;br /&gt;
Afterward, several tests were performed for the model class modifications using RSpec, with some of the code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Rspec123.png|center]]&lt;br /&gt;
&lt;br /&gt;
For this project, techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc, were used.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=111810</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=111810"/>
		<updated>2017-11-05T00:17:39Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Our Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error_1787.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores are not calculated on dividing with total reviews given, instead calculated using total non null reviews given. &lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average;&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation.&lt;br /&gt;
&lt;br /&gt;
In addition, we have also tested the initialization of VmQuestionResponseRow object with 5 parameters and 6 parameters to ensure the initialization process works as intended (see code).&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, the topic is fixing and modification on Expertize team score calculation mechanism. For this project, a meeting once every week for 2 weeks with TA was proceeded. The main focus for the first one and half week involves setting up the environment on the machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, which were solved through file tracing, problem identifying, and debugging. For the rest of these a little over 2 weeks period, several issues were identified with the project. The main issue for program include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, it was identified that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Comparison of code changes can be seen in Pull request.&lt;br /&gt;
&lt;br /&gt;
The issue can be solved by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below (note: not_null_reviews.zero? check are used two times in order to pass the github check on coding, as combining these two lines into one (row_average_score = (row_average_score / not_null_reviews).round(2) unless not_null_reviews.zero?) would resulting in failing on github check, while the other solution which is putting both line into an unless block would not have any benefit execution efficiency wise).&lt;br /&gt;
&lt;br /&gt;
Code after first modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Code after second modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code_2.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where if specific score given is over certain upper-limit x or lower-limit y, the score will be automatically reset to x or y accordingly so that the score will alway be in between x and y. &lt;br /&gt;
&lt;br /&gt;
Afterward, several tests were performed for the model class modifications using RSpec, with some of the code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Rspec123.png|center]]&lt;br /&gt;
&lt;br /&gt;
For this project, techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc, were used.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=111809</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=111809"/>
		<updated>2017-11-05T00:11:59Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Our Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error_1787.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores are not calculated on dividing with total reviews given, instead calculated using total non null reviews given. &lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average;&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation.&lt;br /&gt;
&lt;br /&gt;
In addition, we have also tested the initialization of VmQuestionResponseRow object with 5 parameters and 6 parameters to ensure the initialization process works as intended (see code).&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, the topic is fixing and modification on Expertize team score calculation mechanism. For this project, we have meet once every week for 2 weeks either with TA. For the first one and half week, each of us has set up the environment on the machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, and we worked together to identify the issues and finding ways to get around them. For the rest of these a little over 2 weeks period, we have identified several issues with the project. The main issue for program include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, we found that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Comparison of code changes can be seen in Pull request.&lt;br /&gt;
&lt;br /&gt;
The issue can be solved by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below (note: not_null_reviews.zero? check are used two times in order to pass the github check on coding, as combining these two lines into one (row_average_score = (row_average_score / not_null_reviews).round(2) unless not_null_reviews.zero?) would resulting in failing on github check, while the other solution which is putting both line into an unless block would not have any benefit execution efficiency wise).&lt;br /&gt;
&lt;br /&gt;
Code after first modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Code after second modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code_2.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where if specific score given is over certain upper-limit x or lower-limit y, the score will be automatically reset to x or y accordingly so that the score will alway be in between x and y. &lt;br /&gt;
&lt;br /&gt;
Afterward, we have testing the model class modifications using RSpec, with code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Rspec123.png|center]]&lt;br /&gt;
&lt;br /&gt;
For this project, we have used techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=111808</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=111808"/>
		<updated>2017-11-05T00:06:29Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Our Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error_1787.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores are not calculated on dividing with total reviews given, instead calculated using total non null reviews given. &lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average;&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation.&lt;br /&gt;
&lt;br /&gt;
In addition, we have also tested the initialization of VmQuestionResponseRow object with 5 parameters and 6 parameters to ensure the initialization process works as intended (see code).&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, our topic is fixing and modification on Expertize team score calculation mechanism. For this project, we have meet once every week for 2 weeks either with TA. For the first one and half week, each of us has set up the environment on our machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, and we worked together to identify the issues and finding ways to get around them. For the rest of these a little over 2 weeks period, we have identified several issues with our project. The main issue for our part include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, we found that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Comparison of code changes can be seen in Pull request.&lt;br /&gt;
&lt;br /&gt;
We proceeded to solve the issue by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below (note: we used: not_null_review.zero? check two times in order to pass the github check on coding, as combining these two lines into one would resulting in failing on github check).&lt;br /&gt;
&lt;br /&gt;
Code after first modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Code after second modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code_2.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where if specific score given is over certain upper-limit x or lower-limit y, the score will be automatically reset to x or y accordingly so that the score will alway be in between x and y. &lt;br /&gt;
&lt;br /&gt;
Afterward, we have testing the model class modifications using RSpec, with code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Rspec123.png|center]]&lt;br /&gt;
&lt;br /&gt;
For this project, we have used techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=111807</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=111807"/>
		<updated>2017-11-05T00:01:19Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error_1787.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores are not calculated on dividing with total reviews given, instead calculated using total non null reviews given. &lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average;&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation.&lt;br /&gt;
&lt;br /&gt;
In addition, we have also tested the initialization of VmQuestionResponseRow object with 5 parameters and 6 parameters to ensure the initialization process works as intended (see code).&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, our topic is fixing and modification on Expertize team score calculation mechanism. For this project, we have meet once every week for 2 weeks either with TA. For the first one and half week, each of us has set up the environment on our machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, and we worked together to identify the issues and finding ways to get around them. For the rest of these a little over 2 weeks period, we have identified several issues with our project. The main issue for our part include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, we found that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Comparison of code changes can be seen in Pull request.&lt;br /&gt;
&lt;br /&gt;
We proceeded to solve the issue by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below:&lt;br /&gt;
&lt;br /&gt;
Code after first modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Code after second modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code_2.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where if specific score given is over certain upper-limit x or lower-limit y, the score will be automatically reset to x or y accordingly so that the score will alway be in between x and y. &lt;br /&gt;
&lt;br /&gt;
Afterward, we have testing the model class modifications using RSpec, with code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Rspec123.png|center]]&lt;br /&gt;
&lt;br /&gt;
For this project, we have used techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc.&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=109622</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=109622"/>
		<updated>2017-10-27T01:35:34Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
===Github Link===&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, our topic is fixing and modification on Expertize team score calculation mechanism. For this project, we have meet once every week for 2 weeks either with TA. For the first one and half week, each of us has set up the environment on our machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, and we worked together to identify the issues and finding ways to get around them. For the rest of these a little over 2 weeks period, we have identified the issues with our project. The main issue for our part include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, we found that the reason for such issue involves … (code/file part that is not working correctly and why its behavior is not wanted) ... . Our proposed solution for issue is … (proposed solution here) … . This will involve skills we have learned in class such as unit testing using …(expand on skills) … .&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=109621</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=109621"/>
		<updated>2017-10-27T01:32:34Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, our topic is fixing and modification on Expertize team score calculation mechanism. For this project, we have meet once every week for 2 weeks either with TA. For the first one and half week, each of us has set up the environment on our machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, and we worked together to identify the issues and finding ways to get around them. For the rest of these a little over 2 weeks period, we have identified the issues with our project. The main issue for our part include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, we found that the reason for such issue involves … (code/file part that is not working correctly and why its behavior is not wanted) ... . Our proposed solution for issue is … (proposed solution here) … . This will involve skills we have learned in class such as unit testing using …(expand on skills) … .&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=109620</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=109620"/>
		<updated>2017-10-27T01:30:27Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Introduction]]&lt;br /&gt;
[[Scenario]]&lt;br /&gt;
[[Solution]]&lt;br /&gt;
[[Our Work]]&lt;br /&gt;
Introduction:&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scenario:&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Solution:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Our Work:&lt;br /&gt;
&lt;br /&gt;
For the OSS project, our topic is fixing and modification on Expertize team score calculation mechanism. For this project, we have meet once every week for 2 weeks either with TA. For the first one and half week, each of us has set up the environment on our machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, and we worked together to identify the issues and finding ways to get around them. For the rest of these a little over 2 weeks period, we have identified the issues with our project. The main issue for our part include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, we found that the reason for such issue involves … (code/file part that is not working correctly and why its behavior is not wanted) ... . Our proposed solution for issue is … (proposed solution here) … . This will involve skills we have learned in class such as unit testing using …(expand on skills) … .&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=109619</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=109619"/>
		<updated>2017-10-27T01:29:16Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Introduction]]&lt;br /&gt;
&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scenario:&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Solution:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Our Work:&lt;br /&gt;
&lt;br /&gt;
For the OSS project, our topic is fixing and modification on Expertize team score calculation mechanism. For this project, we have meet once every week for 2 weeks either with TA. For the first one and half week, each of us has set up the environment on our machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, and we worked together to identify the issues and finding ways to get around them. For the rest of these a little over 2 weeks period, we have identified the issues with our project. The main issue for our part include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, we found that the reason for such issue involves … (code/file part that is not working correctly and why its behavior is not wanted) ... . Our proposed solution for issue is … (proposed solution here) … . This will involve skills we have learned in class such as unit testing using …(expand on skills) … .&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=109618</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=109618"/>
		<updated>2017-10-27T01:27:21Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: Created page with &amp;quot;Introduction:  This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.   Scenario:  Sometimes when a reviewee of a project or homework ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Introduction:&lt;br /&gt;
&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scenario:&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Solution:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Our Work:&lt;br /&gt;
&lt;br /&gt;
For the OSS project, our topic is fixing and modification on Expertize team score calculation mechanism. For this project, we have meet once every week for 2 weeks either with TA. For the first one and half week, each of us has set up the environment on our machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, and we worked together to identify the issues and finding ways to get around them. For the rest of these a little over 2 weeks period, we have identified the issues with our project. The main issue for our part include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, we found that the reason for such issue involves … (code/file part that is not working correctly and why its behavior is not wanted) ... . Our proposed solution for issue is … (proposed solution here) … . This will involve skills we have learned in class such as unit testing using …(expand on skills) … .&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017&amp;diff=109617</id>
		<title>CSC/ECE 517 Fall 2017</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017&amp;diff=109617"/>
		<updated>2017-10-27T01:27:02Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Writing Assignment 2'''&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1779. Fix teammate advertisements and requests to join a team]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1773 Investigate and Fix Expertiza Production Version Runtime Exceptions.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1774 Metareview fixes and improvements.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1788 OSS project Maroon Heatmap fixes]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1781 Topic Management]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1745_Refactor_response_controller.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1752 Refactor assignments controller]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1776_Enhance_Imports]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1756 TLD Refactor response.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1772_Refactor reputation_web_service_controller.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/M1754_Mutation Testing on Servo]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1753 OSS project bidding tests]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1766_Test team functionality]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1787_OSS project Bronze Score calculations]]&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Lguo7&amp;diff=109616</id>
		<title>User:Lguo7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Lguo7&amp;diff=109616"/>
		<updated>2017-10-27T01:22:29Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: Blanked the page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Lguo7&amp;diff=109615</id>
		<title>User:Lguo7</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Lguo7&amp;diff=109615"/>
		<updated>2017-10-27T01:22:03Z</updated>

		<summary type="html">&lt;p&gt;Lguo7: Created page with &amp;quot;Introduction:  This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.   Scenario:  Sometimes when a reviewee of a project or homework ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Introduction:&lt;br /&gt;
&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scenario:&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Solution:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Our Work:&lt;br /&gt;
&lt;br /&gt;
For the OSS project, our topic is fixing and modification on Expertize team score calculation mechanism. For this project, we have meet once every week for 2 weeks either with TA. For the first one and half week, each of us has set up the environment on our machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, and we worked together to identify the issues and finding ways to get around them. For the rest of these a little over 2 weeks period, we have identified the issues with our project. The main issue for our part include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, we found that the reason for such issue involves … (code/file part that is not working correctly and why its behavior is not wanted) ... . Our proposed solution for issue is … (proposed solution here) … . This will involve skills we have learned in class such as unit testing using …(expand on skills) … .&lt;/div&gt;</summary>
		<author><name>Lguo7</name></author>
	</entry>
</feed>