lingo运行出错,error code23,for语句

2025-04-08 23:10:49
推荐回答(1个)
回答1:

语法有一点点错误,改成这样就可以了:


运行结果,得到全局最优解:

  Global optimal solution found.

  Objective value:                              3.000000

  Objective bound:                              3.000000

  Infeasibilities:                              0.000000

  Extended solver steps:                               9

  Total solver iterations:                          1104


  Model Class:                                      PILP


  Total variables:                    272

  Nonlinear variables:                  0

  Integer variables:                  272


  Total constraints:                   33

  Nonlinear constraints:                0


  Total nonzeros:                     544

  Nonlinear nonzeros:                   0


                                Variable           Value        Reduced Cost

                                       C        1474.560            0.000000

                                   Y( 1)        1.000000            1.000000

                                   Y( 2)        1.000000            1.000000

                                   Y( 3)        0.000000            1.000000

                                   Y( 4)        0.000000            1.000000

                                   Y( 5)        0.000000            1.000000

                                   Y( 6)        0.000000            1.000000

                                   Y( 7)        0.000000            1.000000

                                   Y( 8)        0.000000            1.000000

                                   Y( 9)        0.000000            1.000000

                                  Y( 10)        0.000000            1.000000

                                  Y( 11)        0.000000            1.000000

                                  Y( 12)        0.000000            1.000000

                                  Y( 13)        1.000000            1.000000

                                  Y( 14)        0.000000            1.000000

                                  Y( 15)        0.000000            1.000000

                                  Y( 16)        0.000000            1.000000

                                   W( 1)        46.00000            0.000000

                                   W( 2)        55.00000            0.000000

                                   W( 3)        62.00000            0.000000

                                   W( 4)        87.00000            0.000000

                                   W( 5)        108.0000            0.000000

                                   W( 6)        114.0000            0.000000

                                   W( 7)        137.0000            0.000000