# Linear Programming (Array Input) (G Dataflow)

Solves a linear programming problem. This node uses arrays to represent the linear function to optimize and the constraints.

To solve the optimization problem, an optimal vector must exist. This node returns an error if an optimal vector does not exist.  ## linear function to maximize

Vector describing the linear function to maximize. ## constraint matrix

Matrix describing the different constraints. ## constraint inequalities

Vector describing the right sides of the constraints inequalities. ## optimization problem

Optimization problem this node solves.

Name Description
Maximize Solves a maximization problem.
Minimize Solves a minimization problem.

Default: Maximize ## error in

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error  If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Default: No error ## optimization cost

Maximum or minimum value, if it exists, of the solution vector under the constraints. ## solution

Solution vector. ## error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error  If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

## How this Node Solves an Optimization Problem

Given that optimization problem is set to Maximize, the following equation defines the optimization problem this node solves.

cx = max!

with the constraints x ≥ 0 and Mxb.

where

• c is linear function to maximize
• x is solution
• M is constraint matrix
• b is constraint inequalities

The solution to a linear programming problem is a two-step process. This node completes the following steps to solve a linear programming problem.

1. Transforms the original problem into a problem in restricted normal form, essentially without inequalities in the formulation.
2. Solves the restricted normal form problem.

## How to Represent Constraints Using Arrays

This node uses constraint matrix and constraint inequalities to represent the constraints under which you want to optimize linear function to maximize. You must first organize the constraints in terms of formulas, and then convert the formulas to arrays. The following table explains how to convert the formulas to constraint matrix and constraint inequalities:

 Formulas constraint matrix constraint inequalities -0.53 * t1 - 1.07 * t2 - 0.4 * t3 >= -180 -0.53 -1.07 -0.4 -180 t1 >= 30 1 0 0 30 t2 >= 30 0 1 0 30 t3 >= 30 0 0 1 30 -t1 - t2 - t3 >= -180 -1 -1 -1 -180 Note

The formulas can only contain ≥. For example, use -dx ≥ -e instead of dxe, and use the combination of dxe and -dx ≥ -e instead of dx = e.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported

Web Server: Not supported in VIs that run in a web application