Tutorials

The tutorials provided in the tutorial directory of the ixmp repository walk through the first steps of working with ixmp. You will learn how to create a ixmp.Scenario as a structured data collection for sets, parameters and the numerical solution to the associated optimization problem.

Dantzig’s transportation problem

We use Dantzig’s transport problem [1], which is also used as the standard GAMS tutorial [4]. This problem finds a least cost shipping schedule that meets demand requirements at markets and supply capacity constraints at multiple factories.

The tutorials are provided as Jupyter notebooks for both Python and R, and are identical as far as possible.

  • Tutorial 1: in Python, or in R.

    This tutorial walks through the following steps:

    1. Launch an ixmp.Platform instance and initialize a new ixmp.Scenario.
    2. Define the sets and parameters in the scenario, and commit the data to the platform.
    3. Check out the scenario and initialize variables and equations (necessary for ixmp to import the solution).
    4. Solve the scenario (export to GAMS input gdx, execute, read solution from output gdx).
    5. Display the solution (variables and equation).
  • Tutorial 2: in Python, or in R.

    This tutorial creates an alternate or ‘counterfactual’ scenario of the transport problem; solve it; and compare the results to the original or reference scenario.

See the GAMS API description for an explanation of how the standard GAMS transport problem code is easily adapted for use with ixmp.