[go: up one dir, main page]

CN115202661B - A hybrid generation method with hierarchical layout and related equipment - Google Patents

A hybrid generation method with hierarchical layout and related equipment Download PDF

Info

Publication number
CN115202661B
CN115202661B CN202211121484.6A CN202211121484A CN115202661B CN 115202661 B CN115202661 B CN 115202661B CN 202211121484 A CN202211121484 A CN 202211121484A CN 115202661 B CN115202661 B CN 115202661B
Authority
CN
China
Prior art keywords
nodes
node
branch
leaf
layout
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211121484.6A
Other languages
Chinese (zh)
Other versions
CN115202661A (en
Inventor
徐鹏飞
李一帆
杨之瑾
施蔚然
黄惠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen University
Original Assignee
Shenzhen University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen University filed Critical Shenzhen University
Priority to CN202211121484.6A priority Critical patent/CN115202661B/en
Publication of CN115202661A publication Critical patent/CN115202661A/en
Application granted granted Critical
Publication of CN115202661B publication Critical patent/CN115202661B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/11Complex mathematical operations for solving equations, e.g. nonlinear equations, general mathematical optimization problems
    • G06F17/12Simultaneous equations, e.g. systems of linear equations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Mathematical Physics (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Operations Research (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a hybrid generation method with hierarchical structure layout and related equipment, wherein the method comprises the following steps: receiving a plurality of layout templates input by a user, wherein the layout templates are represented by a multi-branch tree structure, leaf nodes in the multi-branch tree structure represent single elements in the layout templates, and the corresponding relation between the elements is calculated according to a node corresponding rule to obtain corresponding information; establishing a combined tree according to the corresponding information, and dynamically determining intermediate state elements and relations which should be met between the elements based on the combined tree according to node types and in combination with parameters generated during user interaction; and taking the positions and the sizes of the nodes as soft constraints, taking the relation which should be met between the nodes as hard constraints, optimizing an objective function, and generating a new diversity layout after the optimization solution is completed. The invention only needs to input a small amount of layout templates without a large data set for training, saves the computing resources and enables users to generate brand-new diversified layouts through simple interaction.

Description

一种具有层次结构布局的混合生成方法及相关设备A hybrid generation method with hierarchical layout and related equipment

技术领域technical field

本发明涉及计算机图形学技术领域,尤其涉及一种具有层次结构布局的混合生成方法、系统、终端及计算机可读存储介质。The invention relates to the technical field of computer graphics, in particular to a hybrid generation method, system, terminal and computer-readable storage medium with hierarchical layout.

背景技术Background technique

二维布局广泛应用于网页、海报、杂志等信息载体上。不同的信息模块可以通过布局来划分,从而得到一个内容呈现排版。合理的布局能符合用户的阅读习惯,方便用户快速获取关键信息。因此,探究如何生成二维布局并将其应用在信息展现上是一件很有意义的工作。Two-dimensional layouts are widely used in information carriers such as web pages, posters, and magazines. Different information modules can be divided by layout, so as to obtain a content presentation layout. Reasonable layout can meet the user's reading habits, so that users can quickly obtain key information. Therefore, it is very meaningful to explore how to generate two-dimensional layout and apply it to information display.

对于不同形式的布局生成主要有以下的实现形式:第一种是将元素间关系作为约束求解优化生成。例如,(1)要求输入一系列元素之间存在的可替代关系、元素的大小范围以及显示界面的大小,将元素之间的多种关系通过“或”约束连接起来,整体作为一个硬约束求解就可以生成自适应各种显示设备大小的布局。(2)提出了一种方法可以自动探测元素之间可能存在的诸如对齐、等大小之类的关系,并允许用户通过交互的方式手动编辑元素之间的关系,最后将这些元素的位置和大小作为软约束元素之间的关系作为硬约束求解优化就可以生成一个规整的布局。(3)提出了一个可以混合插值具有相似结构三维建筑物布局的框架,该工作输入的是多个建筑物布局,这些布局元素之间是有明确对应的,并将建筑物布局边界作为硬约束,房间的采光、高度以及院落等作为软约束。硬约束与软约束相结合定义了“好布局”的标准,然后通过线性插值的方式生成与输入布局具有相同结构的新布局。另一种则是基于深度学习自动生成布局的方式。(4)利用深度神经网络训练出生成模型后再结合用户的输入约束可以自动地生成二维的户型图布局。(5)提出了一个全新的框架,该框架利用自注意力机制去学习布局元素之间的上下文关系然后用于新布局的生成。There are mainly the following implementation forms for different forms of layout generation: the first one is to generate the relationship between elements as a constraint solution optimization. For example, (1) It is required to input a series of substitutable relationships between elements, the size range of elements and the size of the display interface, connect multiple relationships between elements through "or" constraints, and solve the whole as a hard constraint A layout that adapts to the size of various display devices can be generated. (2) A method is proposed to automatically detect possible relationships between elements such as alignment and equal size, and allow users to manually edit the relationship between elements in an interactive way, and finally the position and size of these elements As a soft constraint, the relationship between elements is optimized as a hard constraint to generate a regular layout. (3) A framework that can interpolate 3D building layouts with similar structures is proposed. The input of this work is multiple building layouts. There is a clear correspondence between these layout elements, and the building layout boundaries are used as hard constraints. , the lighting, height and courtyard of the room are used as soft constraints. The combination of hard constraints and soft constraints defines the criteria of a "good layout", and then generates a new layout with the same structure as the input layout by means of linear interpolation. The other is a way to automatically generate layouts based on deep learning. (4) Using the deep neural network to train the generative model and then combining the user's input constraints can automatically generate a two-dimensional floor plan layout. (5) A new framework is proposed, which uses the self-attention mechanism to learn the contextual relationship between layout elements and then use it to generate new layouts.

上述方法存在一定缺陷,例如(1)和(3)在做布局生成时,它们要求输入布局元素之间是有明确对应的;(2)需要用户手动编辑元素之间的关系;(4)和(5)这些基于深度学习的布局生成工作往往需要一个大数据集用于训练模型,此类方法需要大量的计算资源。The above methods have certain defects, such as (1) and (3) when doing layout generation, they require a clear correspondence between the input layout elements; (2) require the user to manually edit the relationship between elements; (4) and (5) These deep learning-based layout generation work often requires a large data set for training the model, and such methods require a large amount of computing resources.

因此,现有技术还有待于改进和发展。Therefore, the prior art still needs to be improved and developed.

发明内容Contents of the invention

本发明的主要目的在于提供一种具有层次结构布局的混合生成方法、系统、终端及计算机可读存储介质,旨在解决现有技术中进行信息展示时生成新布局过于复杂的问题。The main purpose of the present invention is to provide a hybrid generation method, system, terminal and computer-readable storage medium with a hierarchical layout, aiming at solving the problem in the prior art that generating a new layout is too complicated for information display.

为实现上述目的,本发明提供一种具有层次结构布局的混合生成方法,所述具有层次结构布局的混合生成方法包括如下步骤:In order to achieve the above object, the present invention provides a hybrid generation method with a hierarchical layout, and the hybrid generation method with a hierarchical layout includes the following steps:

接收用户输入的多个布局模板,所述布局模板使用多叉树结构表示,所述多叉树结构中的叶子节点代表所述布局模板中的单个元素,根据节点对应规则计算元素之间的对应关系,得到对应信息;Receive multiple layout templates input by the user, the layout template is represented by a multi-fork tree structure, the leaf nodes in the multi-fork tree structure represent a single element in the layout template, and the correspondence between elements is calculated according to the node correspondence rule relationship, get the corresponding information;

根据对应信息建立一棵组合树,基于所述组合树根据节点类型并结合用户交互时产生的参数动态确定中间状态元素以及元素之间应满足的关系;Establish a combination tree according to the corresponding information, and dynamically determine the intermediate state elements and the relationship between the elements according to the node type and the parameters generated during user interaction based on the combination tree;

将节点的位置和大小作为软约束,节点之间应满足的关系作为硬约束,优化目标函数,优化求解完成后生成新的多样性布局。The location and size of nodes are used as soft constraints, and the relationship between nodes is used as hard constraints, the objective function is optimized, and a new diversity layout is generated after the optimization solution is completed.

可选地,所述的具有层次结构布局的混合生成方法,其中,所述节点对应规则包括第一对应规则、第二对应规则、第三对应规则和第四对应规则;Optionally, in the hybrid generation method with hierarchical layout, the node correspondence rules include a first correspondence rule, a second correspondence rule, a third correspondence rule and a fourth correspondence rule;

所述第一对应规则包括:The first corresponding rule includes:

两个具有相似几何信息的叶子节点趋向对应在一起;Two leaf nodes with similar geometric information tend to correspond together;

两个具有相似子结构的分支节点趋向对应在一起;Two branch nodes with similar substructures tend to correspond together;

两个具有不同语义信息的叶子节点不能对应在一起;Two leaf nodes with different semantic information cannot correspond together;

所述第二对应规则包括:The second corresponding rule includes:

叶子节点和分支节点允许对应为空;Leaf nodes and branch nodes are allowed to be empty;

所述第三对应规则包括:The third corresponding rule includes:

如果两个分支节点

Figure 100002_DEST_PATH_IMAGE001
Figure 100002_DEST_PATH_IMAGE002
对应在一起,则子树
Figure 100002_DEST_PATH_IMAGE003
中的节点只能对应子树
Figure 100002_DEST_PATH_IMAGE004
中的节点或者对应空;If two branch nodes
Figure 100002_DEST_PATH_IMAGE001
and
Figure 100002_DEST_PATH_IMAGE002
Corresponding together, the subtree
Figure 100002_DEST_PATH_IMAGE003
Nodes in can only correspond to subtrees
Figure 100002_DEST_PATH_IMAGE004
The node in or corresponds to empty;

所述第四对应规则包括:The fourth corresponding rule includes:

两个处在不同层级的节点允许对应在一起;Two nodes at different levels are allowed to correspond together;

其中,叶子节点的父节点为分支节点。Wherein, the parent node of the leaf node is a branch node.

可选地,所述的具有层次结构布局的混合生成方法,其中,所述根据节点对应规则计算元素之间的对应关系,得到对应信息,之前还包括:Optionally, in the hybrid generation method with a hierarchical layout, wherein the calculation of the correspondence between elements according to the node correspondence rules to obtain the correspondence information also includes:

使用递归的方法定义两个节点之间以及节点与空之间计算对应损失的函数;Use the recursive method to define the function of calculating the corresponding loss between two nodes and between nodes and space;

两个叶子节点对应代价定义两个节点位置差的二范式加上大小差的二范式再加上一个与语义信息相关的第一惩罚项

Figure 100002_DEST_PATH_IMAGE005
,第一惩罚项的引入使得两个语义信息不同的节点不能对应在一起,为以下形式:The corresponding cost of two leaf nodes defines the second normal form of the position difference of the two nodes plus the second normal form of the size difference plus a first penalty item related to semantic information
Figure 100002_DEST_PATH_IMAGE005
, the introduction of the first penalty item makes it impossible for two nodes with different semantic information to correspond together, which is in the following form:

Figure 100002_DEST_PATH_IMAGE006
Figure 100002_DEST_PATH_IMAGE006
;

Figure 100002_DEST_PATH_IMAGE007
Figure 100002_DEST_PATH_IMAGE007
;

其中,

Figure 100002_DEST_PATH_IMAGE008
Figure 100002_DEST_PATH_IMAGE009
分别表示两个叶子节点;
Figure 100002_DEST_PATH_IMAGE010
是计算两个叶子节点对应代价的函数;
Figure 100002_DEST_PATH_IMAGE011
Figure 100002_DEST_PATH_IMAGE012
分别表示两个叶子节点的位置;
Figure 100002_DEST_PATH_IMAGE013
Figure 100002_DEST_PATH_IMAGE014
分别表示两个叶子节点的大小;
Figure 100002_DEST_PATH_IMAGE015
Figure 100002_DEST_PATH_IMAGE016
分别表示两个叶子节点对应的语义信息;in,
Figure 100002_DEST_PATH_IMAGE008
and
Figure 100002_DEST_PATH_IMAGE009
represent two leaf nodes respectively;
Figure 100002_DEST_PATH_IMAGE010
is a function to calculate the corresponding cost of two leaf nodes;
Figure 100002_DEST_PATH_IMAGE011
and
Figure 100002_DEST_PATH_IMAGE012
represent the positions of the two leaf nodes respectively;
Figure 100002_DEST_PATH_IMAGE013
and
Figure 100002_DEST_PATH_IMAGE014
respectively represent the size of the two leaf nodes;
Figure 100002_DEST_PATH_IMAGE015
and
Figure 100002_DEST_PATH_IMAGE016
respectively represent the semantic information corresponding to the two leaf nodes;

叶子节点对应空的代价

Figure 100002_DEST_PATH_IMAGE017
为该叶子节点对应一个大小为0的节点的损失,具体为该节点大小与0差的二范式再加上一个第二惩罚项
Figure 100002_DEST_PATH_IMAGE018
,为:Leaf node corresponds to the empty cost
Figure 100002_DEST_PATH_IMAGE017
The loss of the leaf node corresponding to a node with a size of 0, specifically the second normal form of the difference between the size of the node and 0 plus a second penalty item
Figure 100002_DEST_PATH_IMAGE018
,for:

Figure 100002_DEST_PATH_IMAGE019
Figure 100002_DEST_PATH_IMAGE019
;

其中,设定

Figure 100002_DEST_PATH_IMAGE020
;Among them, set
Figure 100002_DEST_PATH_IMAGE020
;

分支节点对应空的代价定义为该分支内所有叶子节点对应空的代价的累积和,为:The cost corresponding to the null of a branch node is defined as the cumulative sum of the costs corresponding to the null of all leaf nodes in the branch, which is:

Figure 100002_DEST_PATH_IMAGE021
Figure 100002_DEST_PATH_IMAGE021
;

其中,

Figure 100002_DEST_PATH_IMAGE022
是计算分支节点与空对应代价的函数,
Figure 100002_DEST_PATH_IMAGE023
是该分支节点下的叶子节点;in,
Figure 100002_DEST_PATH_IMAGE022
is a function to calculate the cost corresponding to the branch node and empty,
Figure 100002_DEST_PATH_IMAGE023
is the leaf node under the branch node;

分支节点对应叶子节点的代价:递归调用计算损失方法来计算该分支节点的孩子节点与叶子节点的代价,计算该分支节点的孩子节点对空的代价以及叶子节点对空的代价;用计算出的代价值构建一个二维矩阵并通过匈牙利算法求解得到一个最小的损失以及最优的匹配结果。The cost of the branch node corresponding to the leaf node: recursively call the calculation loss method to calculate the cost of the child node of the branch node and the leaf node, calculate the cost of the child node of the branch node and the cost of the leaf node to the null; use the calculated The cost value constructs a two-dimensional matrix and solves it through the Hungarian algorithm to obtain a minimum loss and an optimal matching result.

可选地,所述的具有层次结构布局的混合生成方法,其中,所述分支节点对应分支节点的计算代价包括:Optionally, in the hybrid generation method with hierarchical layout, the calculation costs of the branch nodes corresponding to the branch nodes include:

两个分支节点都不下沉;递归调用计算损失方法来计算第一个分支节点的孩子节点与另一分支节点的孩子节点之间的代价;计算第一个分支节点的孩子节点对空的代价以及第二个分支节点的孩子节点对空的代价;用计算出的代价值构建一个二维矩阵并通过匈牙利算法求解就得到一个损失值记为

Figure 100002_DEST_PATH_IMAGE024
;Neither branch node sinks; recursively calls the compute loss method to compute the cost between the child node of the first branch node and the child node of the other branch node; computes the cost of the child node of the first branch node against null and The cost of the child node of the second branch node to the null; use the calculated cost value to construct a two-dimensional matrix and solve it through the Hungarian algorithm to obtain a loss value recorded as
Figure 100002_DEST_PATH_IMAGE024
;

第一个分支节点下沉一级,第二个分支节点不下沉;递归调用计算损失方法来计算第一个分支节点与另一分支节点的孩子节点之间的代价;计算第一个分支节点对空的代价以及第二个分支节点的孩子节点对空的代价;用计算出的代价值构建一个二维矩阵并通过匈牙利算法求解得到一个损失值记为

Figure 100002_DEST_PATH_IMAGE025
;The first branch node sinks one level, and the second branch node does not sink; recursively call the calculation loss method to calculate the cost between the first branch node and the child node of another branch node; calculate the pair of the first branch node Null cost and the cost of the child node of the second branch node to the null; use the calculated cost value to construct a two-dimensional matrix and solve it through the Hungarian algorithm to obtain a loss value denoted as
Figure 100002_DEST_PATH_IMAGE025
;

第一个分支节点不下沉,第二个分支节点下沉一级;递归调用计算损失方法来计算第一个分支节点的孩子节点与另一分支节点之间的代价;计算第一个分支节点的孩子节点对空的代价以及第二个分支节点对空的代价;用计算出的代价值构建一个二维矩阵并通过匈牙利算法求解得到一个损失值记为

Figure 100002_DEST_PATH_IMAGE026
;The first branch node does not sink, and the second branch node sinks one level; recursively call the calculation loss method to calculate the cost between the child node of the first branch node and another branch node; calculate the cost of the first branch node The cost of the child node to the null and the cost of the second branch node to the null; use the calculated cost value to construct a two-dimensional matrix and solve it through the Hungarian algorithm to obtain a loss value recorded as
Figure 100002_DEST_PATH_IMAGE026
;

则最终损失值

Figure 100002_DEST_PATH_IMAGE027
,两个分支节点内的元素对应结果等于损失值最小的对应的匹配;将两个布局的根节点作为参数传入定义的递归函数中得到总体的对应损失值以及两个布局元素之间的对应信息。then the final loss value
Figure 100002_DEST_PATH_IMAGE027
, the corresponding result of the elements in the two branch nodes is equal to the corresponding matching with the smallest loss value; pass the root nodes of the two layouts as parameters into the defined recursive function to obtain the overall corresponding loss value and the correspondence between the two layout elements information.

可选地,所述的具有层次结构布局的混合生成方法,其中,所述基于所述组合树根据节点类型并结合用户交互时产生的参数动态确定中间状态元素以及元素之间应满足的关系,具体包括:Optionally, the hybrid generation method with hierarchical layout, wherein, based on the combination tree, according to the node type and in combination with the parameters generated during user interaction, the intermediate state elements and the relationship that should be satisfied between the elements are dynamically determined, Specifically include:

所述组合树包括三类节点,第一类节点是在两棵树中都有对应的节点;第二类节点是只在第一棵树中有对应的节点;第三类节点是只在第二棵树中有对应的节点;The combined tree includes three types of nodes. The first type of nodes has corresponding nodes in both trees; the second type of nodes only has corresponding nodes in the first tree; the third type of nodes only has corresponding nodes in the first tree. There are corresponding nodes in the two trees;

分别针对第二类节点和第三类节点按照所在的层级均匀地分配一个删除阈值,根据输入的参数动态确定中间状态的树结构以及兄弟节点之间应满足的关系;For the second type of nodes and the third type of nodes, a deletion threshold is evenly assigned according to the level where they are located, and the tree structure of the intermediate state and the relationship that should be satisfied between sibling nodes are dynamically determined according to the input parameters;

其中,兄弟节点之间的关系包括等大小、等间距和对齐。Among them, the relationship between sibling nodes includes equal size, equal spacing and alignment.

可选地,所述的具有层次结构布局的混合生成方法,其中,所述将节点的位置和大小作为软约束,节点之间应满足的关系作为硬约束,优化目标函数,具体包括:Optionally, the hybrid generation method with hierarchical layout, wherein the position and size of nodes are used as soft constraints, and the relationship that should be satisfied between nodes is used as hard constraints to optimize the objective function, specifically including:

当输入的参数值

Figure 100002_DEST_PATH_IMAGE028
小于0.5时,用第一棵树中的关系,否则,用第二树中的关系;When the input parameter value
Figure 100002_DEST_PATH_IMAGE028
When it is less than 0.5, use the relationship in the first tree, otherwise, use the relationship in the second tree;

求解时将位置和大小作为软约束,节点之间应满足的关系作为硬约束,要优化的目标函数如下:When solving, the position and size are used as soft constraints, and the relationship that should be satisfied between nodes is used as hard constraints. The objective function to be optimized is as follows:

Figure 100002_DEST_PATH_IMAGE029
Figure 100002_DEST_PATH_IMAGE029
;

其中,

Figure 100002_DEST_PATH_IMAGE030
是度量位置差的能量方程,
Figure 100002_DEST_PATH_IMAGE031
是度量大小差的能量方程;in,
Figure 100002_DEST_PATH_IMAGE030
is the energy equation to measure the position difference,
Figure 100002_DEST_PATH_IMAGE031
is the energy equation to measure the magnitude difference;

Figure 100002_DEST_PATH_IMAGE032
Figure 100002_DEST_PATH_IMAGE032
;

Figure 100002_DEST_PATH_IMAGE033
Figure 100002_DEST_PATH_IMAGE033
;

其中,

Figure 100002_DEST_PATH_IMAGE034
是中间状态树中的一个节点;
Figure 100002_DEST_PATH_IMAGE035
代表该节点要求解的位置量;
Figure 100002_DEST_PATH_IMAGE036
代表该节点要求解的大小值;如果
Figure 100002_DEST_PATH_IMAGE037
为空,则指示函数
Figure 100002_DEST_PATH_IMAGE038
,否则
Figure 100002_DEST_PATH_IMAGE039
Figure 100002_DEST_PATH_IMAGE040
表示节点
Figure 474280DEST_PATH_IMAGE034
对应在第一棵树中的节点
Figure 100002_DEST_PATH_IMAGE041
的位置;
Figure 100002_DEST_PATH_IMAGE042
表示节点
Figure 148888DEST_PATH_IMAGE041
的大小;
Figure 100002_DEST_PATH_IMAGE043
表示节点
Figure 951891DEST_PATH_IMAGE034
对应在第二棵树中的节点
Figure 100002_DEST_PATH_IMAGE044
的位置;
Figure 100002_DEST_PATH_IMAGE045
表示节点
Figure 795082DEST_PATH_IMAGE044
的大小;在一系列硬约束下最小化目标函数。in,
Figure 100002_DEST_PATH_IMAGE034
is a node in the intermediate state tree;
Figure 100002_DEST_PATH_IMAGE035
Represents the position quantity that the node needs to solve;
Figure 100002_DEST_PATH_IMAGE036
Represents the size value of the node to be solved; if
Figure 100002_DEST_PATH_IMAGE037
is empty, the indicator function
Figure 100002_DEST_PATH_IMAGE038
,otherwise
Figure 100002_DEST_PATH_IMAGE039
;
Figure 100002_DEST_PATH_IMAGE040
represents a node
Figure 474280DEST_PATH_IMAGE034
corresponds to the node in the first tree
Figure 100002_DEST_PATH_IMAGE041
s position;
Figure 100002_DEST_PATH_IMAGE042
represents a node
Figure 148888DEST_PATH_IMAGE041
the size of;
Figure 100002_DEST_PATH_IMAGE043
represents a node
Figure 951891DEST_PATH_IMAGE034
corresponds to the node in the second tree
Figure 100002_DEST_PATH_IMAGE044
s position;
Figure 100002_DEST_PATH_IMAGE045
represents a node
Figure 795082DEST_PATH_IMAGE044
The size of ; minimizes the objective function under a set of hard constraints.

可选地,所述的具有层次结构布局的混合生成方法,其中,所述具有层次结构布局的混合生成方法还包括:Optionally, the hybrid generation method with hierarchical layout, wherein, the hybrid generation method with hierarchical layout further includes:

若两个节点是竖直对齐的话,则有:If the two nodes are vertically aligned, then:

Figure 100002_DEST_PATH_IMAGE046
Figure 100002_DEST_PATH_IMAGE046
;

Figure 100002_DEST_PATH_IMAGE047
Figure 100002_DEST_PATH_IMAGE047
;

其中,

Figure 100002_DEST_PATH_IMAGE048
表示节点
Figure 422765DEST_PATH_IMAGE034
对应元素的横坐标;
Figure 100002_DEST_PATH_IMAGE049
表示节点
Figure 653895DEST_PATH_IMAGE034
对应元素的宽度;
Figure 100002_DEST_PATH_IMAGE050
表示节点
Figure 100002_DEST_PATH_IMAGE051
对应元素的横坐标;
Figure 100002_DEST_PATH_IMAGE052
表示节点
Figure 6511DEST_PATH_IMAGE051
对应元素的宽度。in,
Figure 100002_DEST_PATH_IMAGE048
represents a node
Figure 422765DEST_PATH_IMAGE034
The abscissa of the corresponding element;
Figure 100002_DEST_PATH_IMAGE049
represents a node
Figure 653895DEST_PATH_IMAGE034
The width of the corresponding element;
Figure 100002_DEST_PATH_IMAGE050
represents a node
Figure 100002_DEST_PATH_IMAGE051
The abscissa of the corresponding element;
Figure 100002_DEST_PATH_IMAGE052
represents a node
Figure 6511DEST_PATH_IMAGE051
Corresponds to the width of the element.

此外,为实现上述目的,本发明还提供一种具有层次结构布局的混合生成系统,其中,所述具有层次结构布局的混合生成系统包括:In addition, in order to achieve the above object, the present invention also provides a hybrid generation system with a hierarchical layout, wherein the hybrid generation system with a hierarchical layout includes:

所述具有层次结构布局的混合生成系统包括:The hybrid build system with hierarchical layout includes:

信息计算模块,用于接收用户输入的多个布局模板,所述布局模板使用多叉树结构表示,所述多叉树结构中的叶子节点代表所述布局模板中的单个元素,根据节点对应规则计算元素之间的对应关系,得到对应信息;The information calculation module is used to receive multiple layout templates input by the user, the layout templates are represented by a multi-fork tree structure, and the leaf nodes in the multi-fork tree structure represent a single element in the layout template, according to the node corresponding rules Calculate the corresponding relationship between elements to obtain corresponding information;

关系确定模块,用于根据对应信息建立一棵组合树,基于所述组合树根据节点类型并结合用户交互时产生的参数动态确定中间状态元素以及元素之间应满足的关系;The relationship determination module is used to establish a combination tree according to the corresponding information, based on the combination tree, according to the node type and in combination with the parameters generated during user interaction, dynamically determine the intermediate state elements and the relationship that should be satisfied between the elements;

优化生成模块,用于将节点的位置和大小作为软约束,节点之间应满足的关系作为硬约束,优化目标函数,优化求解完成后生成新的多样性布局。The optimization generation module is used to use the position and size of nodes as soft constraints, and the relationship that should be satisfied between nodes as hard constraints, optimize the objective function, and generate a new diversity layout after the optimization solution is completed.

此外,为实现上述目的,本发明还提供一种终端,其中,所述终端包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的具有层次结构布局的混合生成程序,所述具有层次结构布局的混合生成程序被所述处理器执行时实现如上所述的具有层次结构布局的混合生成方法的步骤。In addition, in order to achieve the above object, the present invention also provides a terminal, wherein the terminal includes: a memory, a processor, and a hybrid generator with a hierarchical layout stored on the memory and operable on the processor A program, when the hybrid generation program with a hierarchical layout is executed by the processor, the steps of the above-mentioned hybrid generation method with a hierarchical layout are implemented.

此外,为实现上述目的,本发明还提供一种计算机可读存储介质,其中,所述计算机可读存储介质存储有具有层次结构布局的混合生成程序,所述具有层次结构布局的混合生成程序被处理器执行时实现如上所述的具有层次结构布局的混合生成方法的步骤。In addition, in order to achieve the above object, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a hybrid generation program with a hierarchical layout, and the hybrid generation program with a hierarchical layout is The processor executes the steps to implement the hybrid generation method with hierarchical layout as described above.

本发明中,接收用户输入的多个布局模板,所述布局模板使用多叉树结构表示,所述多叉树结构中的叶子节点代表所述布局模板中的单个元素,根据节点对应规则计算元素之间的对应关系,得到对应信息;根据对应信息建立一棵组合树,基于所述组合树根据节点类型并结合用户交互时产生的参数动态确定中间状态元素以及元素之间应满足的关系;将节点的位置和大小作为软约束,节点之间应满足的关系作为硬约束,优化目标函数,优化求解完成后生成新的多样性布局。本发明只需要输入少量的布局模板而不需要大的数据集用于训练,节约了计算资源,使得用户通过简单的交互就能够生成出全新的多样性布局。In the present invention, a plurality of layout templates input by the user are received, and the layout template is represented by a multi-fork tree structure, and the leaf nodes in the multi-fork tree structure represent a single element in the layout template, and the elements are calculated according to the node corresponding rules According to the corresponding relationship between them, the corresponding information is obtained; a combination tree is established according to the corresponding information, based on the combination tree, the intermediate state elements and the relationship that should be satisfied between the elements are dynamically determined according to the node type and combined with the parameters generated during user interaction; The position and size of nodes are used as soft constraints, and the relationship between nodes is used as hard constraints. The objective function is optimized, and a new diversity layout is generated after the optimization solution is completed. The present invention only needs to input a small number of layout templates and does not need a large data set for training, which saves computing resources and enables users to generate brand new and diverse layouts through simple interaction.

附图说明Description of drawings

图1是本发明具有层次结构布局的混合生成方法的较佳实施例的流程图;Fig. 1 is the flow chart of the preferred embodiment of the hybrid generating method with hierarchical layout of the present invention;

图2是本发明具有层次结构布局的混合生成方法的较佳实施例中第一对应规则的示意图;Fig. 2 is a schematic diagram of the first corresponding rule in a preferred embodiment of the hybrid generation method with hierarchical layout in the present invention;

图3是本发明具有层次结构布局的混合生成方法的较佳实施例中第二对应规则的示意图;Fig. 3 is a schematic diagram of the second corresponding rule in a preferred embodiment of the hybrid generating method with hierarchical layout in the present invention;

图4是本发明具有层次结构布局的混合生成方法的较佳实施例中第三对应规则的示意图;Fig. 4 is a schematic diagram of the third corresponding rule in a preferred embodiment of the hybrid generation method with hierarchical layout in the present invention;

图5是本发明具有层次结构布局的混合生成方法的较佳实施例中第四对应规则的示意图;Fig. 5 is a schematic diagram of the fourth corresponding rule in a preferred embodiment of the hybrid generation method with hierarchical layout in the present invention;

图6是本发明具有层次结构布局的混合生成方法的较佳实施例中根据对应信息创建出的组合树的示意图;Fig. 6 is a schematic diagram of a combination tree created according to corresponding information in a preferred embodiment of the hybrid generation method with hierarchical layout in the present invention;

图7是本发明具有层次结构布局的混合生成方法的较佳实施例中动态确定中间状态的树结构过程的示意图;Fig. 7 is a schematic diagram of the tree structure process of dynamically determining the intermediate state in the preferred embodiment of the hybrid generation method with hierarchical structure layout in the present invention;

图8是本发明具有层次结构布局的混合生成方法的较佳实施例中用户生成的布局以及其对应的可视化结果的示意图;Fig. 8 is a schematic diagram of user-generated layouts and their corresponding visualization results in a preferred embodiment of the hybrid generation method with hierarchical layouts in the present invention;

图9是本发明具有层次结构布局的混合生成系统的较佳实施例的原理示意图;Fig. 9 is a schematic diagram of the principle of a preferred embodiment of the hybrid generation system with hierarchical layout in the present invention;

图10为本发明终端的较佳实施例的运行环境示意图。FIG. 10 is a schematic diagram of an operating environment of a preferred embodiment of the terminal of the present invention.

具体实施方式Detailed ways

为使本发明的目的、技术方案及优点更加清楚、明确,以下参照附图并举实施例对本发明进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the object, technical solution and advantages of the present invention more clear and definite, the present invention will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.

本发明使得用户通过简单的交互就能够生成出全新的布局,进行混合插值前首先要计算布局元素之间的对应,将计算出的对应信息与布局的划分结构保持一致;根据对应信息建立出组合树后制定合适的节点删除策略并根据输入的参数确定中间变量以及变量之间应满足的约束关系;本发明的方法针对元素之间没有明确对应的情况下也能计算出最优的对应,且元素对应结果与布局的划分结构保持一致,也就能用来做混合插值;只需要用户输入至少两个布局模板并通过简单的交互就可以生成出新的布局,生成结果可以用于后续设计师创作等。The invention enables the user to generate a brand new layout through simple interaction. Before performing mixed interpolation, the correspondence between the layout elements must be calculated first, and the calculated corresponding information is consistent with the division structure of the layout; a combination is established according to the corresponding information. Formulate a suitable node deletion strategy after the tree, and determine the intermediate variables and the constraint relationships that should be satisfied between the variables according to the input parameters; the method of the present invention can also calculate the optimal correspondence when there is no clear correspondence between elements, and The element corresponding result is consistent with the division structure of the layout, and can also be used for hybrid interpolation; only need the user to input at least two layout templates and a new layout can be generated through simple interaction, and the generated results can be used by subsequent designers creation etc.

本发明较佳实施例所述的具有层次结构布局的混合生成方法,如图1所示,所述具有层次结构布局的混合生成方法包括以下步骤:The hybrid generation method with hierarchical structure layout described in the preferred embodiment of the present invention, as shown in Figure 1, the described hybrid generation method with hierarchical structure layout includes the following steps:

步骤S10、接收用户输入的多个布局模板,所述布局模板使用多叉树结构表示,所述多叉树结构中的叶子节点代表所述布局模板中的单个元素,根据节点对应规则计算元素之间的对应关系,得到对应信息。Step S10: Receive a plurality of layout templates input by the user, the layout templates are represented by a multi-fork tree structure, and the leaf nodes in the multi-fork tree structure represent individual elements in the layout template, and calculate the relationship between the elements according to the node corresponding rules Correspondence between the corresponding information.

具体地,首先用多叉树结构表示用户输入的布局模板(无论是输入布局还是输出布局均是用多叉树表示),多叉树结构中的叶子节点代表布局中的单个元素,分支节点是其孩子节点的包围盒,叶子节点的父节点为分支节点,例如:有两个兄弟节点(孩子节点)分别对应布局中的两个元素,那么这两个兄弟节点的父节点(分支节点))就是一个方框,该方框刚好能完全“包裹”住那两个元素。做混合插值前首先要计算元素之间的对应,因此预先定义了一系列的节点对应规则。Specifically, firstly, the layout template input by the user is represented by a multi-fork tree structure (both the input layout and the output layout are represented by a multi-fork tree), the leaf nodes in the multi-fork tree structure represent a single element in the layout, and the branch nodes are The bounding box of its child nodes, the parent node of the leaf node is a branch node, for example: if there are two sibling nodes (child nodes) corresponding to two elements in the layout, then the parent node (branch node) of the two sibling nodes) It is a box that just "wraps" those two elements completely. Before doing hybrid interpolation, the correspondence between elements must be calculated first, so a series of node correspondence rules are pre-defined.

其中,所述节点对应规则包括第一对应规则、第二对应规则、第三对应规则和第四对应规则。Wherein, the node correspondence rules include a first correspondence rule, a second correspondence rule, a third correspondence rule and a fourth correspondence rule.

如图2所示,所述第一对应规则包括:As shown in Figure 2, the first corresponding rule includes:

(a)两个具有相似几何信息的叶子节点趋向对应在一起;(a) Two leaf nodes with similar geometric information tend to correspond together;

(b)两个具有相似子结构的分支节点趋向对应在一起;(b) Two branch nodes with similar substructures tend to correspond together;

(c)两个具有不同语义信息的叶子节点不能对应在一起。(c) Two leaf nodes with different semantic information cannot correspond together.

如图3所示,所述第二对应规则包括:As shown in Figure 3, the second corresponding rules include:

(a)叶子节点和分支节点允许对应为空。(a) Leaf nodes and branch nodes are allowed to be empty.

如图4所示,所述第三对应规则包括:As shown in Figure 4, the third corresponding rule includes:

(a)如果两个分支节点

Figure 967907DEST_PATH_IMAGE001
Figure 964944DEST_PATH_IMAGE002
对应在一起,则子树
Figure 773500DEST_PATH_IMAGE003
中的节点只能对应子树
Figure 862679DEST_PATH_IMAGE004
中的节点或者对应空。(a) If two branch nodes
Figure 967907DEST_PATH_IMAGE001
and
Figure 964944DEST_PATH_IMAGE002
Corresponding together, the subtree
Figure 773500DEST_PATH_IMAGE003
Nodes in can only correspond to subtrees
Figure 862679DEST_PATH_IMAGE004
Nodes in or correspond to empty.

如图5所示,所述第四对应规则包括:As shown in Figure 5, the fourth corresponding rule includes:

(a)两个处在不同层级的节点允许对应在一起。(a) Two nodes at different levels are allowed to correspond together.

其中,叶子节点的父节点是分支节点;图2-图5中的圆圈就是节点(分支节点或叶子节点),如果圆圈下面有线,那么该圆圈代表分支节点,圆圈下面没有线,那么该圆圈代表叶子节点;那些不同颜色的矩形框就是布局中的元素,用节点来表示。Among them, the parent node of the leaf node is a branch node; the circle in Figure 2-Figure 5 is a node (branch node or leaf node). Leaf nodes; those rectangular boxes of different colors are the elements in the layout, represented by nodes.

在对应规则的指导下,用递归的方法定义了两个节点之间以及节点与空之间计算对应损失的函数。Under the guidance of the corresponding rules, a recursive method is used to define the function of calculating the corresponding loss between two nodes and between nodes and space.

首先两个叶子节点对应代价定义两个节点位置差的二范式加上大小差的二范式再加上一个与语义信息相关的第一惩罚项

Figure 47672DEST_PATH_IMAGE005
,第一惩罚项的引入使得两个语义信息不同的节点不能对应在一起,为以下形式:First, the corresponding cost of two leaf nodes defines the second normal form of the position difference of the two nodes plus the second normal form of the size difference plus a first penalty item related to semantic information
Figure 47672DEST_PATH_IMAGE005
, the introduction of the first penalty item makes it impossible for two nodes with different semantic information to correspond together, which is in the following form:

Figure 51880DEST_PATH_IMAGE006
Figure 51880DEST_PATH_IMAGE006
;

Figure 234600DEST_PATH_IMAGE007
Figure 234600DEST_PATH_IMAGE007
;

其中,

Figure 342233DEST_PATH_IMAGE008
Figure 160279DEST_PATH_IMAGE009
分别表示两个叶子节点;
Figure 912334DEST_PATH_IMAGE010
是计算两个叶子节点对应代价的函数;
Figure 921747DEST_PATH_IMAGE011
Figure 719939DEST_PATH_IMAGE012
分别表示两个叶子节点的位置;
Figure 217041DEST_PATH_IMAGE013
Figure 276133DEST_PATH_IMAGE014
分别表示两个叶子节点的大小;
Figure 597393DEST_PATH_IMAGE015
Figure 649925DEST_PATH_IMAGE016
分别表示两个叶子节点对应的语义信息。in,
Figure 342233DEST_PATH_IMAGE008
and
Figure 160279DEST_PATH_IMAGE009
represent two leaf nodes respectively;
Figure 912334DEST_PATH_IMAGE010
is a function to calculate the corresponding cost of two leaf nodes;
Figure 921747DEST_PATH_IMAGE011
and
Figure 719939DEST_PATH_IMAGE012
represent the positions of the two leaf nodes respectively;
Figure 217041DEST_PATH_IMAGE013
and
Figure 276133DEST_PATH_IMAGE014
respectively represent the size of the two leaf nodes;
Figure 597393DEST_PATH_IMAGE015
and
Figure 649925DEST_PATH_IMAGE016
respectively represent the semantic information corresponding to the two leaf nodes.

叶子节点对应空的代价

Figure 714833DEST_PATH_IMAGE017
为该叶子节点对应一个大小为0的节点的损失,具体为该节点大小与0差的二范式再加上一个第二惩罚项
Figure 34956DEST_PATH_IMAGE018
,为:Leaf node corresponds to the empty cost
Figure 714833DEST_PATH_IMAGE017
The loss of the leaf node corresponding to a node with a size of 0, specifically the second normal form of the difference between the size of the node and 0 plus a second penalty item
Figure 34956DEST_PATH_IMAGE018
,for:

Figure 261538DEST_PATH_IMAGE019
Figure 261538DEST_PATH_IMAGE019
;

其中,设定

Figure 660420DEST_PATH_IMAGE020
。Among them, set
Figure 660420DEST_PATH_IMAGE020
.

分支节点对应空的代价定义为该分支内所有叶子节点对应空的代价的累积和,为:The cost corresponding to the null of a branch node is defined as the cumulative sum of the costs corresponding to the null of all leaf nodes in the branch, which is:

Figure 404386DEST_PATH_IMAGE021
Figure 404386DEST_PATH_IMAGE021
;

其中,

Figure 969228DEST_PATH_IMAGE022
是计算分支节点与空对应代价的函数,
Figure 507657DEST_PATH_IMAGE023
是该分支节点下的叶子节点。in,
Figure 969228DEST_PATH_IMAGE022
is a function to calculate the cost corresponding to the branch node and empty,
Figure 507657DEST_PATH_IMAGE023
It is the leaf node under the branch node.

分支节点对应叶子节点的代价:递归调用先前定义的计算损失方法来计算该分支节点的孩子节点与叶子节点的代价;同理,计算该分支节点的孩子节点对空的代价以及叶子节点对空的代价;然后用计算出的代价值构建一个二维矩阵并通过匈牙利算法求解就可以得到一个最小的损失以及最优的匹配结果。The cost of the branch node corresponding to the leaf node: recursively call the previously defined calculation loss method to calculate the cost of the child node of the branch node and the leaf node; similarly, calculate the cost of the child node of the branch node and the cost of the leaf node to the null cost; then use the calculated cost value to construct a two-dimensional matrix and solve it through the Hungarian algorithm to get a minimum loss and the best matching result.

分支节点对应分支节点的计算代价分三种情况:The calculation cost of the branch node corresponding to the branch node is divided into three cases:

(1)两个分支节点都不下沉;递归调用先前定义的计算损失方法来计算第一个分支节点的孩子节点与另一分支节点的孩子节点之间的代价;计算第一个分支节点的孩子节点对空的代价以及第二个分支节点的孩子节点对空的代价;用计算出的代价值构建一个二维矩阵并通过匈牙利算法求解就得到一个损失值记为

Figure 393835DEST_PATH_IMAGE024
;(1) Both branch nodes are not sinking; recursively call the previously defined calculation loss method to calculate the cost between the child node of the first branch node and the child node of the other branch node; calculate the child of the first branch node The cost of the node to the null and the child node of the second branch node to the null; construct a two-dimensional matrix with the calculated cost value and solve it by the Hungarian algorithm to obtain a loss value recorded as
Figure 393835DEST_PATH_IMAGE024
;

(2)第一个分支节点下沉一级,第二个分支节点不下沉;递归调用先前定义的计算损失方法来计算第一个分支节点与另一分支节点的孩子节点之间的代价;计算第一个分支节点对空的代价以及第二个分支节点的孩子节点对空的代价;用计算出的代价值构建一个二维矩阵并通过匈牙利算法求解得到一个损失值记为

Figure 534967DEST_PATH_IMAGE025
;(2) The first branch node sinks one level, and the second branch node does not sink; recursively call the previously defined calculation loss method to calculate the cost between the first branch node and the child node of another branch node; calculate The cost of the first branch node to the null and the child node of the second branch node to the null; use the calculated cost value to construct a two-dimensional matrix and solve it through the Hungarian algorithm to obtain a loss value recorded as
Figure 534967DEST_PATH_IMAGE025
;

(3)第一个分支节点不下沉,第二个分支节点下沉一级;递归调用先前定义的计算损失方法来计算第一个分支节点的孩子节点与另一分支节点之间的代价;计算第一个分支节点的孩子节点对空的代价以及第二个分支节点对空的代价;用计算出的代价值构建一个二维矩阵并通过匈牙利算法求解得到一个损失值记为

Figure 829682DEST_PATH_IMAGE026
;(3) The first branch node does not sink, and the second branch node sinks one level; recursively call the previously defined calculation loss method to calculate the cost between the child node of the first branch node and another branch node; calculate The cost of the child node of the first branch node to the null and the cost of the second branch node to the null; use the calculated cost value to construct a two-dimensional matrix and solve it through the Hungarian algorithm to obtain a loss value recorded as
Figure 829682DEST_PATH_IMAGE026
;

那么,最终损失值

Figure 899531DEST_PATH_IMAGE027
,这两个分支节点内的元素对应结果等于损失值最小的对应的匹配;将两个布局的根节点作为参数传入定义的递归函数中得到总体的对应损失值以及两个布局元素之间的对应信息。Then, the final loss value
Figure 899531DEST_PATH_IMAGE027
, the corresponding result of the elements in these two branch nodes is equal to the corresponding match with the smallest loss value; pass the root nodes of the two layouts as parameters into the defined recursive function to get the overall corresponding loss value and the relationship between the two layout elements corresponding information.

步骤S20、根据对应信息建立一棵组合树,基于所述组合树根据节点类型并结合用户交互时产生的参数动态确定中间状态元素以及元素之间应满足的关系。Step S20, build a combination tree according to the corresponding information, based on the combination tree, dynamically determine the intermediate state elements and the relationship between the elements according to the node type and in combination with the parameters generated during user interaction.

具体地,根据计算出的元素之间的对应,建立出一棵组合树;如图6所示,所述组合树包括三类节点,第一类节点是在两棵树中都有对应的节点,例如节点[15,16];第二类节点是只在第一棵树中有对应的节点,例如节点[10,

Figure DEST_PATH_IMAGE053
];第三类节点是只在第二棵树中有对应的节点,例如节点[
Figure 974804DEST_PATH_IMAGE053
,7]。Specifically, according to the calculated correspondence between elements, a combined tree is established; as shown in Figure 6, the combined tree includes three types of nodes, and the first type of nodes has corresponding nodes in both trees , such as node [15, 16]; the second type of node has a corresponding node only in the first tree, such as node [10,
Figure DEST_PATH_IMAGE053
]; the third type of node is a node that only has a corresponding node in the second tree, such as node [
Figure 974804DEST_PATH_IMAGE053
, 7].

如图7所示,分别针对第二类节点和第三类节点按照所在的层级均匀地分配一个删除阈值,然后根据输入的参数动态确定中间状态的树结构以及兄弟节点(有相同的父节点的节点即是兄弟节点,例如,在图6左上角的那棵树中,节点10和节点11就是兄弟节点)之间应满足的关系。As shown in Figure 7, a deletion threshold is evenly assigned to the second type of nodes and the third type of nodes according to the level they are in, and then the tree structure of the intermediate state and sibling nodes (with the same parent node) are dynamically determined according to the input parameters. Nodes are sibling nodes. For example, in the tree in the upper left corner of Figure 6, node 10 and node 11 are sibling nodes).

其中,兄弟节点之间的关系包括等大小、等间距和对齐。Among them, the relationship between sibling nodes includes equal size, equal spacing and alignment.

步骤S30、将节点的位置和大小作为软约束,节点之间应满足的关系作为硬约束,优化目标函数,优化求解完成后生成新的多样性布局。Step S30 , taking the positions and sizes of nodes as soft constraints, and the relationship that should be satisfied between nodes as hard constraints, optimizing the objective function, and generating a new diversity layout after the optimization solution is completed.

具体地,当输入的参数值

Figure 919626DEST_PATH_IMAGE028
小于0.5时,用第一棵树(图6左上,即输入的第一个布局)中的关系,否则,用第二树中(图6右上,即输入的第二个布局)的关系。Specifically, when the input parameter value
Figure 919626DEST_PATH_IMAGE028
When it is less than 0.5, use the relationship in the first tree (upper left in Figure 6, that is, the first input layout), otherwise, use the relationship in the second tree (upper right in Figure 6, that is, the second input layout).

求解时将位置和大小作为软约束,节点之间应满足的关系作为硬约束,要优化的目标函数如下:When solving, the position and size are used as soft constraints, and the relationship that should be satisfied between nodes is used as hard constraints. The objective function to be optimized is as follows:

Figure 835891DEST_PATH_IMAGE029
Figure 835891DEST_PATH_IMAGE029
;

