Implementation

This page discusses:

Manual

The following shows the overview of the manual model additions that were required for the optimizer implementation:


HiGHS Implementation

This section talks about the code used for optimizing a single iteration once the objective is fixed to a certain linearization.

There are multiple classes in the model to enable optimization with a linearized objective. There are several manual model classes:

  • MeioEngine: a class that owns the entire manual model and acts as a connector to the rest of the supply plan.
  • MeioNode: a class that represents a single node in the MEIO framework; acts as a parent class.
    • MeioNodeItemInStockLocation: a subclass of MeioNode that represents a location where inventory can be held.
    • MeioNodeTransportation: a subclass of MeioNode that represents a transport operation.
    • MeioNodeProduction: a subclass of MeioNode that represents a production operation.
    • MeioNodePurchasing: a subclass of MeioNode that represents a purchasing operation.
    • MeioNodeDemand: a subclass of MeioNode that represents a demand source.
  • MeioEdge: a class that represents a connection between two nodes in the MEIO framework - an upstream and a downstream immediate successor.
  • MeioDemandDependency: a class that represents a dependency between two nodes - a MeioNodeDemand and some upstream supplying node.

Moreover, there is an optimizer package to enable integration with HiGHS and optimization:

  • Optimizer: a class that orchestrates optimization.
  • Suboptimizer: a class that represents the suboptimizer component that is used in a single iteration of the optimizer.
  • Model: a class that converts MeioEngine and its network into a mathematical programming model managed by HiGHS; has a solve method that calls the HiGHS solver on the instance.
  • ScopeMeioNodes: a class that represents the set of MeioNodes that the optimizer is operating on.
  • MeioNodeElement: a class that represents an element of the scope that corresponds to a MeioNode.
  • RunMetrics: a class that represents the settings and collects some global outcomes of the optimizer run.
  • StopCriterionOpt: a class that implements the optimizer stopping criteria.

In addition, some changes have been made to related classes: ItemInStockLocation, SupplyPlan. Also, integration classes such as MeioDataGenerator, MeioTestDataGenerator, and CsvExporter were created. Finally, plenty of tests were added, both in the MEIO package and in a separate HiGHS test class.

The details of attributes and methods in each class are documented inside the code.

Adding Linearization Points

This section talks about the code used for evaluating the end of an iteration where linearization points are evaluated and added wherever required.

New classes were implemented to enable interaction with MeioModel:

  • MeioOptimizer: a class that iteratively solves consecutive instances of MeioModel until a satisfactory solution is found; new linearization points are added after each iteration.
  • MeioOptimizerIteration: a helper class to enable iteration-by-iteration tracker export.

With MeioOptimizer, you can specify the maximum number of iterations, the maximum time spent in a single iteration or the maximum total time spent on optimization. In addition, the class implements the logic to increase the runtime of the optimizer after no-improvement iterations and keeps track of run statistics.

The details of attributes and methods in each class are documented inside the code.