一般表达式的CpxObjective(NotSupportedException未处理)CPLEX .NET API

时间:2014-10-09 22:49:59

标签: c# c++ .net cplex

我正在尝试将使用CPLEX API编写的代码转换为.NET API。在cplex.AddMinimize(obj)行上,我得到了NotSupportedException“CpxObjective for general expressions”。我已经搜索过,但没有发现任何关于它的信息。你能帮助我吗?

以下是例外情况:     System.NotSupportedException未处理       Message = CpxObjective for general expressions       来源= ILOG.CPLEX       堆栈跟踪:            konum:ILOG.CPLEX.CpxObjective.SetExpr(INumExpr expr)            konum:ILOG.CPLEX.CpxObjective..ctor(ObjectiveSense sense,CpxNumExpr expr,String name)            konum:ILOG.CPLEX.CplexModeler.Objective(ObjectiveSense sense,INumExpr expr,String name)            konum:ILOG.CPLEX.CplexModeler.AddObjective(ObjectiveSense sense,INumExpr expr,String name)            konum:ILOG.CPLEX.CplexModeler.AddMinimize(INumExpr expr)            konum:WROM.WROM.Main(String [] args)c:\ Users \ Tolgahan \ Documents \ Visual Studio 2012 \ Projects \ WROM \ WROM \WROM.cssiçinde:satır173            konum:System.AppDomain._nExecuteAssembly(Assembly assembly,String [] args)            konum:System.AppDomain.ExecuteAssembly(String assemblyFile,Evidence assemblySecurity,String [] args)            konum:Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()            konum:System.Threading.ThreadHelper.ThreadStart_Context(Object state)            konum:System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback回调,对象状态)            konum:System.Threading.ThreadHelper.ThreadStart()       的InnerException:

.
.
.
List<INumExpr> exprList = new List<INumExpr>();
for (int i = 0; i < numberOfTimeUnit; i++)
{
   for (int j = 0; j < numberOfSlot; j++)
   {
      for (int k = 0; k < numberOfProduct; k++)
      {
         for (int m = 0; m < numberOfProductUnitType; m++)
         {
            exprList.Add(cplex.Prod(cplex.Prod(overstowageTime1D[j], slotCapacity2D[j][m]), W4D[i][j][k][m]));
         }
      }
   }
}
INumExpr obj = cplex.Sum(exprList.ToArray());
exprList.Clear();
exprList.Add(obj);


for (int i = 0; i < numberOfTimeUnit; i++)
{
   for (int j = 0; j < numberOfTimeUnit; j++)
   {
      for (int k = 0; k < numberOfSlot; k++)
      {
         for (int m = 0; m < numberOfProduct; m++)
         {
            for (int n = 0; n < numberOfProductUnitType; n++)
            {
               exprList.Add(cplex.Prod(travelTime1D[k], Y5D[i][j][k][m][n]));
            }
         }
      }
   }
}
obj = cplex.Sum(exprList.ToArray());

cplex.AddMinimize(obj);
exprList.Clear();
.
.
.

0 个答案:

没有答案