Example #1
0
    ///<summary>Create a batch request for given problem file</summary>
    static string newbatchrequest(string filename)
    {
        string batchID = "";
        // Start environment, create Model object from file
        GRBEnv env = setupbatchenv();

        env.Start();
        GRBModel model = new GRBModel(env, filename);

        try {
            // Set some parameters
            model.Set(GRB.DoubleParam.MIPGap, 0.01);
            model.Set(GRB.IntParam.JSONSolDetail, 1);

            // Define tags for some variables to access their values later
            int count = 0;
            foreach (GRBVar v in model.GetVars())
            {
                v.VTag = "Variable" + count;
                count += 1;
                if (count >= 10)
                {
                    break;
                }
            }

            // Submit batch request
            batchID = model.OptimizeBatch();

            // Dispose of model and env
        } finally {
            model.Dispose();
            env.Dispose();
        }
        return(batchID);
    }