ULSAlgorithms 1.1.0-g3e5595996d
High-performance exact and heuristic algorithms for uncapacitated lot sizing
Loading...
Searching...
No Matches
Getting Started

Getting Started

ULSAlgorithms is designed around one simple workflow:

1. Create a UlsProblem
2. Choose an IUlsSolver
3. Call Solve
4. Read UlsSolveResult

1. Create the problem

var problem = new UlsProblem(
demands: [20.0, 30.0, 25.0, 40.0],
setupCosts: [200.0, 200.0, 200.0, 200.0],
unitProductionCosts: [0.0, 0.0, 0.0, 0.0],
holdingCosts: [4.0, 4.0, 4.0, 0.0]);
Represents a validated classical uncapacitated lot-sizing problem.
Definition UlsProblem.cs:23

All four arrays have one value per planning period:

Parameter Meaning
demands demand to satisfy in each period
setupCosts fixed cost paid when production starts in a period
unitProductionCosts variable production cost per unit
holdingCosts cost of carrying one unit of end-of-period inventory

Periods are zero-based. Backlogging is not allowed and initial inventory is zero.

2. Choose an algorithm

You can instantiate a concrete strategy directly:

Or use the stable runtime catalog/factory introduced in v0.26.0:

IUlsSolver solver =
UlsSolverFactory.Create("adaptive-exact");
Creates public ULS strategies from stable catalog identifiers.
static IUlsSolver Create(string id)
Creates a new solver using its stable catalog identifier and default constructor policy.

The factory is useful for configuration files, command-line tools, experiment campaigns and user interfaces because client code does not need a compile-time switch over concrete strategy classes.

Every public algorithm still implements the same IUlsSolver contract.

For constructor-level configuration, use the overload introduced in v0.27.0:

var solver =
"lyu-lee-parallel",
{
MaxDegreeOfParallelism = 4,
ParallelThreshold = 256
});
Composes the existing strategy-specific constructor options used by UlsSolverFactory.

See Solver Catalog and Factory for adaptive fallback, external optimization engine and cutting-plane examples.

To persist the selected strategy and its constructor options as a reproducible JSON artifact, see Serializable Solver Configuration.

3. Solve

var result = solver.Solve(problem);

For long-running or solver-backed methods, an optional cancellation token can be passed.

4. Read the result

Console.WriteLine(result.Status);
Console.WriteLine(result.ObjectiveValue);
if (result.Solution is not null)
{
Console.WriteLine(string.Join(", ", result.Solution.ProductionQuantities.ToArray()));
}

Exact methods may return Optimal. Heuristics return Feasible because they do not claim an optimality proof.

What should I read next?