2016-08-24 145 views

回答

0

请检查您的代码是否与以下CPLEX文档中的标准示例匹配。

public static void main(String[] args) { 
     if (args.length != 1) { 
     usage(); 
     return; 
     } 
     try { 
     IloCplex cplex = new IloCplex(); 

     cplex.importModel(args[0]); 

     /* Set the solution pool relative gap parameter to obtain solutions 
      of objective value within 10% of the optimal */ 

     cplex.setParam(IloCplex.DoubleParam.SolnPoolGap, 0.1); 

     if (cplex.populate()) { 
      System.out.println("Solution status = " + cplex.getStatus()); 
      System.out.println("Incumbent objective value = " 
           + cplex.getObjValue());    

      /* Get the number of solutions in the solution pool */ 

      int numsol = cplex.getSolnPoolNsolns(); 
      System.out.println("The solution pool contains " + numsol + 
           " solutions."); 

     } 
} 

您是否缺少像cplex.populate()这样的任何步骤。