4.2.6.1. MiniZincIDE solution visualisation tools

Functions and variable annotations for visualising solutions. This feature is experimental and may not remain backwards compatible.

In this section: ide_launch_server, vis_bar, vis_column, vis_digraph, vis_digraph_highlight, vis_gantt, vis_geost_2d, vis_graph, vis_graph_highlight, vis_line, vis_scatter, vis_scatter_cumulative.

ide_launch_server

1.  test ide_launch_server(string: file)

2.  test ide_launch_server(string: file, string: user_data)
  1. Launch a visualisation server using the given file.

  2. Launch a visualisation server using the given file. The user_data argument must be valid JSON (e.g generated by showJSON).

vis_bar

1.  test vis_bar(array [$$D] of var int: x)

2.  test vis_bar(array [$$D] of var float: x)

3.  test vis_bar(array [$$D] of var int: x,
                 array [$$D] of string: data_labels)

4.  test vis_bar(array [$$D] of var float: x,
                 array [$$D] of string: data_labels)

5.  test vis_bar(array [$$S,$$D] of var int: x)

6.  test vis_bar(array [$$S,$$D] of var float: x)

7.  test vis_bar(array [$$S,$$D] of var int: x,
                 array [$$S] of string: series_labels,
                 array [$$D] of string: data_labels)

8.  test vis_bar(array [$$S,$$D] of var float: x,
                 array [$$S] of string: series_labels,
                 array [$$D] of string: data_labels)
1, 2.
Visualise a bar chart of the values in x (labelled by index set)
3, 4.
Visualise a bar chart of the values in x. Chart values are labelled with data_labels.
5, 6.
Visualise a bar chart with grouped data (labelled by index set). x[i, j] is the value for j in data series i.
7, 8.
Visualise a bar chart with grouped data. x[i, j] is the value for j in data series i. Series are labelled with series_labels. Chart values are labelled with data_labels.

vis_column

1.  test vis_column(array [$$D] of var int: x)

2.  test vis_column(array [$$D] of var float: x)

3.  test vis_column(array [$$D] of var int: x,
                    array [$$D] of string: data_labels)

4.  test vis_column(array [$$D] of var float: x,
                    array [$$D] of string: data_labels)

5.  test vis_column(array [$$S,$$D] of var int: x)

6.  test vis_column(array [$$S,$$D] of var float: x)

7.  test vis_column(array [$$S,$$D] of var int: x,
                    array [$$S] of string: series_labels,
                    array [$$D] of string: data_labels)

8.  test vis_column(array [$$S,$$D] of var float: x,
                    array [$$S] of string: series_labels,
                    array [$$D] of string: data_labels)
1, 2.
Visualise a column chart of the values in x (labelled by index set)
3, 4.
Visualise a column chart of the values in x. Chart values are labelled with data_labels.
5, 6.
Visualise a column chart with grouped data (labelled by index set). x[i, j] is the value for j in data series i.
7, 8.
Visualise a column chart with grouped data. x[i, j] is the value for j in data series i. Series are labelled with series_labels. Chart values are labelled with data_labels.

vis_digraph

1.  test vis_digraph(array [$$E] of $$N: from,
                     array [$$E] of $$N: to,
                     array [$$E] of string: edge_labels,
                     array [$$N] of var bool: ns,
                     array [$$E] of var bool: es)

2.  test vis_digraph(array [$$E] of $$N: from,
                     array [$$E] of $$N: to,
                     array [$$N] of var bool: ns,
                     array [$$E] of var bool: es)

