# How can I use warm start in C#

I have been working on an MIP in C#. I want to reduce the gap, so I'm trying warm start. I use this code just before solve().

try
{
startvar = new IIntVar[numberOfAllNode * numberOfAllNode];
startval = new double[numberOfAllNode * numberOfAllNode];

for (int j = 1, idx = 0; j <= numberOfAllNode; j++)
for (int i = 1; i <= numberOfAllNode; i++)
{
startvar[idx] = x[j][i];
startval[idx] = x_value[j,i];
idx++;
}

startvar = null;
startval = null;
}


I got some syntax errors in the last line. unfortunately, I don't know what variable should I write in startvar[].

• Welcome to OR.SE! What exactly is your problem? Have you checked some of the other questions on this site about warm start such to see if they're what you want? such as: How to use warm start to solve MIPs efficiently? or How does a warm start work in LP/MIP?
– EhsanK
Jul 16 '20 at 13:38
• If you have a very specific question on warm-starting at CPLEX, you can also consider posting (instead) at community.ibm.com/community/user/datascience/communities/… .Whether you post there or here, you should describe as clearly as you can where you are having difficulty, to include showing any code you have which you don't think is working correctly. Jul 16 '20 at 13:44
• Would you see this link? Jul 16 '20 at 21:44

1. Don't set startvar and startval to null before calling AddMIPStart.
2. Remove square brackets from startvar and startval in the cal to AddMIPStart.