其中,

Figure 699811DEST_PATH_IMAGE030
是度量位置差的能量方程,
Figure 341008DEST_PATH_IMAGE031
是度量大小差的能量方程。in,
Figure 699811DEST_PATH_IMAGE030
is the energy equation to measure the position difference,
Figure 341008DEST_PATH_IMAGE031
is the energy equation that measures the magnitude difference.

Figure 172743DEST_PATH_IMAGE032
Figure 172743DEST_PATH_IMAGE032
;

Figure 707629DEST_PATH_IMAGE033
Figure 707629DEST_PATH_IMAGE033
;

其中,

Figure 617816DEST_PATH_IMAGE034
是中间状态树中的一个节点;
Figure 339785DEST_PATH_IMAGE035
代表该节点要求解的位置量;
Figure 393454DEST_PATH_IMAGE036
代表该节点要求解的大小值;如果
Figure 782847DEST_PATH_IMAGE037
为空,则指示函数
Figure 536039DEST_PATH_IMAGE038
,否则
Figure 10883DEST_PATH_IMAGE039
Figure 835619DEST_PATH_IMAGE040
表示节点
Figure 846563DEST_PATH_IMAGE034
对应在第一棵树中的节点
Figure 364132DEST_PATH_IMAGE041
的位置;
Figure 591851DEST_PATH_IMAGE042
表示节点
Figure 361224DEST_PATH_IMAGE041
的大小;
Figure 459630DEST_PATH_IMAGE043
表示节点
Figure 649565DEST_PATH_IMAGE034
对应在第二棵树中的节点
Figure 99001DEST_PATH_IMAGE044
的位置;
Figure 531119DEST_PATH_IMAGE045
表示节点
Figure 749611DEST_PATH_IMAGE044
的大小;在一系列硬约束下最小化目标函数。in,
Figure 617816DEST_PATH_IMAGE034
is a node in the intermediate state tree;
Figure 339785DEST_PATH_IMAGE035
Represents the position quantity that the node needs to solve;
Figure 393454DEST_PATH_IMAGE036
Represents the size value that the node needs to solve; if
Figure 782847DEST_PATH_IMAGE037
is empty, the indicator function
Figure 536039DEST_PATH_IMAGE038
,otherwise
Figure 10883DEST_PATH_IMAGE039
;
Figure 835619DEST_PATH_IMAGE040
represents a node
Figure 846563DEST_PATH_IMAGE034
corresponds to the node in the first tree
Figure 364132DEST_PATH_IMAGE041
s position;
Figure 591851DEST_PATH_IMAGE042
represents a node
Figure 361224DEST_PATH_IMAGE041
the size of;
Figure 459630DEST_PATH_IMAGE043
represents a node
Figure 649565DEST_PATH_IMAGE034
corresponds to the node in the second tree
Figure 99001DEST_PATH_IMAGE044
s position;
Figure 531119DEST_PATH_IMAGE045
represents a node
Figure 749611DEST_PATH_IMAGE044
The size of ; minimizes the objective function under a set of hard constraints.

