Table Of Contents

Linear Programming (Formula Input) (G Dataflow)

Last Modified: January 12, 2018

Solves a linear programming problem. This node uses formulas 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.

connector_pane_image
datatype_icon

objective function

Formula that defines the objective function.

The formula can contain any number of valid variables, but can only be a homogenous linear function of the variables.

Entering Valid Variables

This node accepts variables that use the following format rule: variables must start with a letter or an underscore followed by any number of alphanumeric characters or underscores.

datatype_icon

subject to constraints

Constraints under which you want to optimize the objective function. The formula can contain any number of valid variables.

You must enter inequalities in subject to constraints. The inequalities can only contain >= or <=. For example, enter the combination of x + 2y >= 3 and x + 2y <= 3 instead of x + 2y = 3. The left side of the inequalities can only be a homogenous linear function of variables, and the right side of the inequalities can only contain constants.

Entering Valid Variables

This node accepts variables that use the following format rule: variables must start with a letter or an underscore followed by any number of alphanumeric characters or underscores.

datatype_icon

optimization problem

Optimization problem this node solves.

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

Default: Maximize

datatype_icon

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

datatype_icon

optimization cost

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

datatype_icon

solution

Solution vector. The nth element in solution returns the optimal solution of the nth element in objective function.

datatype_icon

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

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.

This node solves the optimization problem with the constraint that all variables should be nonnegative, and the constraint you specify in subject to constraints.

To find the minimum value of f(x, y) = x + y under the constraint x ≥ 0 and y ≥ 2, enter the following values on the panel:

objective function x + y
subject to constraints (x >= 0, y >= 2)

This node returns 2 as optimization cost and (0, 2) as solution, where the nth element in solution is the optimal solution of the nth variable in objective function.

Where This Node Can Run:

Desktop OS: Windows

FPGA: This product does not support FPGA devices

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


Recently Viewed Topics