不会写,求大佬帮忙

DBOYSET 2018-10-23 12:46:21
引用

Project 1 Abstract Data Type(ADT) Bag
What to submit?
 All source files
 UML class diagram(s)
 Supporting files if any (For example, files containing all testing data)
The ADT Bag is a group of items, much like what you might have with a bag of groceries. In a software development
cycle, specification, design, implementation, test/debug, and documentation are typical activities. The details are provided
in the rest of the document.
ADT Bag Specification: (Note: You should not change the names of the operations in your program.)
Specify operations to
 create an empty bag,
 put an item in the bag (insert(item)),
 remove the last item put in the bag ( removeLast()),
 remove a random item from the bag (removeRandom()),
 get an item from the bag( get(item)),
 get an item at index from the bag( get(index)),
 check how many items are in the bag (size()),
 check to see if the bag is full (isFull()),
 check to see if the bag is empty( isEmpty()),
 and completely empty the bag (makeEmpty()).
ADT Bag Design:
Complete a UML diagram to include all classes that are needed to meet the specifications. An interface class is
usually defined to include all operations. A class implementing this interface provides implementation details.
Exceptions should to be considered when operations are designed.
Java has two types of exceptions: checked exceptions and runtime exceptions.
Checked exceptions are instances of classes that are sub classes of java.lang.Exception class. They must be handled
locally or explicitly thrown from the method. They are typically used when the method encounters a serious problem. In
some cases, the error may be considered serious enough that the program should be terminated.
Runtime exceptions occur when the error is not considered as serious. These types of exceptions can often be
prevented by fail-safe programming. For example, it is fairly easy to avoid allowing an array index to go out of range, a
situation that causes the runtime exception ArrayIndexOutOfBoundsException to be thrown. Runtime exceptions are
instances of classes that are subclasses of the java.lang.RuntimeException class. RuntimeException is a subclass of
java.lang.Exception that relaxes the requirement forcing the exception to be either handled or explicitly thrown by the
method.
In general, some operations of an ADT list can be provided with an index value. If the index value is out of range, an
exception should be thrown. Therefore, a subclass of IndexOutOfBoundException needs to be defined.
Also, an exception is needed when the list storing the items becomes full. A subclass of java.lang.RuntimeException
should be defined for this erroneous situation. A full ADT bag should throw an exception when a new item is inserted.
ADT Bag Implementation:
6
Data structure array must be used to store all items in an ADT Bag list. The element type of the array should be
Object type. Implement all classes included in the design. Javadoc comments should be written during this activity.
ADT Bag Test/Debug:
Note: It is required to store all testing data in a file. No credit will be given if not.
It is required to use decomposition design technique. No credit will be given if not.
To test ADT bag design, all operations in the design must be tested. In general, an empty ADT Bag is created, and
then, fill the bag list with items read from a text file, invoke any operations via the list, and always display the list after it
is changed. It is not efficient to let main to do all. Method main should be very small and should be the only method in
the class. It should invoke a method (for example, start) that is decomposed into more methods (for example, fillList,
displayList) in a separate class. Every method should be designed as a single-minded method. For example, Class
ADTBagTest contains method main; class ADTBagUtility is a helper class. Both classes are used for testing purposes.
...全文
162 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
内容概要:本文研究了基于共识的捆绑算法(CBBA)在多智能体系统中的多任务分配问题,重点应用于远程太空船交会与维修的相对运动规划(RPO)任务。通过Matlab代码实现了CBBA算法,解决了多个航天器在复杂空间环境下协同执行交会、对接与维修任务时的任务分配挑战。研究突出该算法在分布式决策、冲突避免与资源优化方面的优势,详细探讨了任务打包、竞标机制与共识达成等核心环节,验证了其在无中央控制器条件下实现高效、鲁棒任务分配的有效性。; 适合人群:具备航天动力学、控制理论、多智能体系统及优化算法基础,从事航天器自主任务规划、分布式协同控制等相关领域的研究生、科研人员及工程师。; 使用场景及目标:① 实现多航天器在通信受限与信息不完整的远程空间环境下的自主任务分配;② 提升RPO任务中路径规划与资源调度的效率与安全性;③ 构建去中心化的多智能体协同框架,增强系统整体鲁棒性与可扩展性。; 阅读建议:建议结合提供的Matlab代码深入理解CBBA算法的实现逻辑,重点关注竞标权重设计、任务冲突消解与共识收敛过程,并可通过调整任务规模、通信拓扑与约束条件进行仿真实验,以全面掌握算法性能与适用边界。

33,026

社区成员

发帖
与我相关
我的任务
社区描述
数据结构与算法相关内容讨论专区
社区管理员
  • 数据结构与算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