Creating custom inventory policy

With the help of AnyLogic we can create custom objects, policies, algorithms used by policies that will be available in anyLogistix.

Open AnyLogic from anyLogistix by clicking Extensions in the menu and selecting Create New... .

Anylogic will open with the Objects model. Let us create a new Java class which we will use to define the custom inventory policy.
  1. Right click the Objects model title to open a pop-up menu.
  2. Click the New menu item and select Java class. The New Java Class dialog box will open.
  3. Type RandomQPolicy in the Name field.
  4. Click Finish. New Java class will be created with the specified name.
    Code editor for the created class will be automatically opened.
Developers created Objects model for a more convenient use. It contains a number of interfaces for creating custom ALX objects. The general pattern of the inventory policy is declared in the IInventoryPolicyType interface, that is stored in the ALX_lib library. To integrate our custom inventory policy into ALX we must make sure that it conforms to this particular interface and implements all the methods defined in it, in other words we will need to override all the methods declared in this interface.

Sadly, creating custom objects requires strong programming skills. We will guide you through the process of setting up a custom inventory policy.

Define a custom inventory policy

  1. Add IInventoryPolicyType interface to the created class:

  2. Now we need to define the parameters of our policy. We want to create a custom RQ policy, which means that we need to create two parameters:

    Create the replenishment point parameter r of type double and we will also specify editor it will be using (DoubleEditor) and its name (R) in the ALX user interface.

  3. Now we will add all the required methods for this interface with the help of autocomplete and modify them as shown on the screenshots below each method:

We have completed creating our custom inventory policy. Now we need to connect the new policy to ALX to make it available in the list of inventory policies.

Export the new policy
  1. Right-click the Objects library icon in the Projects view and choose Export Library from the pop-up menu. 

  2. The Export Library dialog box will open.

  3. Specify the library file name (including the full path to it) in the Library File Name edit box. You may browse for the folder where you want to store your file using the Browse button.

  4. Click Finish. You will see the message dialog box informing you that the library was successfully exported.

The exported library file must be placed into the ALX folder.

Relocate the exported library file

  1. Copy Objects.jar to C:\Users\USERNAME\.anyLogistix\Extensions folder.
Finally, restart anyLogistix to load the new policy.

Apply the custom policy

  1. Navigate to the Inventory table.
  2. Double-click the cell in the Policy Type column to select RandomQPolicy from the list of available policies.
  3. The Policy Parameters column will now contain the parameters of the selected policy.
  4. Define the policy parameters to start using it in your supply chain.