Python 矩阵输入的非线性整数规划

Python 矩阵输入的非线性整数规划,python,matrix,nonlinear-optimization,mystic,Python,Matrix,Nonlinear Optimization,Mystic,我是非线性规划的新手,我读到mystic在有效解决这类问题方面相当不错。我试图实现这个数学模型(): 大致是这样的: """ Maximize: sum_{i=1 to max i} sum_{j=1 to max j} C_{ij} z_{ij} Subject to: 4 - min(sum_{i=1 to max i}z_{ij},2) - min(sum_{j=1 to max j}z_{ij},2) >= z_ij C_{ij} >

我是非线性规划的新手,我读到mystic在有效解决这类问题方面相当不错。我试图实现这个数学模型():

大致是这样的:

"""
Maximize:
  sum_{i=1 to max i} sum_{j=1 to max j} C_{ij} z_{ij}
Subject to:
  4 - min(sum_{i=1 to max i}z_{ij},2) - min(sum_{j=1 to max j}z_{ij},2) >= z_ij
  C_{ij} >= z_{ij}
  z_{ij} in {0, 1}


where the decision variables are:
  C_{ij}: pixel overlap between i reference obj and j output object
defined as:
  C_{ij} = R_i intersect O_j (value in matrix)
and:
  z_{ij}: R_i is matched to O_j
"""
我想会是这样的。但我要处理一个矩阵输入,以找到最佳最大匹配。匹配(z_ij)可以是一对一、多对一、一对多的关系,但不能是多对多

矩阵输入示例(C_ij)

我不确定该为边界设置什么,以及如何将ieqn约束设置为引用z_ij

[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 [0, 5600.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 6300.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 1600.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 0, 2500.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 0, 1200.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 0, 0, 4800.0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 0, 0, 1600.0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 0, 0, 2400.0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0, 1200.0, 0, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0, 300.0, 1000.0, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0, 0, 400.0, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0, 0, 2500.0, 600.0, 600.0, 0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0, 0, 0, 0, 0, 1600.0, 800.0, 0, 0, 0],
 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1600.0, 1600.0, 1971.428571428571]]