3.  test vis_digraph(array [$$N] of string: node_labels,
                     array [$$E] of $$N: from,
                     array [$$E] of $$N: to,
                     array [$$E] of string: edge_labels,
                     array [$$N] of var bool: ns,
                     array [$$E] of var bool: es)
  1. Create a visualisation of the subgraph ns and es of a given directed graph. The nodes are labelled using the index set of a ns.

    Parameters:

    • from: the leaving node for each edge
    • to: the entering node for each edge
    • edge_labels: labels to use for each edge
    • ns: a Boolean for each node whether it is in the subgraph
    • es: a Boolean for each edge whether it is in the subgraph
  2. Create a visualisation of the subgraph ns and es of a given directed graph. The nodes are labelled using the index set of ns and the edges are labelled using the index set of es.

    Parameters:

    • from: the leaving node for each edge
    • to: the entering node for each edge
    • ns: a Boolean for each node whether it is in the subgraph
    • es: a Boolean for each edge whether it is in the subgraph
  3. Create a visualisation of the subgraph ns and es of a given directed graph.

    Parameters:

    • node_labels: the label for each node
    • from: the leaving node for each edge
    • to: the entering node for each edge
    • edge_labels: labels to use for each edge
    • ns: a Boolean for each node whether it is in the subgraph
    • es: a Boolean for each edge whether it is in the subgraph

vis_digraph_highlight

1.  test vis_digraph_highlight(array [$$E] of $$N: from,
                               array [$$E] of $$N: to,
                               array [$$E] of string: edge_labels,
                               array [$$N] of var bool: ns,
                               array [$$E] of var bool: es)

2.  test vis_digraph_highlight(array [$$E] of $$N: from,
                               array [$$E] of $$N: to,
                               array [$$N] of var bool: ns,
                               array [$$E] of var bool: es)

3.  test vis_digraph_highlight(array [$$N] of string: node_labels,
                               array [$$E] of $$N: from,
                               array [$$E] of $$N: to,
                               array [$$E] of string: edge_labels,
                               array [$$N] of var bool: ns,
                               array [$$E] of var bool: es)
  1. Create a visualisation of the subgraph ns and es of a given directed graph. The nodes are labelled using the index set of a ns. The entire graph is drawn, with the given subgraph highlighted.

    Parameters:

    • from: the leaving node for each edge
    • to: the entering node for each edge
    • edge_labels: labels to use for each edge
    • ns: a Boolean for each node whether it is in the subgraph
    • es: a Boolean for each edge whether it is in the subgraph
  2. Create a visualisation of the subgraph ns and es of a given directed graph. The nodes are labelled using the index set of ns and the edges are labelled using the index set of es. The entire graph is drawn, with the given subgraph highlighted.

    Parameters:

    • from: the leaving node for each edge
    • to: the entering node for each edge
    • ns: a Boolean for each node whether it is in the subgraph
    • es: a Boolean for each edge whether it is in the subgraph
  3. Create a visualisation of the subgraph ns and es of a given directed graph. The entire graph is drawn, with the given subgraph highlighted.

    Parameters:

    • node_labels: the label for each node
    • from: the leaving node for each edge
    • to: the entering node for each edge
    • edge_labels: labels to use for each edge
    • ns: a Boolean for each node whether it is in the subgraph
    • es: a Boolean for each edge whether it is in the subgraph

vis_gantt

1.  test vis_gantt(array [$$E] of var int: start,
                   array [$$E] of var int: dur)

2.  test vis_gantt(array [$$E] of var int: start,
                   array [$$E] of var int: dur,
                   array [$$E] of string: labels)

3.  test vis_gantt(array [$$E] of var int: start,
                   array [$$E] of var int: dur,
                   array [$$E] of string: labels,
                   array [$$E] of string: colors)
  1. Visualise a Gantt chart of tasks with start times start and durations dur. The tasks are labelled using the index set of start.

  2. Visualise a Gantt chart of tasks with start times start and durations dur. The tasks are labelled using labels.

  3. Visualise a Gantt chart of tasks with start times start and durations dur. The tasks are labelled using labels and given the colours colors.

vis_geost_2d

1.  test vis_geost_2d(array [$$E] of int: rect_x,
                      array [$$E] of int: rect_y,
                      array [$$E] of int: rect_dx,
                      array [$$E] of int: rect_dy,
                      array [$$K] of set of $$E: shape,
                      array [$$T] of var int: x,
                      array [$$T] of var int: y,
                      array [$$T] of var $$K: kind)