例如,若两个节点是竖直对齐的话,则有:For example, if two nodes are vertically aligned, then:

Figure 376027DEST_PATH_IMAGE046
Figure 376027DEST_PATH_IMAGE046
;

Figure 312759DEST_PATH_IMAGE047
Figure 312759DEST_PATH_IMAGE047
;

其中,

Figure 753097DEST_PATH_IMAGE048
表示节点
Figure 343871DEST_PATH_IMAGE034
对应元素的横坐标;
Figure 141188DEST_PATH_IMAGE049
表示节点
Figure 299637DEST_PATH_IMAGE034
对应元素的宽度;
Figure 807979DEST_PATH_IMAGE050
表示节点
Figure 1063DEST_PATH_IMAGE051
对应元素的横坐标;
Figure 691983DEST_PATH_IMAGE052
表示节点
Figure 603307DEST_PATH_IMAGE051
对应元素的宽度。in,
Figure 753097DEST_PATH_IMAGE048
represents a node
Figure 343871DEST_PATH_IMAGE034
The abscissa of the corresponding element;
Figure 141188DEST_PATH_IMAGE049
represents a node
Figure 299637DEST_PATH_IMAGE034
The width of the corresponding element;
Figure 807979DEST_PATH_IMAGE050
represents a node
Figure 1063DEST_PATH_IMAGE051
The abscissa of the corresponding element;
Figure 691983DEST_PATH_IMAGE052
represents a node
Figure 603307DEST_PATH_IMAGE051
Corresponds to the width of the element.

