Documentation

# `linopt`::`plot_data`

Plot the feasible region of a linear program

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```linopt::plot_data(`[constr, obj, <NonNegative>, <seti>]`, `vars`)
linopt::plot_data(`[constr, obj, <NonNegative>, <All>]`, `vars`)
linopt::plot_data(`[constr, obj, <setn>, <seti>]`, `vars`)
linopt::plot_data(`[constr, obj, <setn>, <All>]`, `vars`)
```

## Description

`linopt::plot_data([constr, obj], vars)` returns a graphical description of the feasible region of the linear program [constr, obj], and the line vertical to the objective function vector through the corner with the maximal objective function value found.

[`constr`, `obj`] is a linear program with exactly two variables. The problem has the same structure like in `linopt::maximize`. The second parameter `vars` specifies which variable belongs to the horizontal and vertical axis.

## Examples

### Example 1

We plot the feasible region of the given linear program. Here the valid corners of the linear program are easy to see:

```k := [{2*x + 2*y >= 4, -2*x + 4*y >= -2, -2*x + y >= -8, -2*x + y <= -2, y <= 6}, x + y, NonNegative]: g := linopt::plot_data(k, [x, y]): plot(g):```

In this example there is no difference if the Option `NonNegative` is given for the linear program or not:

```k := [{2*x + 2*y >= 4, -2*x + 4*y >= -2, -2*x + y >= -8, -2*x + y <= -2, y <= 6}, x + y]: g := linopt::plot_data(k, [x, y]): plot(g):```

`delete k, g:`

### Example 2

Now we give an example where one can see a difference if the variables are constrained to be nonnegative:

```k := [{x + y >= -1, x + y <= 3}, x + 2*y]: g := linopt::plot_data(k, [x, y]): plot(g):```

```k := [{x + y >= -1, x + y <= 3}, x + 2*y, NonNegative]: g := linopt::plot_data(k, [x, y]): plot(g):```

`delete k, g:`

## Parameters

 `constr` A set or list of linear constraints `obj` A linear expression `seti` A set which contains identifiers interpreted as indeterminates `setn` A set which contains identifiers interpreted as indeterminates `vars` A list containing the two variables of the linear program described by `constr` and `obj` and the existing options

## Options

 `All` All variables are constrained to be integer `NonNegative` All variables are constrained to be nonnegative

## Return Values

Expression describing a graphical object which can be used by `plot`.

## References

Papadimitriou, Christos H; Steiglitz, Kenneth: Combinatorial Optimization; Algorithms and Complexity. Prentice-Hall, 1982.

Nemhauser, George L; Wolsey, Laurence A: Integer and Combinatorial Optimization. New York, Wiley, 1988.

Salkin, Harvey M; Mathur, Kamlesh: Foundations of Integer Programming. North-Holland, 1989.

Neumann, Klaus; Morlock, Martin: Operations-Research. Munich, Hanser, 1993.

Duerr, Walter; Kleibohm, Klaus: Operations Research; Lineare Modelle und ihre Anwendungen. Munich, Hanser, 1992.

Suhl, Uwe H: MOPS - Mathematical OPtimization System. European Journal of Operational Research 72(1994)312-322. North-Holland, 1994.

Suhl, Uwe H; Szymanski, Ralf: Supernode Processing of Mixed Integer Models. Boston, Kluwer Academic Publishers, 1994.