2.  test vis_geost_2d(array [$$E,1..2] of int: rect_size,
                      array [$$E,1..2] of int: rect_offset,
                      array [$$K] of set of $$E: shape,
                      array [$$T,1..2] of var int: x,
                      array [$$T] of var $$K: kind)
  1. Visualise the positions of 2-dimensional objects which take a particular shape composed of rectangles.

    Parameters:

    • rect_x: x-position of each rectangle
    • rect_y: y-position of each rectangle
    • rect_dx: width of each rectangle
    • rect_dy: height of each rectangle
    • shape: the rectangles which comprise each shape
    • x: the x-position of each object
    • y: the y-position of each object
    • kind: which shape each object is
  2. Visualise the positions of 2-dimensional objects which take a particular shape composed of rectangles.

    Parameters:

    • rect_size: the size of each rectangle
    • rect_offset: the position of each rectangle
    • shape: the rectangles which comprise each shape
    • x: the position of each object
    • kind: which shape each object is

vis_graph

1.  test vis_graph(array [$$E] of $$N: from,
                   array [$$E] of $$N: to,
                   array [$$E] of string: edge_labels,
                   array [$$N] of var bool: ns,
                   array [$$E] of var bool: es)

2.  test vis_graph(array [$$E] of $$N: from,
                   array [$$E] of $$N: to,
                   array [$$N] of var bool: ns,
                   array [$$E] of var bool: es)

3.  test vis_graph(array [$$N] of string: node_labels,
                   array [$$E] of $$N: from,
                   array [$$E] of $$N: to,
                   array [$$E] of string: edge_labels,
                   array [$$N] of var bool: ns,
                   array [$$E] of var bool: es)
  1. Create a visualisation of the subgraph ns and es of a given undirected graph. The nodes are labelled using the index set of ns.

    Parameters:

    • from: the leaving node for each edge
    • to: the entering node for each edge
    • edge_labels: labels to use for each edge
    • ns: a Boolean for each node whether it is in the subgraph
    • es: a Boolean for each edge whether it is in the subgraph
  2. Create a visualisation of the subgraph ns and es of a given undirected graph. The nodes are labelled using the index set of ns and the edges are labelled using the index set of es.

    Parameters:

    • from: the leaving node for each edge
    • to: the entering node for each edge
    • ns: a Boolean for each node whether it is in the subgraph
    • es: a Boolean for each edge whether it is in the subgraph
  3. Create a visualisation of the subgraph ns and es of a given undirected graph.

    Parameters:

    • node_labels: the label for each node
    • from: the leaving node for each edge
    • to: the entering node for each edge
    • edge_labels: labels to use for each edge
    • ns: a Boolean for each node whether it is in the subgraph
    • es: a Boolean for each edge whether it is in the subgraph

vis_graph_highlight

1.  test vis_graph_highlight(array [$$E] of $$N: from,
                             array [$$E] of $$N: to,
                             array [$$E] of string: edge_labels,
                             array [$$N] of var bool: ns,
                             array [$$E] of var bool: es)

2.  test vis_graph_highlight(array [$$E] of $$N: from,
                             array [$$E] of $$N: to,
                             array [$$N] of var bool: ns,
                             array [$$E] of var bool: es)

3.  test vis_graph_highlight(array [$$N] of string: node_labels,
                             array [$$E] of $$N: from,
                             array [$$E] of $$N: to,
                             array [$$E] of string: edge_labels,
                             array [$$N] of var bool: ns,
                             array [$$E] of var bool: es)
  1. Create a visualisation of the subgraph ns and es of a given undirected graph. The nodes are labelled using the index set of ns. The entire graph is drawn, with the given subgraph highlighted.

    Parameters:

    • from: the leaving node for each edge
    • to: the entering node for each edge
    • edge_labels: labels to use for each edge
    • ns: a Boolean for each node whether it is in the subgraph
    • es: a Boolean for each edge whether it is in the subgraph
  2. Create a visualisation of the subgraph ns and es of a given undirected graph. The nodes are labelled using the index set of ns and the edges are labelled using the index set of es. The entire graph is drawn, with the given subgraph highlighted.

    Parameters:

    • from: the leaving node for each edge
    • to: the entering node for each edge
    • ns: a Boolean for each node whether it is in the subgraph
    • es: a Boolean for each edge whether it is in the subgraph
  3. Create a visualisation of the subgraph ns and es of a given undirected graph. The entire graph is drawn, with the given subgraph highlighted.

    Parameters:

    • node_labels: the label for each node
    • from: the leaving node for each edge
    • to: the entering node for each edge
    • edge_labels: labels to use for each edge
    • ns: a Boolean for each node whether it is in the subgraph
    • es: a Boolean for each edge whether it is in the subgraph