同理,其它硬约束也可以写成类似的线性等式形式,求解该二次规划问题就可以得到每个节点的位置和大小。Similarly, other hard constraints can also be written in a similar linear equation form, and the position and size of each node can be obtained by solving the quadratic programming problem.

如图8所示,邀请多名实验者参与到交互系统的体验之中,实验者从候选布局模板集中挑选三个布局模板作为输入,通过本发明的方法自动生成布局。实验者从生成的结果中挑选5个不同的布局保存下来,上述过程重复5次。最后对实验者进行了用户调研,实验者表示使用本发明的工具(方法)可以生成多样、合理、美观的布局。本发明进而将这些结果用于海报等内容的制作,取得了美观的可视化效果。As shown in Figure 8, a number of experimenters are invited to participate in the experience of the interactive system, and the experimenters select three layout templates from the set of candidate layout templates as input, and the layout is automatically generated by the method of the present invention. The experimenter selected 5 different layouts from the generated results and saved them, and the above process was repeated 5 times. Finally, a user survey was conducted on the experimenters, and the experimenters indicated that various, reasonable and beautiful layouts can be generated by using the tool (method) of the present invention. The present invention further applies these results to the production of content such as posters, and obtains beautiful visualization effects.

本发明提出方法只需要输入少量的布局模板而不需要大的数据集用于训练,节约了计算资源;方便用户通过简单的交互就可以生成多样性的布局。The method proposed by the invention only needs to input a small number of layout templates and does not need a large data set for training, which saves computing resources; it is convenient for users to generate diverse layouts through simple interaction.

本发明的主要内容是具有层次结构布局的混合生成方法,用户输入多个布局模板后,本发明可以自动计算元素之间的对应,然后根据对应信息建立一棵组合树,结合用户交互时产生的参数动态决定中间状态元素以及元素之间应满足的关系,最后优化求解生成新的布局。进一步还提供局部编辑功能,用户可以固定或单独改变生成结果的某一部分用于增加生成布局的多样性。The main content of the present invention is a hybrid generation method with a hierarchical structure layout. After the user inputs multiple layout templates, the present invention can automatically calculate the correspondence between elements, and then build a combined tree according to the corresponding information, combined with the user interaction generated The parameters dynamically determine the intermediate state elements and the relationship between the elements, and finally optimize the solution to generate a new layout. Further, a local editing function is also provided, and the user can fix or change a certain part of the generated result separately to increase the diversity of the generated layout.

进一步地,如图9所示,基于上述具有层次结构布局的混合生成方法,本发明还相应提供了一种具有层次结构布局的混合生成系统,其中,所述具有层次结构布局的混合生成系统包括:Further, as shown in FIG. 9 , based on the above hybrid generation method with hierarchical layout, the present invention also provides a hybrid generation system with hierarchical layout, wherein the hybrid generation system with hierarchical layout includes :

信息计算模块51,用于接收用户输入的多个布局模板,所述布局模板使用多叉树结构表示,所述多叉树结构中的叶子节点代表所述布局模板中的单个元素,根据节点对应规则计算元素之间的对应关系,得到对应信息;The information calculation module 51 is configured to receive multiple layout templates input by the user, the layout templates are represented by a multi-fork tree structure, and the leaf nodes in the multi-fork tree structure represent a single element in the layout template, according to the node correspondence The rule calculates the corresponding relationship between the elements and obtains the corresponding information;

关系确定模块52,用于根据对应信息建立一棵组合树,基于所述组合树根据节点类型并结合用户交互时产生的参数动态确定中间状态元素以及元素之间应满足的关系;The relationship determination module 52 is configured to establish a combination tree according to the corresponding information, based on the combination tree, according to the node type and in combination with the parameters generated during user interaction, dynamically determine the intermediate state elements and the relationship that should be satisfied between the elements;

优化生成模块53,用于将节点的位置和大小作为软约束,节点之间应满足的关系作为硬约束,优化目标函数,优化求解完成后生成新的多样性布局。The optimization generation module 53 is used to use the positions and sizes of nodes as soft constraints, and the relationships that should be satisfied between nodes as hard constraints, optimize the objective function, and generate a new diversity layout after the optimization solution is completed.

进一步地,如图10所示,基于上述具有层次结构布局的混合生成方法和系统,本发明还相应提供了一种终端,所述终端包括处理器10、存储器20及显示器30。图10仅示出了终端的部分组件,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。Further, as shown in FIG. 10 , based on the above hybrid generation method and system with hierarchical layout, the present invention also provides a terminal correspondingly, and the terminal includes a processor 10 , a memory 20 and a display 30 . Fig. 10 only shows some components of the terminal, but it should be understood that it is not required to implement all the components shown, and more or less components may be implemented instead.

所述存储器20在一些实施例中可以是所述终端的内部存储单元,例如终端的硬盘或内存。所述存储器20在另一些实施例中也可以是所述终端的外部存储设备,例如所述终端上配备的插接式硬盘,智能存储卡(Smart Media Card, SMC),安全数字(SecureDigital, SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器20还可以既包括所述终端的内部存储单元也包括外部存储设备。所述存储器20用于存储安装于所述终端的应用软件及各类数据,例如所述安装终端的程序代码等。所述存储器20还可以用于暂时地存储已经输出或者将要输出的数据。在一实施例中,存储器20上存储有具有层次结构布局的混合生成程序40,该具有层次结构布局的混合生成程序40可被处理器10所执行,从而实现本申请中具有层次结构布局的混合生成方法。The storage 20 may be an internal storage unit of the terminal in some embodiments, such as a hard disk or memory of the terminal. In other embodiments, the memory 20 may also be an external storage device of the terminal, such as a plug-in hard disk equipped on the terminal, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD ) card, flash memory card (Flash Card), etc. Further, the memory 20 may also include both an internal storage unit of the terminal and an external storage device. The memory 20 is used to store application software and various data installed on the terminal, such as program codes of the installed terminal. The memory 20 can also be used to temporarily store data that has been output or will be output. In one embodiment, a hybrid generation program 40 with a hierarchical layout is stored on the memory 20, and the hybrid generation program 40 with a hierarchical layout can be executed by the processor 10, thereby realizing the hybrid with a hierarchical layout in this application. generate method.

所述处理器10在一些实施例中可以是一中央处理器(Central Processing Unit,CPU),微处理器或其他数据处理芯片,用于运行所述存储器20中存储的程序代码或处理数据,例如执行所述具有层次结构布局的混合生成方法等。In some embodiments, the processor 10 may be a central processing unit (Central Processing Unit, CPU), a microprocessor or other data processing chips for running program codes stored in the memory 20 or processing data, for example Implementing the described hybrid generation method with hierarchical layout, etc.

所述显示器30在一些实施例中可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。所述显示器30用于显示在所述终端的信息以及用于显示可视化的用户界面。所述终端的部件10-30通过系统总线相互通信。In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, Organic Light-Emitting Diode) touch panel, and the like. The display 30 is used for displaying information on the terminal and for displaying a visualized user interface. The components 10-30 of the terminal communicate with each other via a system bus.

在一实施例中,当处理器10执行所述存储器20中具有层次结构布局的混合生成程序40时实现所述具有层次结构布局的混合生成方法的步骤。In one embodiment, when the processor 10 executes the hybrid generation program 40 in the memory 20, the steps of the method for generating a hybrid with a hierarchical layout are realized.

本发明还提供一种计算机可读存储介质,其中,所述计算机可读存储介质存储有具有层次结构布局的混合生成程序,所述具有层次结构布局的混合生成程序被处理器执行时实现如上所述的具有层次结构布局的混合生成方法的步骤。The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a hybrid generation program with a hierarchical layout, and when the hybrid generation program with a hierarchical layout is executed by a processor, the above Steps of the hybrid generative method with hierarchical layout described above.

综上所述,本发明提供一种具有层次结构布局的混合生成方法及相关设备,所述方法包括:接收用户输入的多个布局模板,所述布局模板使用多叉树结构表示,所述多叉树结构中的叶子节点代表所述布局模板中的单个元素,根据节点对应规则计算元素之间的对应关系,得到对应信息;根据对应信息建立一棵组合树,基于所述组合树根据节点类型并结合用户交互时产生的参数动态确定中间状态元素以及元素之间应满足的关系;将节点的位置和大小作为软约束,节点之间应满足的关系作为硬约束,优化目标函数,优化求解完成后生成新的多样性布局。本发明只需要输入少量的布局模板而不需要大的数据集用于训练,节约了计算资源,使得用户通过简单的交互就能够生成出全新的多样性布局。To sum up, the present invention provides a hybrid generation method with a hierarchical layout and related equipment, the method includes: receiving multiple layout templates input by the user, the layout templates are represented by a multi-fork tree structure, and the multiple The leaf nodes in the fork tree structure represent a single element in the layout template, and calculate the corresponding relationship between elements according to the node corresponding rules to obtain corresponding information; establish a combination tree according to the corresponding information, and based on the combination tree according to the node type Combined with the parameters generated during user interaction, the intermediate state elements and the relationship that should be satisfied between the elements are dynamically determined; the position and size of the nodes are used as soft constraints, and the relationship that should be satisfied between nodes is used as hard constraints, the objective function is optimized, and the optimization solution is completed Then generate a new diversity layout. The present invention only needs to input a small number of layout templates and does not need a large data set for training, which saves computing resources and enables users to generate brand new and diverse layouts through simple interaction.

需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者终端中还存在另外的相同要素。It should be noted that, in this document, the term "comprising", "comprising" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or terminal comprising a set of elements includes not only those elements, It also includes other elements not expressly listed, or elements inherent in the process, method, article, or terminal. Without further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article or terminal comprising the element.

当然,本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关硬件(如处理器,控制器等)来完成,所述的程序可存储于一计算机可读取的计算机可读存储介质中,所述程序在执行时可包括如上述各方法实施例的流程。其中所述的计算机可读存储介质可为存储器、磁碟、光盘等。Of course, those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be realized by instructing related hardware (such as processors, controllers, etc.) through computer programs, and the programs can be stored in a In the computer-readable computer-readable storage medium, the program may include the processes of the above-mentioned method embodiments when executed. The computer-readable storage medium described herein may be a memory, a magnetic disk, an optical disk, and the like.

