|
发布时间: 2017-05-16 |
第十一届全国数字娱乐 |
|
|
收稿日期: 2016-11-02; 修回日期: 2017-02-28
基金项目: 北京成像技术高精尖创新中心资助项目(BAI-CIT-2016024)
第一作者简介: 张岩 (1985-), 男, 讲师, 中国传媒大学信息计算技术专业博士研究生, 主要研究方向为多媒体内容计算。E-mail:ryanchang_cuc@yeah.net
中图法分类号: TP391.9
文献标识码: A
文章编号: 100-8961(2017)05-0631-12
|
摘要
目的 实现良好的用户体验是3维游戏场景设计的重要目的之一。目前3维场景设计通常多由美术设计师进行创作而非建筑设计及景观规划领域人员,场景空间组织方式没有充分考虑到用户体验,同时由于大型3维场景的制作周期过长,设计效率普遍较低。上述现象直接导致游戏用户在3维游戏场景中交互的体验感较差,但是该问题一直以来没有较好的方法予以解决,也没有引起相关领域研究者的重视。本文提出一种基于交互式遗传的多手段协同操作方法,其目的为实现更加高效、合理的批量生成大型场景单元,并改善空间组织方式,以获得良好的游戏用户体验感。 方法 本文方法主要通过特征聚类、蚁群算法空间布局优化及交互式遗传算法评价的方式来解决交互性差的问题。通过自学习方式进行场景建筑布局及立面层次进行特征聚类,并通过基于包围盒的蚁群优化算法进行场景组织的布局优化,最后结合交互式遗传算法引入用户评价来获得特征适应值评估从而得到新扩展的场景,该方法实现了重构场景的良好用户体验性及空间组织方式的合理性。 结果 对小型场景进行扩展和对单体建筑的布局进行重构,该方法所得到的新的场景具有良好的空间组织结构,基于用户评价通过交互式遗传算法以用户喜好的评价驱动进化,扩展后的场景反映了真实用户的主观感受并取得较为令人满意的效果,提高了用户体验的友好性。 结论 提出一种基于交互式遗传算法的场景重构方法,通过选择特定场景样本进行算法的实现,结果表明该方法具有可行性,并实现了较好的效果。本文方法对于游戏场景设计、文物古迹复原及系统仿真领域具有现实意义和研究价值。
关键词
虚拟现实; 遗传算法; 蚁群算法; 自适应共振理论; 特征提取
Abstract
Objective The design of 3D scenes should obey the rules of the architecture's organization. At present, 3D scene designs are typically carried out by art an designer who lacks knowledge of architecture. A method is proposed in this paper to solve this problem. We extracted the flat and facade features of a scene and analyzed the features by interactive genetic algorithm (IGA). A new method is introduced to evaluate the weights and scores of these characteristics, as well as obtain the adaptive values to optimize the organization of the old structure. After evolution and learning our algorithm, we can expand and reconstruct the old scene to a new scene, which has better organizational form.The 3D reconstruction scene realize the personality style and provide a better experience to users. This method has significance in the field of 3D game design, historical remains recovery, and landscape design. Method Adaptive Resonance Theory neural network is introduced to extract the features of 3D scenes. The ant colony algorithm is then utilized to optimize the layout of the scene, and introduce the interactive genetic algorithm to obtain the best adaptive individuals to form a larger scene. The algorithm is combined with the intuition and psychological characteristics of the designer, which is realized by the algorithm. The principle of the method is based on the approximation model, which maps the 3D scene to human psychological space. The optimal solution is obtained by the adaptive values of evaluation. To avoid the problem of individual fatigue, we evaluate the information of samples to train the fitness function and obtain an approximate model for updating information in the process of evolution. The method uses a neural network to clutter the feature of 3D models and effectively decrease the work of manual evaluation. Result This study used a series of specific scenes and extracted features of the scene based on the user evaluation to expand the original scene. The neural network method is used to realize the reorganization and extraction of features. In addition, ant colony algorithm is utilized to reorganize and expand the 3D scene. After using interactive genetic algorithm, we realize the expansion and reconstruction of the old scene. Conclusion This research analyzed the optimization design of 3D scenes and proposed the idea on how to reconstruct and expand the complex 3D scenes. A hierarchical decomposition method is presented to optimize the complex scene and search each layer to maximize the value of the symmetry characteristics. Based on these symmetry features, we can realize the reconstruction, and by using the ant colony algorithm, we would obtain the optimized layout scheme. The IGA is introduced to obtain the optimal solutions to the scene. Through the optimization of IGA, we can obtain more accurate adaptive values. Optimal individuals can be generated and more optimized design scheme will be obtained. This method can quickly generate a large scene with the original feature and symmetry, as well as realize the expansion and reconstruction of the old scene. Moreover, it mixed features of the local 3-D structure without manual layout and design. The deficiency is that the user satisfaction of the reconstructed scene and the manual organization scene still require substantial experiments for verification. A disadvantage in this method is that it does not perform well enough to explore all kinds of implicit aesthetic indexes. For the analysis of the aesthetic characteristics and style of the 3-D scene, it is impossible to establish a realistic approximate model for quantitative analysis in the present stage. In-depth studies and further efforts should be devoted to solve the problems above. Experiments show that this method is practical and effective; it can effectively improve the efficiency of the design and enhance the ornamental value. This method has practical significance in 3D game design, virtual restoration, and visual simulation.
Key words
virtual reality; genetic algorithm; ant colony algorithm; adaptive resonance theory; feature extraction
0 引言
3维场景映射真实世界的场景,但3维设计人员普遍不具备严格的建筑学背景及空间组织能力,设计的游戏场景作品往往画面美观,但场景设计违背基本的场景空间组织原则,其原因在于3维场景设计师普遍缺乏建筑场景组织的知识背景及经验,而建筑规划及相关领域从业者较少涉及具体的3维建模工作。提出一种多重方法协同操作的交互式遗传算法,以用户偏好驱动场景扩展,实现3维场景扩展的灵活性和用户友好性。理论上来说,该方法可以应用于建筑设计、游戏设计及3维仿真等学科交叉领域,使不同专业背景的创作人员进行知识融合。
Wertheimer于1923年提出著名的Law of Good Gestalt理论,即对某不规则结构进行最大程度地简化、规则化及序列化以便于抽离出其规则化元素。该理论中所提及的完形原则及对称最大化理论逐渐被计算机视觉研究者所重视,对于3维场景立面及平面分析的研究逐渐形成体系。建筑场景立面的分析可以追溯到对称化图形分析领域,Aliaga[1]认为可通过图形对称性分析从而得出不规则结构中所存在的某种规律,即可用艺术创作领域的“风格化”来解释。对称性量化分析理论已经有很多研究者进行探索,如Hao等人[2]就如何对近似对称图形的特征进行量化分析提出自己的观点,并研究不规则对象中隐含的对称性特征。3维模型对称性特征的提取也日益成为研究热点,Blokelon等人[3]通过参数化编辑的方式进行3维对称性分析;Hochstein[4]提出自顶至底层次化分解的方法提取3维对称性特征。很多新的方法也应用于复杂3维对象的特征提取,如Ankerst等人[5]将3维模型采样为点云进行特征提取;Kazhdan等人[6]采用3维模型反射和旋转对称的球函数集合来描述3维特征,并提出基于3维实体3个主方向上的轮廓特征分别提取轮廓特征。Hochstein[7]认为在场景分层处理过程中,建筑常呈群落状态,需要将子结构中的最基础元素进行特征提取,逐步分解至再无法进行对称性分析最小单元。在借鉴上述研究者方法的基础上,本文采用包围盒法,将现有场景进行分层及割裂处理,同时使用改进的蚁群算法实现场景的优化布局,作为多方法协同操作的前期处理方法。
场景的扩充和优化使用改进的遗传算法来实现。传统遗传算法适用于显式函数表示的优化问题,但是很多美学和艺术设计领域的性能优化指标往往属于隐式性能指标的优化,难以用明确的函数来表示。1986年Dawkins[8]提出交互式遗传算法 (IGA) 思想;1991年Sims[9]在计算机图像中使用交互式计算方法并取得一定成果;Takagi等人[10]研究交互式遗传算法理论并将其应用于语音识别、艺术设计及虚拟现实等领域。交互式遗传算法IGA在传统遗传算法基础上引入人的主观评价并将其作为进化个体适应值的优化方法,该算法建立在将变量空间映射在心理空间的方法之上,可以通过设计师评估从而得到最优解。但普遍效率低下,从而引起用户的严重疲劳感,易受环境影响,具有不稳定性。提出一种多重方法协同操作的交互式遗传算法 (CIGA),以解决传统IGA方法的缺陷。
1 场景特征聚类及布局优化
1.1 场景结构化表征及特征聚类实现
有很多研究者采用神经网络的方法来对3维组群对象进行特征聚类,例如Moon等人使用前馈神经网络 (feed-forward neural network) 来进行训练从而学习3维零件实体特征以组成零件组;Smith等人采用ART (adaptive resonance theory) 网络来研究零件族群的成组规律;Onwubolu等人提出使用BPN网络来进行实体模型特征识别;Sunil等人使用ANN网络来对CAD模型进行特征识别。本文则提出采用自适应共振网络的方法来实现3维场景建筑特征的聚类。
3维模型的预处理是首要进行的工作,PCA方法忽视3维面片的面积差异性,会导致细节层次的网格产生不同的主轴,于是采用连续PCA方法[7](CPCA) 参数化三角形网格,
$ \begin{array}{*{20}{c}} {\boldsymbol{o} = {{\left[{{o_x}, {o_y}, {o_z}} \right]}^{\rm{T}}} = }\\ {m \cdot {A_i} + n \cdot {B_i} + \left( {1 -m -n} \right) \cdot {C_i}} \end{array} $ | (1) |
$ m=\text{ }\frac{1}{S}\iint{\boldsymbol{o}~\text{d}S}=\frac{1}{S}\sum\limits_{i=1}^{N}{{{S}_{i}}}\cdot \frac{({{A}_{i}}+{{B}_{i}}+{{C}_{i}})\text{ }}{3} $ | (2) |
$ \begin{matrix} f\left( \boldsymbol{o} \right)=\left( \boldsymbol{o}-c \right){{\left( \boldsymbol{o}-c \right)}^{\text{T}}} \\ C=\frac{1}{S}\iint{\left( \boldsymbol{o}-c \right){{\left( \boldsymbol{o}-c \right)}^{\text{T}}}\text{d}S}= \\ \frac{1}{12S}\sum\limits_{i=1}^{N}{{{S}_{i}}}\cdot \text{ }[f({{A}_{i}})+f({{B}_{i}})\text{ }+f({{C}_{i}})+ \\ 9f(\text{ }\frac{{{A}_{i}}+{{B}_{i}}+{{C}_{i}}}{~3}\text{ })] \\ \end{matrix} $ | (3) |
对3维模型进行采样,
$ \left\{ \begin{array}{l} {\theta _i} = \frac{{\left( {2i + 1} \right){\rm{\pi }}}}{{2{N_s}}}\\ {\phi _j} = \frac{{2{\rm{\pi }}\left( {2j + 1} \right)}}{{2{N_s}}} \end{array} \right. $ | (4) |
采样点与质心构成向量记为
Liu等人[11]对3维特征的提取通过对3维模型进行球面调和变换,得到不同频率的能量,使用有限带宽来进行简化计算。球函数
$ D\left( {\theta, \phi } \right) = \sum\limits_{\eta = 0}^N {\sum\limits_{\omega =-\eta }^\eta {{h_{\eta \omega }}Y_\eta ^\omega \left( {\theta, \phi } \right)} } $ | (5) |
$ \begin{array}{*{20}{c}} {\frac{{\Phi \left( \varphi \right)}}{{\sin \theta }}\frac{{\rm{d}}}{{{\rm{d}}\theta }}\left( {\sin \theta \frac{{{\rm{d}}\Theta \left( \theta \right)}}{{{\rm{d}}\theta }}} \right) + \frac{{\Theta \left( \theta \right)}}{{{{\sin }^2}\theta }}\left( {\frac{{{{\rm{d}}^2}\Phi \left( \varphi \right)}}{{{\rm{d}}{\varphi ^2}}}} \right) + }\\ {\eta \left( {\eta + 1} \right)\Theta \left( \theta \right)\Phi \left( \varphi \right) = 0} \end{array} $ | (6) |
定义
$ {t_\eta } = \sqrt {\sum\limits_{\omega =-\eta }^\eta {{{\left| {{h_{\eta \omega }}} \right|}^2}} } $ | (7) |
可得到特征向量序列为
可使用特征向量之间的欧氏距离衡量3维对象之间的特征差异,即
$ D\left( {{S_1}, {S_2}} \right) = \sqrt {\left( {\sum\limits_{\eta = 0}^{N-1} {{{\left( {t_\eta ^{{S_1}}-t_\eta ^{{S_2}}} \right)}^2}} } \right)} $ | (8) |
采用基于信息熵的特征向量选择算法可以优化特征分类,以
$ \begin{array}{*{20}{c}} {\varphi \left( {T,\mu ,k} \right) = }\\ { - \sum\limits_{i = 1}^m {\left\{ \begin{array}{l} {P_k}({\varphi _i},{\rm A}_T^\mu ){\rm{lo}}{{\rm{g}}_2}({P_k}({\varphi _i},{\rm A}_T^\mu ))\;\;\;\;\;{P_k} > 0\\ 0\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;其他 \end{array} \right.} } \end{array} $ | (9) |
假设序列
假设
$ \begin{array}{*{20}{c}} {Ent_{{\rm{Selection}}}^{{\rm{lmp}}}({T^*}, \alpha, k) = }\\ {{\rm{arg}}\mathop {{\rm{min}}}\limits_{1 \le j \le n} \{ i({T_j}, \alpha, k)\} } \end{array} $ | (10) |
根据
ART网络具有非离线学习的能力,同时具有较好的记忆和扩展能力。将3维场景对象特征向量作为模式序列,具体算法流程如下:
输入:模式序列
使
反馈权值矩阵初始化:
ART网络的警戒阈值
输出:更新前馈权值
for
for
while
if
go to continue
else
end while
continue
end for
其中
ART网络执行流程如下:
将3维特征作为输入模式进行输入:
$ \boldsymbol{X} = ({\boldsymbol{x}_1}, {\boldsymbol{x}_2}, \cdots, {\boldsymbol{x}_n}), {\boldsymbol{x}_i} \in {\left( {0, 1} \right)^n} $ |
当
$ ne{t_j} = \boldsymbol{W}_j^{\rm{T}}\boldsymbol{X}{\rm{ }} = \sum\limits_{i = 1}^n {{w_{ij}}{\boldsymbol{x}_i}}, j = 1, 2, \cdots, m $ |
特征向量相似性度量可采用内积法进行特征相似度距离计算,即
$ {\boldsymbol{X}^{\rm{T}}}{\boldsymbol{X}_i} = \left\| \boldsymbol{X} \right\|\left\| {{\boldsymbol{X}_i}} \right\|{\rm{cos}}\;\;\theta $ |
遴选胜利节点 (Winner Take All原则),即
$ ne{t_{{j^*}}} = \mathop {\max }\limits_j \left\{ {ne{t_j}} \right\} $ |
相似度比较阶段非常重要,存在警戒门线值为
$ N = \frac{{\sum\limits_{i = 1}^n {{t_{i{j^*}}}{x_i}} }}{{\sum\limits_{i = 1}^n {{x_i}} }} $ |
如果
如果
$ {t_{i{j^*}}}\left( {t + 1} \right) = {t_{i{j^*}}}\left( t \right){\boldsymbol{x}_i}, i = 1, 2, \cdots .n:{j^*}\;\; \in {J^*} $ |
其前馈连接权值按照以下规则调整,即
$ \begin{array}{*{20}{c}} {{w_{i{j^*}}}\left( {t + 1} \right) = \frac{{{t_{i{j^*}}}\left( t \right){x_i}}}{{0.5 + \sum\limits_{i = 1}^n {{t_{i{j^*}}}\left( t \right){x_i}} }} = }\\ {\frac{{{t_{i{j^*}}}\left( {t + 1} \right)}}{{0.5 + \sum\limits_{i = 1}^n {{t_{i{j^*}}}\left( {t + 1} \right)} }}} \end{array} $ | (11) |
如果遍历所有候选聚类都不能与输入模式共振,说明当前输入模式的全新的模式类,则由输入模式建立一个新聚类,同时将其前馈连接权值
1.2 基于语义分析的单体建筑结构化表征
基于特征聚类得到的标记,可以通过语法规则勾勒出建筑群落所包含的基本特征和组织形式,其一般形式如下:
$ \begin{array}{l} {\rm{LayoutConstruction}} \to \left( {Front} \right)\left( {Border} \right)\\ \{ \;Grou{p_0}Grou{p_1} \ldots Grou{p_{N-1}}\} \;\left( {Back} \right)\\ OrgGroup \to \{ \;Featur{e_0}Featur{e_1}Featur{e_2} \ldots \\ Featur{e_{K-1}}\} \end{array} $ |
其中,Layout Construction表示层次结构,(
$ \begin{array}{l} {\rm{Unit}}Feature \to \{ {A_0}{A_1}{A_2} \ldots {A_{S-1}}\} \\ {\rm{Array}}A \to \{ {E_0}{E_1}{E_2} \ldots {E_{T-1}}\} \end{array} $ |
其中Unit
若有表示立面纹理的数组,可记为
$ Facade = \left( {BC} \right)\left( {FWPS} \right)*\left( {BC} \right)(PS) $ |
重复出现的特征组合可记为
$ \begin{array}{*{20}{c}} {{E_1}{E_1}{E_2}{E_1}{E_2}{E_2}{E_1}{E_3}{E_1}{E_3}{E_2} \to }\\ {{E_1}\left( {{E_1}{E_2}} \right)\left( {{E_1}{E_2}} \right){E_2}\left( {{E_1}{E_3}} \right)\left( {{E_1}{E_3}} \right){E_2} \to }\\ {{E_1}\left( {{E_1}{E_2}} \right)*{E_2}\left( {{E_1}{E_3}} \right)*{E_2}} \end{array} $ |
1.3 场景分层及布局优化
Wang等人[12]提出通过对称性约束条件实现布局的重定向,并对布局约束的分类及表达进行研究。Song等人[13]基于蚁群算法实现元件布局和管线路径优化。在3维模型空间的布局上,采用蚁群算法优化空间结构。优化的过程涉及到分层,对矩形布局区域采用“包围盒”的方法,其目的是通过蚁群算法的优化,使得场景建筑之间的组织关系更加优化,以实现较好的游戏用户体验。
蚁群算法 (ant colony algotithm) 由意大利学者Dorigo等人[14]于20世纪90年代提出,其是一种基于种群的启发式仿生类并行智能进化算法。基于蚁群算法的包围盒布局模型的描述为
$ \max \;\;Fit = \frac{{\sum\limits_{i = 1}^n {\left( {({l_i} + \Delta l) \times \left( {{w_i} + \Delta w} \right) \times {h_i}} \right)} }}{{L \times W \times H}} $ | (12) |
式中,
$ \left\{ \begin{array}{l} ({l_i} + \Delta l)/2 \le {x_i} \le L-({l_i} + \Delta l)/2\\ ({w_i} + \Delta w)/2 \le {y_i} \le W-({w_i} + \Delta w)/2\\ {h_i}/2 \le {z_i} \le H-{h_i}/2 \end{array} \right. $ |
$ \left\{ \begin{array}{l} {x_i}-({l_i} + \Delta l)/2 \ge {x_j} + ({l_j} + \Delta l)/2或\\ {x_j}-({l_j} + \Delta l)/2 \ge {x_i} + ({l_i} + \Delta l)/2\\ {y_i}-({w_i} + \Delta w)/2 \ge {y_j} + ({w_j} + \Delta w)/2或\\ {y_j} - ({w_j} + \Delta w)/2 \ge {y_i} + ({w_i} + \Delta w)/2\\ {z_i} - ({h_i} + \Delta h)/2 \ge {z_j} + ({h_j} + \Delta h)/2或\\ {z_j} - ({h_j} + \Delta h)/2 \ge {z_i} + ({h_i} + \Delta h)/2 \end{array} \right. $ |
式中,
依托之前研究理论,对3维场景分层采用“盒子抽象 (Box-Abstraction)”方法,将基于某种特征阈值范围内的元素分离为一系列抽象盒子,分析的方法是进行逐层分解,至对称性元素不可再继续分解为止,见图 1、图 2。
2 层次优化
2.1 扩展抽象盒
将若干具有相似对称特征并与其他对象呈现轴对称特征的抽象盒子按原有组织结构提取,该扩展抽象盒隶属于整体结构中的部分规则网格,形成的前提是必须使其内部元素达到对称性最大化,即无法再扩充任何一个具有相同对称属性的元素归并至同一层级。
2.2 蚁群算法优化实现
蚁群算法具有记忆功能,若建立记忆列表
$ p_{ij}^k(t) = \left\{ \begin{array}{l} \frac{{{{\left[{{\tau _{ij}}(t)} \right]}^\alpha } \cdot {{\left[{{\eta _{ij}}(t)} \right]}^\beta }}}{{\sum\limits_{k \subset allowe{d_k}} {{{\left[{{\tau _{ik}}(t)} \right]}^\alpha } \cdot {{\left[{{\eta _{ik}}(t)} \right]}^\beta }} }}\;\;\;\;j \subset allowe{d_k}\\ 0\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;其他 \end{array} \right. $ | (13) |
式中,
接下来基于蚁群算法来对空间3维对象的布局进行优化。在包围盒区域中采用吸引子法实现建筑模型的布局。可为包围盒区域设置
$ \begin{array}{l} f\left( {{x_\eta },{y_\eta },{z_\eta }} \right) = \sum\limits_{\sigma = 1}^m {{\omega _\sigma }{\varphi _\sigma }} ({x_\eta },{y_\eta },{z_\eta }) = \\ \sum\limits_{\sigma = 1}^m {{\omega _\sigma }\left[ \begin{array}{l} {\kappa _\sigma }\left| {{x_{\eta }} - {x_\sigma }} \right| + \\ {\lambda _\sigma }\left| {{y_\eta } - {y_\sigma }} \right| + \\ {\mu _\sigma }\left| {{z_{\eta }} - {z_\sigma }} \right| \end{array} \right]} ,(\eta {\rm{ }} = {\rm{ }}1, \cdots ,n) \end{array} $ | (14) |
定位评价函数可表示为min
通过蚁群算法来优化吸引子参数,其具体步骤如下:
1) 设置迭代次数
2) 初始化信息素
3) 迭代次数
4)
5) 对信息素进行更新,各蚂蚁转移率为
若
$ \left\{ \begin{array}{l} {\tau _{ij}}(t + \Delta t) = \left( {1-\rho } \right){\tau _{ij}}\left( t \right) + \Delta {\tau _{ij}}(t)\\ \Delta {\tau _{ij}} = \rho \cdot Fit({I_{{\rm{best}}}}) \end{array} \right. $ | (15) |
6) 记更新后的适应度为
7) 若
8) 输出蚂蚁
若进入局部最优解,则算法停止。如果希望尽可能增大蚂蚁活动的周期,可通过占角顺序策略、下台阶法等减少算法陷入局部最优解的概率。
考虑到
$ \rho \left( t \right) = \left\{ \begin{array}{l} {\rho ^2}\left( {t-1} \right)/c{\rm{ }}\;\;\rho \left( t \right) \ge {\rho _{{\rm{min}}}}\\ {\rho _{{\rm{min}}}}\;\;\;\;\;\;\;\;\;\;\;\;\;其他 \end{array} \right. $ | (16) |
可通过Sigmoid函数对其进行优化,即
$ c = \frac{{2a}}{{1 + {{\rm{e}}^{-b \cdot t}}}}-a $ | (17) |
式中,
经过20次迭代的相关参数值如表 1所示。
表 1
算法相关参数值
Table 1
Relevant parameters
参数 | 取值 |
ant-amount: | |
信息素激励因子: | |
期望启发因子: | |
局部信息素挥发因子 | |
全局信息素更新因子 | |
信息素释放量 | |
适应度权重系数 | |
迭代次数 |
为了尽可能增加蚂蚁活动的可能性,需要防止算法陷入局部最优解,可考虑在
$ sum = \sum\limits_{i = 1}^6 {(\tau {{\left( i \right)}^\alpha } \times \eta {{\left( i \right)}^\beta })} $ | (18) |
$ p\left( j \right) = \sum\limits_{i = 1}^j {\tau {{\left( i \right)}^\alpha } \times \eta {{\left( i \right)}^\beta }} $ | (19) |
式中,
包围盒抽象的处理过程概括了通过该方法进行纵向和横向扩充的过程,如图 3所示。
对于建筑群落,在优化过程中需要对每次分解后的节点进行对称性评价,而最终目标是得到所有分解层次内在节点的对称性之和。对称性评分难以使用显式函数表达,若以
$ \mathop {\arg \;\max }\limits_{Hierarchy} \left\{ {\sum\limits_{node} {Symmetry\;Value\left( {node} \right)} } \right\} $ | (20) |
比较直接的方法是基于贪婪策略 (greedy strategy) 逐步构建最优解,形成基于吸引子约束条件的包围盒布局,如图 4、图 5所示。
2.3 交互式遗传算法进化布局
Gao等人[15]采用简单遗传算法实现对建筑布局的重新排列,但较难处理复杂3维场景,具有一定局限性。基于布局约束实现3维建筑布局优化的本质是在满足上述布局约束的前提下使特定位置上建筑的摆放格局最优。如图 6所示,将3维建筑布局的区域划分为
布局矩阵中可发现该规律:相邻元素值相同则对应同一个3维对象的不同部分。在优化计算时使用矩阵编码的遗传算法,随机选择矩阵区块进行矩阵交叉及变异处理,使原矩阵维数发生改变从而生成新的布局类型。子代第
$ {\boldsymbol{A}_i} = \left[{\begin{array}{*{20}{c}} {a_{11}^i}&{a_{12}^i}& \cdots &{a_{1n}^i}\\ {a_{21}^i}&{a_{22}^i}& \cdots &{a_{2n}^i}\\ \vdots & \vdots &{}& \vdots \\ {a_{m1}^i}&{a_{m2}^i}& \cdots &{a_{mn}^i} \end{array}} \right] $ |
选择交叉算子进行存优去劣处理,用适应度最优的染色体替换适应度最差的染色体,即若原来第
$ \begin{array}{l} {\boldsymbol{A}_i} = \left[{\begin{array}{*{20}{c}} {a_{11}^i}&{a_{12}^i}& \cdots &{a_{1n}^i}\\ {a_{21}^i}&{a_{22}^i}& \cdots &{a_{2n}^i}\\ \vdots & \vdots &{}& \vdots \\ {a_{m1}^i}&{a_{m2}^i}& \cdots &{a_{mn}^i} \end{array}} \right]\\ {\boldsymbol{A}_j} = \left[{\begin{array}{*{20}{c}} {a_{11}^j}&{a_{12}^j}& \cdots &{a_{1n}^j}\\ {a_{21}^j}&{a_{22}^j}& \cdots &{a_{2n}^j}\\ \vdots & \vdots &{}& \vdots \\ {a_{m1}^j}&{a_{m2}^j}& \cdots &{a_{mn}^j} \end{array}} \right] \end{array} $ |
则经过交叉运算后则为
$ \begin{array}{l} {\boldsymbol{A}_i} = \left[{\begin{array}{*{20}{c}} {a_{11}^j}&{a_{12}^j}& \cdots &{a_{1n}^j}\\ {a_{21}^i}&{a_{22}^i}& \cdots &{a_{2n}^i}\\ \vdots & \vdots &{}& \vdots \\ {a_{m1}^j}&{a_{m2}^j}& \cdots &{a_{mn}^j} \end{array}} \right]\\ {\boldsymbol{A}_j} = \left[{\begin{array}{*{20}{c}} {a_{11}^i}&{a_{12}^i}& \cdots &{a_{1n}^i}\\ {a_{21}^j}&{a_{22}^j}& \cdots &{a_{2n}^j}\\ \vdots & \vdots &{}& \vdots \\ {a_{m1}^i}&{a_{m2}^i}& \cdots &{a_{mn}^i} \end{array}} \right] \end{array} $ |
矩阵变异操作本质是将染色体中某些基因值用其他等位基因值来替换,从而形成新的局部矩阵个体,基因片段是随机选取的,以
$ \begin{array}{l} {\boldsymbol{A}_i} = \left[{\begin{array}{*{20}{c}} {a_{11}^i}&{a_{12}^i}& \cdots &{a_{1n}^i}\\ {a_{21}^i}&{a_{22}^i}& \cdots &{a_{2n}^i}\\ \vdots & \vdots &{}& \vdots \\ {a_{m1}^i}&{a_{m2}^i}& \cdots &{a_{mn}^i} \end{array}} \right]\mathop \Rightarrow \limits^{单点变异} \\ \;\;\;\;\;\;{\boldsymbol{A}_i} = \left[{\begin{array}{*{20}{c}} {a_{11}^i}&{a_{12}^i}& \cdots &{a_{1n}^i}\\ {a_{21}^i}&{a_{22}^i}& \cdots &{a_{2n}^i}\\ \vdots & \vdots &{}& \vdots \\ {a_{m1}^i}&{a_{m2}^i}& \cdots &{a_{mn}^i} \end{array}} \right] \end{array} $ |
式中,
由于针对的是隐式性能指标优化问题,因此有必要对矩阵基因区块的遗传操作进行算法优化。若进化的候选对象记为
$ F\left( x \right) = \sum\limits_{n = 1}^k {{\omega _n}F} (U_n^{{m_t}}) $ | (21) |
式中,
因为场景布局涉及主观审美,适应值
$ \begin{array}{*{20}{c}} {F\left( x \right) = {\omega _1} \times H\left( x \right) + {\omega _2} \times S\left( x \right) + }\\ {{\omega _3} \times G\left( x \right) + {\omega _4} \times L(x)} \end{array} $ | (22) |
式中,
假设进化第
$ \left\{ \begin{array}{l} \hat F(U_n^{{m_t}}) = {\rm{ }}\frac{1}{\Delta }\sum\limits_{{k_i} = {K_{{\rm{start}}}}}^{{k_{{\rm{final}}}}-1} {\delta \left( {U_n^{{m_t}}, {k_i}} \right)F\left( {{x_e}\left( {{k_i}} \right)} \right)} \\ \Delta = \sum\limits_{{k_i} = {K_{{\rm{start}}}}}^{{k_{{\rm{final}}}}-1} {\delta \left( {U_n^{{m_t}}, {k_i}} \right)} \end{array} \right. $ | (23) |
Guo等人[17]认为当进化种群对称性特征基因间的差异较小的时候,使用全局搜索很难再进行分层,并且难以提高算法性能,Gong等人[18]采取达到此临界状态时终止全局搜索转而进入局部搜索的方法。
交互式遗传操作的重点是用户可以通过评价各类特征适应值,从而筛选出种群最优个体,从而驱动种群往更加优化的结果进化。整体算法流程如图 8所示。
3 实验分析
实验初始化采用8组小规模的建筑组合作为初始输入对象,初始化参数如表 2所示。
表 2
CIGA初始化参数
Table 2
CIGA initialization parameters
交叉概率 | 变异概率 | 种群规模 |
0.56 | 0.02 | 8 |
进化终止代数 | 样本库规模 | 最优个体比例 |
8 | 30 | 0.4 |
采用基本遗传算法 (SGA)、基本交互式遗传算法 (SIGA) 作为对照实验,因本文算法结合多重预处理及其他算法协同处理,故标记为CIGA算法。处理初期在3维场景中导入对象,如图 9所示。
继续添加对象,将新旧场景的结构及层次进行混合,陆续导入其他建筑组合,通过蚁群算法进行布局优化,完成后进入本文所设计的CIAG遗传算法,筛选最优解并重构场景,如图 10所示。
CIGA进入后期,全局搜索进行分层达到终结状态。转而进入区域搜索阶段,通过遗传操作得出最优解,如图 11所示。
对照实验的SGA、SIGA所得出的最优解记为
$ \sigma = \sqrt {\frac{1}{N}\sum\limits_{i = 1}^N {\sigma _i^2} } $ | (24) |
式中,
表 3为SGA、SIGA与本文算法CIGA的性能对比。通过实验表明在满足适应值精度的要求下,本文所采取的CIGA方式在较少用户评价次数及进化代数下可以得到最优解。
表 3
各算法性能对比
Table 3
Performance comparison of each algorithm
进化目标空间利用率 | 进化目标对称性 | 进化目标黄金分割度 | 进化目标路径优化度 | ||||||||||||
传统遗传 算法 | 传统交互式 遗传算法 | 本文 算法 | 传统遗传 算法 | 传统交互式 遗传算法 | 本文 算法 | 传统遗传 算法 | 传统交互式 遗传算法 | 本文 算法 | 传统遗传 算法 | 传统交互式 遗传算法 | 本文 算法 | ||||
进化代数 | 32 | 17 | 9 | 43 | 20 | 14 | 57 | 35 | 16 | 58 | 22 | 14 | |||
最优解 典型用户 | 101011 001110 | 111111 001111 | 111011 001110 | 111011 111111 | 111011 001111 | 111111 011111 | 111111 011111 | 111011 001111 | 111111 001110 | 111001 001101 | 111011 101111 | 111011 101101 | |||
用户参评次数 | 75 | 44 | 26 | 81 | 41 | 26 | 52 | 27 | 18 | 77 | 51 | 28 | |||
收敛性 | 不收敛 | Convergent | 不收敛 | 不收敛 | 收敛 | 不收敛 | 不收敛 | 收敛 | 不收敛 | 收敛 | 收敛 |
由于人的认知过程具有渐进性,且偏好受心理因素及环境的影响而具有不稳定性,因此每代所对应的表现型会出现波动;以
不同用户对评价对象的层次结构及组织方式认识不同,系统根据其偏好得出进化个体的适应值,使场景扩充达到预期效果。该方法缺点是该方法倾向于对隐式性能指标的优化而无法建立明确的数学模型,对于评价各适应值的度量因子尚待优化。
4 结论
针对复杂3维场景的重构及扩展问题,提出一种多方法协同处理的交互式遗传算法。
首先,将由设计师创作的3维场景对象作为输入对象,基于其内部组织结构及特征进行分层处理,并进行特征归类;其次,对典型特征模型进行蚁群算法布局,采用包围盒的方法实现优化;然后基于形成的布局进行交互式遗传算法优化以形成用户个性化设计,在全局搜索结束时,若某些对优秀特征基因仍无法提取,从而进入局部搜索,来求得各层进化个体最优解,得到重构的3维场景。该方法可以实现3维场景的扩充、混合和重构的效果,而减少琐碎而繁重的美工设计,同时能够提高游戏场景的良好用户体验感。不足之处是尚未建立系统的数学模型以研究其内在规律。实验证实该方法具有实际可操作性,有效提高了扩展复杂场景的运算效率,同时也增强了重构场景的各项美学指标。该方法在3维游戏设计、虚拟古迹复原及视景仿真领域具有实际意义。
参考文献
-
[1] Aliaga D G, Rosen P A, Bekins D R. Style grammars for interactive visualization of architecture[J]. IEEE Transactions on Visualization and Computer Graphics, 2007, 13(4): 786–797. [DOI:10.1109/TVCG.2007.1024]
-
[2] Zhang H, Xu K, Jiang W, et al. Layered analysis of irregular facades via symmetry maximization[J]. ACM Transactions on Graphics, 2013, 32(4): #121. [DOI:10.1145/2461912.2461923]
-
[3] Bokeloh M, Wand M, Seidel H P, et al. An algebraic model for parameterized shape editing[J]. ACM Transactions on Graphics, 2012, 31(4): #78. [DOI:10.1145/2185520.2185574]
-
[4] Hochstein S, Ahissar M. View from the top:hierarchies and reverse hierarchies in the visual system[J]. Neuron, 2002, 36(5): 791–804. [DOI:10.1016/S0896-6273(02)01091-7]
-
[5] M Ankerst, G Kastenmüller, HP Kriegel, T Seidl. 3D Shape Histograms for Similarity Search and Classification in Spatial Databases[J]. Lecture Notes in Computer Science, 1999, 1651: 207–226. [DOI:10.1007/3-540-48482-5]
-
[6] M Kazhdan, T Funkhouser, S Rusinkiewicz. Rotation invariant spherical harmonic representation of 3D shape descriptors[J]. Eurographics Symposium on Geometry Processing, 2003: 156–164.
-
[7] Hochstein S, Ahissar M. Hierarchies and reverse hierarchies in the visual system[J]. Neuron, 2002, 36(5): 791–804. [DOI:10.1016/S0896-6273(02)01091-7]
-
[8] Dawkins R. The Blind Watchmaker[J]. Journal of Animal Ecology, 1987, 16(58): 423–424.
-
[9] K Sims. Artificial evolution for computer graphics[J]. Proceedings of International Conference on Computer Graphics, 1991: 319–328.
-
[10] H Takagi. Interactive evolutionary computation:fusion of the capabilities of EC optimization and human evaluation[J]. Proceeding of the IEEE, 2001, 89(9): 1275–1296. [DOI:10.1109/5.949485]
-
[11] Liu Y J. Research on some key technologies of shape-based 3D model retrieval[D]. Beijing:Institute of Computing Technology, Chinese Academy of Sciences, 2006. [刘玉杰. 基于形状的三维模型检索若干关键技术研究[D]. 北京: 中国科学院计算技术研究所, 2006.]
-
[12] Wang J M, Chen D X, Ma F N. Classification and representation of constraints in packing problem[J]. Journal of Computer Aided Design and Computer Graphics, 2000, 12(5): 349–354. [王金敏, 陈东祥, 马丰宁. 布局问题约束的分类及表达[J]. 计算机辅助设计与图形学学报, 2000, 12(5): 349–354. ] [DOI:10.3321/j.issn:1003-9775.2000.05.008]
-
[13] Song Z Z. Research on Packing Problem Based on Ant Colony Algorithm[D]. Tianjin:Tianjin University of Technology and Education, 2006. [宋真真. 基于蚁群算法的布局问题研究[D]. 天津: 天津职业技术师范大学, 2006.]
-
[14] Dorigo M, Gambardella L M. Ant colony system:a cooperative learning approach to the traveling salesman problem[J]. IEEE Transactions on Evolutionary Computation, 1997, 1(1): 53–66. [DOI:10.1109/4235.585892]
-
[15] Gao L P, Liu H. Architectural layout algorithm based on genetic algorithm[J]. Computer Engineering, 2005, 31(12): 39–41. [高丽萍, 刘弘. 基于遗传算法的建筑布局求解算法[J]. 计算机工程, 2005, 31(12): 39–41. ] [DOI:10.3969/j.issn.1000-3428.2005.12.015]
-
[16] Kim H S, Cho S B. Application of the interactive genetic Algorithm to fashion design[J]. Engineering Applications of Artificial Intelligence, 2000, 13(6): 635–644. [DOI:10.1016/S0952-1976(00)00045-2]
-
[17] Guo Y N, Gong D W, Zhou Y. Cooperative interactive evolutionary computation model based on multi-agent system[J]. Journal of System Simulation, 2005, 17(7): 1548–1552. [郭一楠, 巩敦卫, 周勇. 基于多智能体系统的协同交互式进化计算模型[J]. 系统仿真学报, 2005, 17(7): 1548–1552. ] [DOI:10.3969/j.issn.1004-731X.2005.07.005]
-
[18] Gong D W, Hao G S, Zhou Y, et al. Theory and Applications of Interactive Genetic Algorithms[M]. Beijing: National Defence Industry Press, 2007. [ 巩敦卫, 郝国生, 周勇, 等. 交互式遗传算法原理及其应用[M]. 北京: 国防工业出版社, 2007.]