vis_line

1.  test vis_line(var int: x, string: label)

2.  test vis_line(var float: x, string: label)

3.  test vis_line(array [$$E] of var int: x)

4.  test vis_line(array [$$E] of var float: x)

5.  test vis_line(array [$$E] of var int: x,
                  array [$$E] of string: series_labels)

6.  test vis_line(array [$$E] of var float: x,
                  array [$$E] of string: series_labels)

7.  test vis_line(array [$$E] of var int: x,
                  array [$$E] of var int: y,
                  string: x_label,
                  string: y_label)

8.  test vis_line(array [$$E] of var float: x,
                  array [$$E] of var float: y,
                  string: x_label,
                  string: y_label)
1, 2.
Add a line graph of x with respect to solution time, labelling the trace label.
3, 4.
Add line graphs of the values in x with respect to solution time on the same axes, labelling the series using their index.
5, 6.
Add line graphs of the values in x with respect to solution time on the same axes, labelling the series with series_labels.
7, 8.
Add a line graph of x against y, labelling the axes x_label and y_label respectively.

vis_scatter

test vis_scatter(array [$$E] of var int: x,
                 array [$$E] of var int: y,
                 string: x_label,
                 string: y_label)
test vis_scatter(array [$$E] of var float: x,
                 array [$$E] of var float: y,
                 string: x_label,
                 string: y_label)
Add a scatter plot of x against y, labelling the axes x_label and y_label respectively.

vis_scatter_cumulative

1.  test vis_scatter_cumulative(var int: x,
                                var int: y,
                                string: x_label,
                                string: y_label,
                                string: series_label)

2.  test vis_scatter_cumulative(var float: x,
                                var float: y,
                                string: x_label,
                                string: y_label,
                                string: series_label)

3.  test vis_scatter_cumulative(array [$$E] of var int: x,
                                array [$$E] of var int: y,
                                string: x_label,
                                string: y_label)

4.  test vis_scatter_cumulative(array [$$E] of var float: x,
                                array [$$E] of var float: y,
                                string: x_label,
                                string: y_label)

5.  test vis_scatter_cumulative(array [$$E] of var int: x,
                                array [$$E] of var int: y,
                                string: x_label,
                                string: y_label,
                                array [$$E] of string: series_labels)

6.  test vis_scatter_cumulative(array [$$E] of var float: x,
                                array [$$E] of var float: y,
                                string: x_label,
                                string: y_label,
                                array [$$E] of string: series_labels)
1, 2.

Create a scatter-plot visualisation. The point (x, y) is added to the plot for each solution.

Parameters:

  • x: the x coordinate
  • y: the y coordinate
  • x_label: the x-axis label
  • y_label: the y-axis label
  • series_label: the series label
3, 4.

Create a scatter-plot visualisation with multiple series. The point (x[i], y[i]) for each series i is added to the plot for each solution. Series are labelled using the index set of x and y.

Parameters:

  • x: the x coordinate for each series
  • y: the y coordinate for each series
  • x_label: the x-axis label
  • y_label: the y-axis label
5, 6.

Create a scatter-plot visualisation with multiple series. The point (x[i], y[i]) for each series i is added to the plot for each solution.

Parameters:

  • x: the x coordinate for each series
  • y: the y coordinate for each series
  • x_label: the x-axis label
  • y_label: the y-axis label
  • series_labels: the label for each series