Learn R Programming

lintools (version 0.1.7)

is_feasible: Check feasibility of a system of linear (in)equations

Description

Check feasibility of a system of linear (in)equations

Usage

is_feasible(A, b, neq = nrow(A), nleq = 0, eps = 1e-08, method = "elimination")

Arguments

A

[numeric] matrix

b

[numeric] vector

neq

[numeric] The first neq rows in A and b are treated as linear equalities.

nleq

[numeric] The nleq rows after neq are treated as inequations of the form a.x<=b. All remaining rows are treated as strict inequations of the form a.x<b.

eps

[numeric] Absolute values < eps are treated as zero.

method

[character] At the moment, only the 'elimination' method is implemented.

Examples

Run this code
# An infeasible system:
# x + y == 0
# x > 0
# y > 0
A <- matrix(c(1,1,1,0,0,1),byrow=TRUE,nrow=3)
b <- rep(0,3)
is_feasible(A=A,b=b,neq=1,nleq=0)

# A feasible system:
# x + y == 0
# x >= 0
# y >= 0
A <- matrix(c(1,1,1,0,0,1),byrow=TRUE,nrow=3)
b <- rep(0,3)
is_feasible(A=A,b=b,neq=1,nleq=2)

Run the code above in your browser using DataLab