TransWikia.com

How can I use warm start in C#

Operations Research Asked by fhm.ider on August 19, 2021

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;
        Cplex.AddMIPStart(startvar[], startval[], Cplex.MIPStartEffort.SolveMIP);
    }

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

One Answer

This looks like a plain C# programming error.

  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.

Answered by Daniel Junglas on August 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP