I wonder how you organize the algorithm of the room assignment program using Python.

Asked 2 years ago, Updated 2 years ago, 23 views

I am currently living in a high school dormitory. Our school dormitory has desks arranged in the room, so if you share a room with friends who don't have a good sleep pattern, you can't sleep easily because of the light. Many of my friends are experiencing inconvenience due to the above problem, so I want to help them by making a program using Python, the only language I know. The program I want to make is a program that examines the sleeping hours of friends who use the dormitory and allocates rooms to friends who have similar sleeping hours!!

python

2022-09-22 14:47

2 Answers

If you assume that this is not a question that came up in a hurry because of a summer vacation assignment like "Solving Problems Around Us Through Programming," you truly believe that implementing a particular "Algorism" as "Python" will solve this problem...

...If so, the idea you mentioned is rather technocrity, so I hope you don't have to struggle with making such an algorithm in the first placeThere's an idea.

I personally want to argue that it's the principle of minimum technology estimation, and until you decide that any problem can only be solved through technology, you have to consider that it can be solved without technology -- with existing tools and social consultations. Developing an implementation that functions.Because solving problems is completely different, and usually the latter takes precedence over the former.

If this doesn't sound like a load of crap, think about it just once by applying that principle to this problem. But if you think Python is really necessary, I think it would be good if you could post a specific scenario again then.


2022-09-22 14:47

To suggest a very simple algorithm,

Each student's sleep pattern is expressed as a vector in time units.

The vector of students who sleep from 0 to 6 is It should be like (1,1,1,1,1,1,1,0,0,0,...).

If these data are collected, find a similar one of each vector and find the distance between Va and Vb. There can be many ways to get this distance. The simplest way to think about it is to find the magnitude of the Va-Vb vector. The difference between the vectors of student A sleeping from 1 to 6 and student B sleeping from 0 to 6 is (1, 0, 0, ... ) and this vector has a magnitude of 1.

If you can get distances in this way, you can take the one with the least sum of distances out of all the cases where you can combine two.


2022-09-22 14:47

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.