السلام عليكم ورحمة الله وبركاته .....
تحية من أخوكم العضو الجديد I S
أخواني : لدي مشكلة أريد حلها بلغة ++C وسؤالها باللغة الانجليزية (مع ترجمة متواضعة بالعربية)
السؤال :
We want to design a lift manager, i.e. a system that manages the lift (ãÕÚÏ) of a given building. The building is composed of N floors (N=10 say). Users have Ids and are served with respect to their requested floor number. The behavior of the lift is described as follows: i. Going up (bottom-up): Suppose that the lift is in the 3rd floor, and there are three users; one would like to go to the 5th floor, another to the 7th, and the last to the 2nd; the 5th floor will be served first, then the 7th and when the lift is going down the 2nd will be served. ii. The displacement of the lift is always between the minimum floor requested and the maximum floor requested and not systematically between the 1st (ground) and the Nth floor. iii. If two users request the same floor only one request is registered. 1. Give the graphical representation of a suitable ADT for this problem. 2. Give the specification of this ADT and define of the needed operations. 3. Implement the registration of the request of a new user : InsertRequest 4. Write the heading of the operation that performs (ii) and describe how the minimum and the maximum requested floors are computed. 5. We suppose that the probability that a new user is arrived is 50%. In addition to that and for any floor a user could be inserted while another is being served. Implement the bottom-up services of the lift when serving users.
السؤال بالعربي :
نُريدُ تَصميم مدير مصعدِ، وبمعنى آخر: . نظام الذي يُديرُ المصعدَ (مصعد) بناية مُعطية. إنّ البنايةَ متكوّنة من إن طوابق (n =10 ). المستعملون عِنْدَهُمْ الهوياتُ ويَخْدمونَ فيما يتعلق بعددِ أرضيتِهم المطلوبِ. إنّ سلوكَ المصعدِ مَوْصُوفُ كالتّالي:
i. إرتِفاع (من الأسفل للأعلى): يَفترضُ بأنّ المصعدَ في الطابقِ الثالثِ، وهناك ثلاثة مستعملين؛ واحد يوَدُّ أَنْ يَذْهبَ إلى الطابقِ الخامسِ، آخر إلى السابعِ، والأخيرون إلى الثانيةِ؛ الطابق الخامس سَيَخْدمُ أولاً، ثمّ السابع وعندما المصعد يَهْبطُ الثانيةَ سَتَخْدمُ.
ii. إنّ إزاحةَ المصعدِ دائماً بين الأرضيةِ الدنياِ التي طَلبتْ والأرضيةِ القصوى التي طَلبتْ ولَيستْ بشكل منظّم بين الأولى (الأرضي) وأرضية N th.
iii. إذا مستعملين يَطْلبانِ نفس الأرضيةِ فقط طلبِ واحد مسجّلُ.
1. أعطِ التمثيلَ التخطيطيَ ADT مناسب لهذه المشكلةِ.
2. أعطِ مواصفاتَ هذا ADT وعرّفْ مِنْ العملياتِ المطلوبةِ.
3. طبّقْ تسجيلَ طلبِ مستعمل جديد: insert request اضافة طلب.
4. إكتبْ عنوان العمليةِ الذي يُؤدّي (ii) ويَصِفُ كَيفَ الحَدّ الأدنى والحَدّ الأعلى طَلبا الطوابقَ مَحْسُوبة.
5. نَفترضُ بأنّ الإحتمالَ بأنّ مستعمل جديد وَاصِلُ 50 %. بالأضافة إلى تلك ولأيّ أرضية مستعمل يُمْكِنُ أَنْ يُدخَلَ بينما آخر يُخْدَمُ. طبّقْ من الأسفل للأعلى خدمات المصعدِ عندما تَخْدمُ المستعملين
حاولت في حلّه ولكن بدون جدوى........أتمنى منكم المساعدة...
وحبذا لو كان حلها باستخدام priority queue structue (node,list)s لأنه أقرب حل مناسب أو (أي حل آخر) بأسرع وقت ممكن...
وسأكون شاكر ومقدر لكم ...