geatpy icon indicating copy to clipboard operation
geatpy copied to clipboard

混合编码:error in crtpp: Invalid syntax of FieldDR. (FieldDR的格式错误。)

Open XanderPENG opened this issue 11 months ago • 1 comments

Describe the bug 我正尝试RI和P混合编码解决VRP问题,但在创建PsyPopulation时发生错误,提示error in crtpp: Invalid syntax of FieldDR. (FieldDR的格式错误。)。我输出了我的Field1和Field2, field1: [[0. 0. 0. 0. 0. 0. 0. 0.] [1. 1. 1. 1. 1. 1. 1. 1.] [1. 1. 1. 1. 1. 1. 1. 1.]] field2: [[-3. -2. -2. -2. -2. -2.] [-3. 2. 2. 2. 2. 2.] [ 1. 1. 1. 1. 1. 1.]] 这似乎与官方的实例的格式一致,不知道为何会抛出异常;烦请指导

Code

Field1 = ea.crtfld('RI',
                   problem.varTypes[:8], 
                   problem.ranges[:, :8], 
                   problem.borders[:, :8])
Field2 = ea.crtfld('P',
                   problem.varTypes[8:], 
                   problem.ranges[:, 8:], 
                   problem.borders[:, 8:])
population = ea.PsyPopulation(
                              Encodings=['RI', 'P'],
                              NIND=20,
                              Fields=Fields,
                            #   EncoIdxs=[[0, 1, 2, 3, 4, 5, 6, 7], 
                            #             [8,9,10,11,12,13]]
                              )

Version Python 3.8.6; Geatpy 2.7.0

XanderPENG avatar Jul 23 '23 10:07 XanderPENG