### HEURISTIC METHOD (2 variables) - pre-alpha TI83 version

 This project is in development, this is an alpha version.This method is inspired by Data Envelopment Analysis, and it intended to be applied in Linear Programming for a Maximization setup where two variable objective function and high number of constraints. maximize Z, which is the objective function where Z = C * X AND A * X ≤ b where C, X, and b are vectors; and A is a Matrixe.g. max Z; C1* X1 + C2* X2 = Z A1* X1 + A2* X2 ≤ b1 A3* X1 + A4* X2 ≤ b2 A5* X1 + A5* X2 ≤ b3 INPUT C = { C1, C2 } = L1 b = { b1, b2, b3 } = L2 A = [ A1 A2         A3 A4         A5 A6 ] = [A] OUTPUT X = [ X1 X2 ] = LE Z = Z  This code is written for a TI83 calculator`Dim(L1)→N``Dim(L2)→M``M→Dim(L6)``M→Dim(LA)``M→Dim(L8)``{M,N,}→Dim[B]``FOR(C,1,M,1)`` FOR(D,1,N1,)``  [A](C,D)/L2(C)→[B](C,D)`` END``END``0→X``0→Y``0→Z``FOR(C,1,M,1)`` FOR(D,1,N,1)``  ([B](C,D)-L1(D))^2+X→X``  [B](C,D)^2+Y→Y``  L1(D)^2+Z→Z`` END`` √(X)→L6(C)`` 0→X`` √(Y)→LA(C)`` 0→Y `` √(Z)→Z``END``FOR(C,1,M,1)`` (LA(C)^2-L6(C)^2-Z^2)/(-2*L6(C)*Z)→L8(C)`` L6(C)*L8(C)→L9(C)`` COS^-1(L8(C))→L8(C)``END``0→Dim(LB)``N→Dim(LB)``0→Dim(L7)``0→X``0→Dim(LF)``0→Dim(LE)``DISP"CALCULATING SMALLEST PROJECTED DISTANCE"``FOR(C,1,M,1)`` IF L9(C)=MIN(L9)``  THEN``  X+1→X``  X→Dim(LF)``  X→Dim(LE)``  C→LF(X)``  L8(C)→LE(X)`` END``END``DISP"CALCULATING SMALLEST ANGLE FOR SMALLEST PROJECTED DISTANCE"``FOR (C,1,X,1)`` IF LE(C)``  THEN``  LF(C)→K`` END``END``0→Dim(LB)``0→X``0→Y``DISP"VERIFY BOUNDARIES FORMED BY FIRST CONSTRAINT REFERENCE"``FOR (C,1,M,1)`` IF C ``≠`` K``  THEN``  FOR (D,1,N,1)``   IF [B](C,D)<[B](K,D)``    THEN``    X+1→X``   END``   IF X=N``    THEN``    Y+1→Y``    Y→Dim(LB)``    C→LB(Y)``   END``  END`` END``END``0→S``IF Dim(LB)=(M-1)`` THEN`` 1→S``END``DISP"MAPPING OF BACK-UP CONSTRAINTS"``0→X``0→Y``[B](K,1)→[B](M+1,1)``0→[B](M+1,2)``0→[B](M+2,1)``[B](K,2)→[B](M+2,2)``M→T``FOR(C,1,2,1)`` FOR(D,1,N,1)``  ([B](C+T,D)-L1(D))^2+X→X``  [B](C+T,D)+Y→Y`` END`` √(X)→L6(C+T)`` 0→X`` √(Y)→LA(C+T)`` 0→Y``END``O→Q``2→Dim(LF)``FOR(C,1,2,1)`` FOR(D,1,N,1)``  ([B](K,D)-[B]((C+T),D))^2+Q→Q`` END`` √(Q)→LF(C)`` 0→Q``END``FOR(C,1,2,1)`` (LF(C)^2-L6(C+T)^2-L6(K)^2)/(-2*L6(C+T)*L6(K))→V`` COS^-1(V)→V`` (LA(C+T)^2-Z^2-L6(C+T)^2)/(-2*Z*L6(C+T))→W`` COS^-1(W)→W`` IF(L8(K)+W=V``  THEN ``  C+T→L`` END``END``DISP"BACK-UP CONSTRAINTS AVAILABLE"``IF S=1`` THEN`` DISP"FIRST CONSTRAINT REFERENCE PROVIDES BOUNDS FOR SOLUTION, BACK-UP CONSTRAINTS USED TO DETERMINE SOLUTION"`` {N,N}→Dim[C]`` ``  FOR(D,1,2,1)``   [B](K,D)→[C](1,D)``   [B](L,D)→[C](2,D)``  END``  `` 0→J`` N→Dim(L6)`` [C]^-1→[C]`` ``  FOR(C,1,2,1)``   ``   FOR(D,1,2,1)``    [C](C,D)+J→J``   END``   ``  J→L6(C)``  0→J``  END``  ``  0→Z``  ``  FOR(C,1,N,1)``   L1(C)*L6(C)+Z→Z``  END``  ``  DISP"OPTIMAL QUANTITIES FOR EACH VARIABLE ARE"``  DISP L6``  DISP"OPTIMAL SOLUTION IS"``  DISP Z``END `` ``DISP"BEGIN REPLACING PRIMARY CONSTRAINTS IN A NEW MATRIX AND ERASING SECONDARY CONSTRAINTS"``Dim[B]→Dim[D]``Dim[LB]→Y``I→0``FOR(C,1,T+2,1)`` X→0`` ``  FOR(E,1,Y,1)``  ``   IF C ``≠`` LB(E)``    THEN``    X+1→X``    ``     IF X=Y``      THEN``      I+1→I``      I→Dim LC``      C→LC(I)``      ``       IF C=K``        THEN``        I→K``       END``       ``       IF C=L``        THEN``        I→L``       END``     END``   END``  END``END``T+2-Y→T``FOR(C,1,T,1)`` FOR(D,1,N,1)``  [B](LC(C),D)→[D](C,D)`` END``END `` ``{T,N}→[D]``DISP"RECACULATING DISTANCES"``0→X``0→Y``T→Dim(L6)``T→Dim(LA)``T→Dim(L8)``FOR(C,1,T,1)`` FOR(D,1,N,1)``  ([D](C,D)-L1(D))^2+X→X``  [B](C,D)^2+Y→Y`` END`` √(X)→L6(C)`` 0→X`` √(Y)→LA(C)`` 0→Y``END``FOR(C,1,M,1)`` (LA(C)^2-LC(C)^2-Z^2)/(-2*L6(C)*Z)→L8(C)`` L6(C)*L8(C)→L9(C)`` COS^-1(L8(C))→L8(C)``END``0→X``DISP"BEGIN LOCATING NEXT REFERENCE CONSTRAINT"``T→Dim(LK)``0→Dim(L4)``FOR(C,1,T,1)`` FOR(D,1,N,1)``  ([D](C,D)-[D](K,D))^2+X→X`` END`` √(X)→LK(C)``END``0→X``FOR(C,1,T,1)`` IF C ``≠`` K``  THEN``  FOR(D,1,N,1)``   (LK(C)^2-LA(K)^2-LA(C)^2)/(-2*LA(K)*LA(C))→V``   COS^-1(V)→V``  END``  IF L8(K)+L8(C)=V``   THEN``   X+1→X``   X→Dim(L4)``   C→L4(X)``  END`` END``END``X→Dim(L7)``FOR (C,1,X,1)`` SIN^-1((L9(L4(C))-L9(K))/(LK(L4(C))))→L7(C)``END``FOR(C,1,X,1)`` IF L7(C)=MIN L7``  THEN``  L4(C)→J`` END``END``END``{N,N}→Dim[C]``FOR(D,1,2,1)`` [D](K,D)→[C](1,D)`` [D](J,D)→[C](2,D)``END``0→E``N→Dim(L6)``[C]^-1→[C]``FOR(C,1,2,1)`` FOR(D,1,2,1)``  [C](C,D)+J→J`` END`` J→L6(C)`` 0→J``END``0→Z``FOR(C,1,N,1)`` L1(C)*L6(C)+Z→Z``END``DISP"OPTIMAL QUANTITIES FOR EACH VARIABLE ARE"``DISP L6``DISP"OPTIMAL SOLUTION IS"``DISP Z`