transitionMatrix

Creates a new square matrix of minimum transition times.

Syntax

Parameters

The function transitionMatrix takes a square number of int arguments. To simplify code generation, a trailing comma at the end of a non-empty list is allowed.

Description

Use transitionMatrix to enforce the minimum transition times using stateFunction or noOverlap constraint. It is a square matrix, therefore it takes a square number of int arguments. If m values are given, then the matrix size n is square root of m.

The values must be lexicographically ordered by the pair of indices (i,j) where i is the row number and j is the column number (both are counted from zero). In another words, the matrix value on position (i,j) is given as (i*n+j) argument.

Example

Transition matrix of size 5 with values m[i,j]=abs(i-j):


m = transitionMatrix(
             0, 1, 2, 3, 4,
             1, 0, 1, 2, 3,
             2, 1, 0, 1, 2,
             3, 2, 1, 0, 1,
             4, 3, 2, 1, 0);

Example

Non-symmetric matrix of size 4 with trailing comma:


m = transitionMatrix(
          21, 23,  7, 25,
           4, 25, 12, 17,
          17,  2, 26,  4,
          25, 10, 13, 27,);

For example, the value m[1, 2] is 12.

Requirements

  • The number of arguments must be a square number.

Notes

It is possible to not specify any value. In this case, the matrix size is 0 and a trailing comma is not allowed.