Originally posted by: xuxiaoming
Hi all,
I have a problem when I use SetVectors method. Please look at the following code. " SetVectors(_a[i], _A[i], null, null); and SetVectors(_myu[i][k], _Myu[i][k], null, null);" can pass the debug. However " SetVectors(_xiaa[i][j], _xiAA[i][j], null, null); etc" can not pass. The debug information shows that something is null. Then give a nullreferenceexception. I check every Inumvar carefully. And all of them are non-null. I spent two days to dweal with this problem. However, I can't solve it.
So, can you help me?
Thanks a lot!
Xiaoming
if (!_done)
{
for (int i = 0; i < _A.GetLength(0); i++)
{
SetVectors(_a[i], _A[i], null, null);
SetVectors(_d[i], _D[i], null, null);
}
//for (int i = 0; i < _xiAA.GetLength(0); i++)
// for (int j = 0; j < _xiAA[i].GetLength(0); j++)
// {
// SetVectors(_xiaa[i][j], _xiAA[i][j], null, null);
// SetVectors(_xidd[i][j], _xiDD[i][j], null, null);
// SetVectors(_xiad[i][j], _xiAD[i][j], null, null);
// SetVectors(_xida[i][j], _xiDA[i][j], null, null);
// }
for (int i = 0; i < _Myu.GetLength(0); i++)
for (int k = 0; k < _Myu[i].GetLength(0); k++)
SetVectors(_myu[i][k], _Myu[i][k], null, null);
//for (int i = 0; i < _Omega.GetLength(0); i++)
// for (int j = 0; j < _Omega[i].GetLength(0); j++)
// for (int k = 0; k < _Omega[i][j].GetLength(0); k++)
// SetVectors(_omega[i][j][k], _Omega[i][j][k], null, null);
_done = true;
}
at ILOG.CPLEX.CpxNumVar.GetVarIndexValue()
at ILOG.CPLEX.CpxOptimizationCallback.GetVarIndexValue(INumVar var)
at ILOG.CPLEX.CpxSolveCallback.SetStart(Double[] x, INumVar[] var, Int32 xstart, Int32 xnum, Double[] pi, IRange[] rng, Int32 cstart, Int32 cnum)
at ILOG.CPLEX.Cplex.SolveCallback.SetVectors(Double[] x, INumVar[] var, Int32 xstart, Int32 xnum, Double[] pi, IRange[] rng, Int32 cstart, Int32 cnum)
at ILOG.CPLEX.Cplex.SolveCallback.SetVectors(Double[] x, INumVar[] var, Double[] pi, IRange[] rng)
at LB_TS_Project.CUSING_CPLEX.Solve.Main() in d:......._CPLEX.cs:line 618
at ILOG.CPLEX.CpxCallback.Callmain()
#CPLEXOptimizers#DecisionOptimization