A new computationally simple method of imposing hard convex constraints on the neural network output values is proposed. The key idea behind the method is to map a vector of hidden parameters of the network to a point that is guaranteed to be inside the feasible set defined by a set of constraints. The mapping is implemented by the additional neural network layer with constraints for output. The proposed method is simply extended to the case when constraints are imposed not only on the output vectors, but also on joint constraints depending on inputs. The projection approach to imposing constraints on outputs can simply be implemented in the framework of the proposed method. It is shown how to incorporate different types of constraints into the proposed method, including linear and quadratic constraints, equality constraints, and dynamic constraints, constraints in the form of boundaries. An important feature of the method is its computational simplicity. Complexities of the forward pass of the proposed neural network layer by linear and quadratic constraints are O(n*m) and O(n^2*m), respectively, where n is the number of variables, m is the number of constraints. Numerical experiments illustrate the method by solving optimization and classification problems. The code implementing the method is publicly available.
翻译:提出了一种对神经网络输出值施加硬凸约束的计算简便新方法。该方法的核心思想是将网络隐藏参数向量映射到保证位于由约束集定义的可行域内的点。该映射通过增加一个具有输出约束的神经网络层来实现。所提方法可简单扩展至约束不仅施加于输出向量,还涉及依赖于输入的联合约束的情况。在方法框架内,可以简便实现约束输出值的投影方法。本文展示了如何将不同类型的约束(包括线性与二次约束、等式约束、动态约束及边界形式约束)纳入所提方法。该方法的一个重要特征在于其计算简便性。在线性约束与二次约束下,所提神经网络层前向计算的复杂度分别为O(n*m)和O(n²*m),其中n为变量数,m为约束数。通过求解优化与分类问题的数值实验证明了该方法的有效性,且实现该方法的代码已公开。