应当理解的是,本发明的应用不限于上述的举例,对本领域普通技术人员来说,可以根据上述说明加以改进或变换,所有这些改进和变换都应属于本发明所附权利要求的保护范围。It should be understood that the application of the present invention is not limited to the above examples, and those skilled in the art can make improvements or transformations according to the above descriptions, and all these improvements and transformations should belong to the protection scope of the appended claims of the present invention.

Claims (7)

1. A hybrid generation method with a hierarchical layout, the hybrid generation method with a hierarchical layout comprising:
receiving a plurality of layout templates input by a user, wherein the layout templates are represented by a multi-branch tree structure, leaf nodes in the multi-branch tree structure represent single elements in the layout templates, and the corresponding relation between the elements is calculated according to a node corresponding rule to obtain corresponding information;
establishing a combined tree according to the corresponding information, and dynamically determining intermediate state elements and relations which should be met between the elements based on the combined tree according to node types and in combination with parameters generated during user interaction;
taking the positions and the sizes of the nodes as soft constraints, taking the relation which should be met among the nodes as hard constraints, optimizing an objective function, and generating a new diversity layout after the optimization solution is completed;
the node corresponding rules comprise a first corresponding rule, a second corresponding rule, a third corresponding rule and a fourth corresponding rule;
the first correspondence rule includes:
two leaf nodes with similar geometric information tend to correspond together;
two branch nodes with similar substructures tend to correspond together;
two leaf nodes with different semantic information cannot be corresponded together;
the second correspondence rule includes:
leaf nodes and branch nodes are allowed to be empty correspondingly;
the third rule of correspondence includes:
if two branch nodes
Figure DEST_PATH_IMAGE001
And
Figure DEST_PATH_IMAGE002
correspond together to form a subtree
Figure DEST_PATH_IMAGE003
A node in (2) can only correspond to a sub-tree
Figure DEST_PATH_IMAGE004
Node in or corresponding null;
the fourth rule of correspondence includes:
two nodes at different levels are allowed to correspond together;
wherein, the father node of the leaf node is a branch node;
the calculating the corresponding relation between the elements according to the node corresponding rule to obtain the corresponding information further comprises the following steps:
defining a function for calculating corresponding losses between two nodes and between the nodes and the spaces by using a recursive method;
the corresponding cost of two leaf nodes defines two normal forms of the position difference of two nodes, the two normal forms of the size difference and a first punishment item related to semantic information
Figure DEST_PATH_IMAGE005
The introduction of the first penalty term makes two nodes with different semantic information unable to be corresponded together, and is in the following form:
Figure DEST_PATH_IMAGE006
Figure DEST_PATH_IMAGE007
wherein,
Figure DEST_PATH_IMAGE008
and
Figure DEST_PATH_IMAGE009
respectively representing two leaf nodes;
Figure DEST_PATH_IMAGE010
is a function for calculating the corresponding cost of two leaf nodes;
Figure DEST_PATH_IMAGE011
and
Figure DEST_PATH_IMAGE012
respectively representing the positions of two leaf nodes;
Figure DEST_PATH_IMAGE013
and
Figure DEST_PATH_IMAGE014
respectively representing the sizes of two leaf nodes;
Figure DEST_PATH_IMAGE015
and
Figure DEST_PATH_IMAGE016
respectively representing semantic information corresponding to the two leaf nodes;
leaf node to null cost
Figure DEST_PATH_IMAGE017
Corresponding to a node loss with a size of 0 for the leaf node, specifically, adding a second penalty term to a two-normal form of the difference between the size of the node and 0
Figure DEST_PATH_IMAGE018
The method comprises the following steps:
Figure DEST_PATH_IMAGE019
wherein, setting
Figure DEST_PATH_IMAGE020
The empty cost corresponding to a branch node is defined as the cumulative sum of the empty costs corresponding to all leaf nodes in the branch, and is:
Figure DEST_PATH_IMAGE021
wherein,
Figure DEST_PATH_IMAGE022
is a function of the costs of the branch nodes corresponding to the nulls,
Figure DEST_PATH_IMAGE023
is a leaf node below the branch node;
cost of the branch node corresponding to the leaf node: recursively calling a calculation loss method to calculate the costs of the child nodes and the leaf nodes of the branch nodes, and calculating the costs of the child nodes of the branch nodes and the leaves of the leaf nodes; constructing a two-dimensional matrix by using the calculated cost values, and solving by using a Hungarian algorithm to obtain a minimum loss and an optimal matching result;
taking the position and the size of the nodes as soft constraints, taking the relation which should be satisfied between the nodes as hard constraints, and optimizing an objective function specifically comprises the following steps:
when the parameter value is inputted
Figure DEST_PATH_IMAGE024
If the value is less than 0.5, using the relation in the first tree, otherwise, using the relation in the second tree;
during solving, the position and the size are used as soft constraints, the relation which is required to be met between the nodes is used as hard constraints, and the objective function to be optimized is as follows:
Figure DEST_PATH_IMAGE025
wherein,
Figure DEST_PATH_IMAGE026
is an energy equation that measures the difference in position,
Figure DEST_PATH_IMAGE027
is an energy equation that measures the magnitude difference;
Figure DEST_PATH_IMAGE028
Figure DEST_PATH_IMAGE029
wherein,
Figure DEST_PATH_IMAGE030
is a node in the intermediate state tree;
Figure DEST_PATH_IMAGE031
representing the amount of position that the node is to solve for;
Figure DEST_PATH_IMAGE032
a magnitude value representing the node to be solved for; if it is used
Figure DEST_PATH_IMAGE033
Null, then indicating a function
Figure DEST_PATH_IMAGE034
Otherwise
Figure DEST_PATH_IMAGE035
Figure DEST_PATH_IMAGE036
Representing nodes
Figure 328930DEST_PATH_IMAGE030
Corresponding to nodes in the first tree
Figure DEST_PATH_IMAGE037
The position of (a);
Figure DEST_PATH_IMAGE038
representing nodes
Figure 137748DEST_PATH_IMAGE037
The size of (d);
Figure DEST_PATH_IMAGE039
representing nodes
Figure 183065DEST_PATH_IMAGE030
Corresponding to nodes in the second tree
Figure DEST_PATH_IMAGE040
The position of (a);
Figure DEST_PATH_IMAGE041
representing nodes
Figure 797848DEST_PATH_IMAGE040
The size of (d); the objective function is minimized under a series of hard constraints.
2. The hybrid generation method with hierarchical layout according to claim 1, wherein the calculation cost of the branch node corresponding to the branch node comprises:
neither branch node sinks; recursively invoking a compute penalty method to compute a cost between a child node of a first branch node and a child node of another branch node; calculating the cost of the child node of the first branch node to the null and the cost of the child node of the second branch node to the null; a two-dimensional matrix is constructed by using the calculated cost values and solved by Hungary algorithm to obtain a loss value which is recorded as
Figure DEST_PATH_IMAGE042
The first branch node sinks byStage, the second branch node does not sink; recursively invoking a compute loss method to compute a cost between a child node of a first branch node and another branch node; calculating the cost of the first branch node being empty and the cost of the child nodes of the second branch node being empty; constructing a two-dimensional matrix by using the calculated cost values and solving through a Hungarian algorithm to obtain a loss value which is recorded as
Figure DEST_PATH_IMAGE043
The first branch node does not sink, and the second branch node sinks one level; recursively invoking a compute penalty method to compute a cost between a child node of the first branch node and another branch node; calculating the cost of the child node of the first branch node to the null and the cost of the second branch node to the null; a two-dimensional matrix is constructed by using the calculated cost values, and a loss value is obtained and recorded by solving through Hungary algorithm
Figure DEST_PATH_IMAGE044
The final loss value
Figure DEST_PATH_IMAGE045
The element correspondence results in the two branch nodes are equal to the corresponding match with the smallest loss value; and transmitting the root nodes of the two layouts as parameters into a defined recursive function to obtain the total corresponding loss value and the corresponding information between the two layout elements.
3. The method of claim 2, wherein the dynamically determining intermediate state elements and relationships that should be satisfied between the elements based on the composition tree according to node types and in combination with parameters generated during user interaction specifically comprises:
the combined tree comprises three types of nodes, wherein the first type of node is a node corresponding to both the two trees; the second kind of nodes are corresponding nodes only in the first tree; the third kind of nodes are corresponding nodes only in the second tree;
respectively and uniformly distributing a deletion threshold value for the second class node and the third class node according to the level of the second class node and the third class node, and dynamically determining the relation which should be met between the tree structure of the intermediate state and the brother node according to the input parameters;
among them, the relationships between sibling nodes include equal size, equal spacing and alignment.
4. The hybrid generation method with hierarchical layout of claim 3, further comprising:
if two nodes are vertically aligned, then there are:
Figure DEST_PATH_IMAGE046
Figure DEST_PATH_IMAGE047
wherein,
Figure DEST_PATH_IMAGE048
representing nodes
Figure 956428DEST_PATH_IMAGE030
The abscissa of the corresponding element;
Figure DEST_PATH_IMAGE049
representing nodes
Figure 936148DEST_PATH_IMAGE030
The width of the corresponding element;
Figure DEST_PATH_IMAGE050
representing nodes
Figure DEST_PATH_IMAGE051
The abscissa of the corresponding element;
Figure DEST_PATH_IMAGE052
representing nodes
Figure 168894DEST_PATH_IMAGE051
The width of the corresponding element.
5. A hybrid generation system having a hierarchical layout, the hybrid generation system having a hierarchical layout comprising:
the information calculation module is used for receiving a plurality of layout templates input by a user, wherein the layout templates are represented by a multi-branch tree structure, leaf nodes in the multi-branch tree structure represent single elements in the layout templates, and the corresponding relation between the elements is calculated according to a node corresponding rule to obtain corresponding information;
the relation determining module is used for establishing a combined tree according to the corresponding information and dynamically determining the intermediate state elements and the relation which should be met among the elements based on the combined tree according to the node type and in combination with the parameters generated during user interaction;
the optimization generation module is used for taking the positions and the sizes of the nodes as soft constraints, taking the relation which should be met among the nodes as hard constraints, optimizing an objective function, and generating a new diversity layout after the optimization solution is completed;
the node corresponding rules comprise a first corresponding rule, a second corresponding rule, a third corresponding rule and a fourth corresponding rule;
the first correspondence rule includes:
two leaf nodes with similar geometric information tend to correspond together;
two branch nodes with similar substructures tend to correspond together;
two leaf nodes with different semantic information cannot be corresponded together;
the second correspondence rule includes:
leaf nodes and branch nodes are allowed to be empty correspondingly;
the third rule of correspondence includes:
if two branch nodes
Figure 430111DEST_PATH_IMAGE001
And
Figure 161307DEST_PATH_IMAGE002
correspond together to form a subtree
Figure 685829DEST_PATH_IMAGE003
A node in (2) can only correspond to a sub-tree
Figure 800678DEST_PATH_IMAGE004
Node in or corresponding null;
the fourth rule of correspondence includes:
two nodes at different levels are allowed to correspond together;
wherein, the father node of the leaf node is a branch node;
the method for calculating the corresponding relation between the elements according to the node corresponding rule to obtain the corresponding information further comprises the following steps:
defining a function for calculating corresponding losses between two nodes and between the nodes and the spaces by using a recursive method;
the corresponding cost of two leaf nodes defines two normal forms of the position difference of two nodes, the two normal forms of the size difference and a first punishment item related to semantic information
Figure 396744DEST_PATH_IMAGE005
The introduction of the first penalty term makes two nodes with different semantic information unable to be corresponded together, and is in the following form:
Figure 982447DEST_PATH_IMAGE006
Figure 976073DEST_PATH_IMAGE007
wherein,
Figure 686540DEST_PATH_IMAGE008
and
Figure 758401DEST_PATH_IMAGE009
respectively representing two leaf nodes;
Figure 464189DEST_PATH_IMAGE010
calculating the corresponding cost of the two leaf nodes;
Figure 861672DEST_PATH_IMAGE011
and
Figure 951113DEST_PATH_IMAGE012
respectively representing the positions of two leaf nodes;
Figure 826665DEST_PATH_IMAGE013
and
Figure 59063DEST_PATH_IMAGE014
respectively representing the sizes of two leaf nodes;
Figure 893027DEST_PATH_IMAGE015
and
Figure 735344DEST_PATH_IMAGE016
respectively representing semantic information corresponding to the two leaf nodes;
leaf node to null cost
Figure 352270DEST_PATH_IMAGE017
A loss corresponding to a node with a size of 0 for the leaf node, specifically a two-norm of the difference between the size of the node and 0 plus a second penalty term
Figure 501491DEST_PATH_IMAGE018
The method comprises the following steps:
Figure 303094DEST_PATH_IMAGE019
wherein, setting
Figure 803346DEST_PATH_IMAGE020
The empty cost corresponding to a branch node is defined as the cumulative sum of the empty costs corresponding to all leaf nodes in the branch, and is:
Figure 787744DEST_PATH_IMAGE021
wherein,
Figure 322631DEST_PATH_IMAGE022
is a function of the costs of the branch nodes corresponding to the nulls,
Figure 498397DEST_PATH_IMAGE023
is a leaf node below the branch node;
cost of branch node corresponding to leaf node: recursively calling a calculation loss method to calculate the costs of the child nodes and the leaf nodes of the branch nodes, and calculating the costs of the child nodes of the branch nodes and the leaves of the leaf nodes; constructing a two-dimensional matrix by using the calculated cost values, and solving by using a Hungarian algorithm to obtain a minimum loss and an optimal matching result;
the optimizing an objective function by using the positions and sizes of the nodes as soft constraints and using the relation which should be satisfied between the nodes as hard constraints specifically comprises the following steps:
when the parameter value is inputted
Figure 485945DEST_PATH_IMAGE024
If the value is less than 0.5, using the relation in the first tree, otherwise, using the relation in the second tree;
during solving, the position and the size are used as soft constraints, the relation which is required to be met between the nodes is used as hard constraints, and the objective function to be optimized is as follows:
Figure 8455DEST_PATH_IMAGE025
wherein,
Figure 132269DEST_PATH_IMAGE026
is an energy equation that measures the difference in position,
Figure 151041DEST_PATH_IMAGE027
is an energy equation that measures the magnitude difference;
Figure 953780DEST_PATH_IMAGE028
Figure 716200DEST_PATH_IMAGE029
wherein,
Figure 934999DEST_PATH_IMAGE030
is a node in the intermediate state tree;
Figure 842781DEST_PATH_IMAGE031
representing the amount of position to be solved for by the node;
Figure 477025DEST_PATH_IMAGE032
representing a magnitude value to be solved for the node; if it is used
Figure 341338DEST_PATH_IMAGE033
Null, then indicating a function
Figure 502061DEST_PATH_IMAGE034
Otherwise
Figure 160837DEST_PATH_IMAGE035
Figure 610273DEST_PATH_IMAGE036
Representing nodes
Figure 448916DEST_PATH_IMAGE030
Corresponding to nodes in the first tree
Figure 90244DEST_PATH_IMAGE037
The position of (a);
Figure 451081DEST_PATH_IMAGE038
representing nodes
Figure 122233DEST_PATH_IMAGE037
The size of (d);
Figure 358043DEST_PATH_IMAGE039
representing nodes
Figure 696620DEST_PATH_IMAGE030
Corresponding to nodes in the second tree
Figure 556254DEST_PATH_IMAGE040
The position of (a);
Figure 714703DEST_PATH_IMAGE041
representing nodes
Figure 754203DEST_PATH_IMAGE040
The size of (d); the objective function is minimized under a series of hard constraints.
6. A terminal, characterized in that the terminal comprises: memory, a processor and a hybrid generating program with a hierarchical layout stored on the memory and executable on the processor, the hybrid generating program with a hierarchical layout implementing the steps of the hybrid generating method with a hierarchical layout of any one of claims 1 to 4 when executed by the processor.
7. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a hybrid generation program with a hierarchical layout, which when executed by a processor implements the steps of the hybrid generation method with a hierarchical layout according to any one of claims 1 to 4.
CN202211121484.6A 2022-09-15 2022-09-15 A hybrid generation method with hierarchical layout and related equipment Active CN115202661B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211121484.6A CN115202661B (en) 2022-09-15 2022-09-15 A hybrid generation method with hierarchical layout and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211121484.6A CN115202661B (en) 2022-09-15 2022-09-15 A hybrid generation method with hierarchical layout and related equipment

