Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript Distribution Algorithm for people with voting opportunities

Juelz

New Coder
Hello everyone,
i have the following problem. I want to create an algorithm in Javascript that solves the following problem. At the moment I lack the solution.

There are 20 students in a university and there are 20 projects with different topics. Exactly one student can work on exactly one project.
There is an election to distribute the project topics, each student can choose three topics (first choice, second choice, third choice).
The votes have a weight. A student must choose three different projects with his votes.

Inputdata:
const userVoice = [
{id: 'user_one', choices: ['course_one', 'course_two', 'course_three']},
{id: 'user_two', choices: ['course_two', 'course_one', 'course_three']},
{id: 'user_three', choices: ['course_two', 'course_one', 'course_three']}
...]

const courses = [
{id: 'course_one'},
{id: 'course_two'},
{id: 'course_three'}
...]

The algorithm should evaluate the choice of projects and intelligently assign the students to the topics. The algorithm aims to get the best possible distribution (The majority of students get their first or second choice). For example, if student A is assigned to his third choice, 4 other students could get their first choice. Does anyone know how to write such an algorithm or what such an algorithm is called. Does anyone know how to write such an algorithm or what such an algorithm is called?
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom