Examples : LoadJsonExample.cs
using System;
using VRSolver;
namespace Examples
{
/// <summary>
/// An example showing how to load a Problem from a JSON data file.
/// </summary>
internal class LoadJsonExample
{
internal void Start()
{
//
// Load the Problem from a JSON file
//
Problem problem = Problem.Load("ExampleData\\Demo-A.json");
//
// Create the Solver and solve the Problem
//
Solver solver = new Solver
{
// Set the maximum time to give the solver
MaximumSolveTime = new TimeSpan(0, 0, 5)
};
//
// The Solve method returns a Solution object which contains the Job
// assignments and schedules for each Resource
//
Console.WriteLine("Starting solver...");
Solution solution = solver.Solve(problem);
Console.WriteLine("Solver finished. Solution = " + solution.ObjectiveFunctionValue);
//
// Write the solution to text file
//
WriteSolutionExample.WriteSolution(solution, "Solution.txt");
}
}
}