Publications (2)

Publication Number Publication Date
CN115202661A CN115202661A (en) 2022-10-18
CN115202661B true CN115202661B (en) 2022-11-29

Family

ID=83571840

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211121484.6A Active CN115202661B (en) 2022-09-15 2022-09-15 A hybrid generation method with hierarchical layout and related equipment

Country Status (1)

Country Link
CN (1) CN115202661B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116933713A (en) * 2022-03-30 2023-10-24 华为技术有限公司 Module arrangement method of chip and related equipment
CN117058491B (en) * 2023-10-12 2024-04-02 深圳大学 Structured grid layout generation method and device based on recursive neural network
CN117828701B (en) * 2024-03-05 2024-05-24 中国石油大学(华东) Engineering drawing layout optimization method, system, equipment and medium
CN119248856B (en) * 2024-11-26 2025-03-11 恒生电子股份有限公司 Report generation method and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101339571A (en) * 2007-11-01 2009-01-07 复旦大学 A Realization Method of Concentration Constraints in VLSI Layout Planning
CN111354076A (en) * 2020-02-29 2020-06-30 北京航空航天大学 Single-image three-dimensional part combined modeling method based on embedding space
CN111625235A (en) * 2020-04-17 2020-09-04 北京大学 Method and system for constructing and deconstructing tree visualization form based on descriptive language
CN113420804A (en) * 2021-06-18 2021-09-21 工业互联网创新中心(上海)有限公司 Data processing method, device, network equipment and storage medium
CN113688593A (en) * 2021-08-11 2021-11-23 上海交通大学 Hybrid bonding layout and wiring optimization method among three-dimensional integrated circuit chips

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9350641B2 (en) * 2011-11-01 2016-05-24 Alcatel Lucent IP fast reroute scheme offering full protection
US11710033B2 (en) * 2018-06-12 2023-07-25 Bank Of America Corporation Unsupervised machine learning system to automate functions on a graph structure

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101339571A (en) * 2007-11-01 2009-01-07 复旦大学 A Realization Method of Concentration Constraints in VLSI Layout Planning
CN111354076A (en) * 2020-02-29 2020-06-30 北京航空航天大学 Single-image three-dimensional part combined modeling method based on embedding space
CN111625235A (en) * 2020-04-17 2020-09-04 北京大学 Method and system for constructing and deconstructing tree visualization form based on descriptive language
CN113420804A (en) * 2021-06-18 2021-09-21 工业互联网创新中心(上海)有限公司 Data processing method, device, network equipment and storage medium
CN113688593A (en) * 2021-08-11 2021-11-23 上海交通大学 Hybrid bonding layout and wiring optimization method among three-dimensional integrated circuit chips

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Efficient tree layout in a multilevel memory hierar;Alstrup, S 等;《arXiv preprint cs》;20021231;全文 *
基于O-TREE树表示的总线约束在VLSI/PCB布局中的应用;李煜 等;《成都信息工程学院学报》;20051020;第20卷(第03期);291-296 *

Also Published As

Publication number Publication date
CN115202661A (en) 2022-10-18

Similar Documents

Publication Publication Date Title
CN115202661B (en) A hybrid generation method with hierarchical layout and related equipment
CN101971204B (en) Arranging graphic objects on a page with relative position based control
Boudon et al. Interactive design of bonsai tree models
US6823299B1 (en) Modeling objects, systems, and simulations by establishing relationships in an event-driven graph in a computer implemented graphics system
CN102193786B (en) Device and method for constructing self-adaptive graphic user interface (GUI)
US11557088B2 (en) Generating space models from map files
WO2015196784A1 (en) Visual software modeling method based on software meta-view for constructing software view
CN109933311A (en) A kind of information system creation method and relevant apparatus
US20240420083A1 (en) Digital work collaborative creation method, electronic device and computer-readable storage medium
WO2015196788A1 (en) Visual interface modelling editor for constructing interface model
Tsandilas StructGraphics: Flexible visualization design through data-agnostic and reusable graphical structures
US11880378B2 (en) Data visualization analytical canvas with functionally independent visual containers
Li et al. HiTailor: Interactive transformation and visualization for hierarchical tabular data
CN117631618B (en) A real-time optimization method and system for DCS logic configuration screen connection
Huang et al. Plantography: Incorporating iterative design process into generative artificial intelligence for landscape rendering
US20240168966A1 (en) Data Visualization Analytical Canvas with Functionally Independent Visual Containers
WO2015196785A1 (en) Visual software modelling editor for constructing software model
Schindler et al. Multiverse data-flow control
Lipp et al. Local editing of procedural models
CN117828701B (en) Engineering drawing layout optimization method, system, equipment and medium
Henry Interactive graph layout: The exploration of large graphs
CN114117645A (en) Ship overall performance prediction integrated application system
Cruz et al. Drawing graphs by example efficiently: Trees and planar acyclic digraphs
Paetzold et al. RectEuler: visualizing intersecting sets using rectangles
Van Ommering et al. Languages for formalizing, visualizing and verifying software architectures

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant