Comparing schedules from scenarios

We want to compare schedules from different scenarios.

We use a flowshop model example, which you can download from the link below.

We’ll show the result for the end user, and how to achieve it as a developer.

Comparison as end user

  1. Select cases via data manager

    ../../_images/SelectingCaseViaDataManager.png

    Select an active case. For every case to compare, click Compare case.

  2. Select cases to show via scalar widget

    ../../_images/SelectingCasesForTopBottomPresentation.png

    Select a case to show in the top Gantt Chart, and one to show in the bottom Gantt Chart.

  3. Compare schedules visually

    ../../_images/SchedulesFromTwoScenarios.png

The result is a visual comparison of schedules.

Developer Steps

  1. Select cases to compare (two or more) and show the selected cases in a scalar widget.

  2. Cache the information about the schedules in the model.

  3. Create two WebUI Gantt Chart widgets.

    1. The Gantt info is based on the cached info stored in second step.

    2. Slice this information per Gantt Chart using the element parameters from the first step.

These steps are explained in detail below.

Select cases to compare

Use the predeclared set CurrentCaseSelection for all cases you selected to be compared. Declare as follows:

1Set CurrentCaseSelection {
2    SubsetOf: AllCases;
3    Text: "The set of cases selected from within the GUI";
4    Index: IndexCurrentCaseSelection;
5}

Note the index IndexCurrentCaseSelection; we will use this index below to declare data over all cases.

This set is filled using the dialog of the “Data Manager” tool of the AIMMS WebUI. Once a user filled this set, he can select the case for the schedule shown in the top Gantt Chart, and similarly, the case for the schedule shown in the bottom Gantt Chart.

This is simply a matter of element parameters selecting a value in CurrentCaseSelection. The scalar widget, for elements in AllCases shows the case name; so we don’t have to do the number-to-name conversion ourselves here.

The element parameters are declared as follows:

1ElementParameter ep_ReferenceTopCase {
2    Range: CurrentCaseSelection;
3}
4ElementParameter ep_ReferenceBottomCase {
5    Range: CurrentCaseSelection;
6}

As we do not want to show such identifier names in the user interface, we use translation table MainProject\WebUI\resources\identifier-translation.properties with the following contents:

1ep_ReferenceTopCase = Select Schedule for top
2ep_ReferenceBottomCase = Select Schedule for bottom

Cache data for schedules

The WebUI requires identifier references for the start and duration of the Gantt Charts; that is data that is stored in the model. Thus we need to cache data from the cases selected to the model. The AIMMS modeling languages uses dot-notation to refer to data in cases as follows:

1Parameter p_case_GCJobStart {
2    IndexDomain: (IndexCurrentCaseSelection,j,m);
3    Definition: IndexCurrentCaseSelection.p_GCJobStart(j, m);
4}
5Parameter p_case_GCJobDuration {
6    IndexDomain: (IndexCurrentCaseSelection,j,m);
7    Definition: IndexCurrentCaseSelection.p_GCJobDuration(j, m);
8}

Here we see the index IndexCurrentCaseSelection again, varying over all cases in CurrentCaseSelection. In the definition of these two parameters it is followed by a “.”; hence the name dot-notation. The “.” is then followed by an ordinary identifier reference.

Using this definition, AIMMS will fill the parameters p_case_GCJobStart and p_case_GCJobDuration with the schedules stored in the case files.

Create Gantt Chart widgets

Now we create the two Gantt Chart widgets, both with Gantt data:

  • Start: p_case_GCJobStart

  • Duration: p_case_GCJobDuration

Using identifier settings on both these parameters, the index IndexCurrentCaseSelection is sliced using the element parameters ep_ReferenceTopCase and ep_ReferenceBottomCase for the top and bottom Gantt Chart widgets respectively.

This should give the desired result as shown at the end of our user story.

Further reading

  1. Managing multiple case selections

  2. AIMMS The Language Reference, search for “Case referencing” in Lexical Conventions

  3. The WebUI widget