### Trig Heuristic Method - Alpha V1.0 - C++ version - 11/18/15

 `//Project starts here: special case when objective variable distance to the origin intersects the k-th constraints is not yet address here``//Two variable optimization project, which includes more than three constrains``#include // std::cout, std::cin``#include // std:: sqrt, std::pow, std::abs``using namespace std;``int i=0, j=0; // incremental operators``int a=0; // incremental operator in an array that is used to record the smallest angle for the shortest distance gamma, among equally small angles``int b=0; // incremental operator used to organize constraints bound by the k-th constraint; these constraints are below a threshold that requires them to considered in the set of primary constraints``int f=0; // incremental operators``int r=0; // operator set to sum the number of primary reference constraints, which excludes erased secondary set of reference constraints, and system constraints, which are established based on the k-th bounds``int q=0; // operator used to identify second reference constraint after the k-th one; this constraint is included in a primary set of constraint that are not bounded by the k-th constraint``int k=0; // operator used to identify first reference constraint, which yields the shortest distance gamma and smallest angle.``int kk=0; //resequenced k-th constraint``long double p=0; // operator used to subtract one array from another, and operator used towards computing the power function``int num=2; // number of variables in the objective function``int t=6; // number of constraints``int u=0; // increment operator used to assign value to array beyond the 6th referenced constraint``int g=0; // operator used to replace the primary set of reference constraints and erase secondary set of constraints``long double newconstr[8][2]; // matrix containing six of the original constraints and two project generated constraints``long double formatconstr[8][2]; // matrix containing set of primary reference constraints, which excludes erased secondary set of reference constraints`` ``long double epi[2][2]; // matrix inverse of the matrix containing two constraints meant to be used for obtaining the quantity for each variable``long double x=0; // operator used to sum the squares, to measure distance between constraint coordinates and variable coefficients, by taking the square root for the sum of squares``int y=0; // identifier when the angle for the k-th constraint is null``int s=0; // identifier for goto loop, when angle for th k-th constraint is null``long double z=0; // operator used to sum the squares, to measure distance between variable coefficients and origin``int LC[8] = {}; ``long double LK[8] = {}; // measure distance between the k-th constraint and second likely constraint``long double L7[8] = {};  // array used to store angles``long double LA[8] = {};  // measure distance between constraint coordinates and origin; there are six constraints specified by the user and two system generated``// array used to store the distance between system constraint coordinates and origin; there are six constraints specified by the user and two system generated``long double L6[8] = {}; // measure distance between constraint coordinates and variable coefficients; there are six constraints specified by the user and two system generated``// array used to store the distance between system constraint coordinates and variable coefficients; there are six constraints specified by the user and two system generated``long double L8[8] = {}; // compute cosine, and thereafter record the angle, value of the triangle formed between the variable coefficients, a given constraint, and the origin``long double L9[8] = {};  // multiply distance between the variable coefficients and a given constraints and the cosine value; this provides distance between the two points if they were aligned between the variable coefficients and the origin``long double LB[8] = {};  // array that includes all constraints that will be excluded from the set of primary constraints, since the array includes all constraints bound by the k-th constraint below a target threshold``long double LE[8] = {};  // array used record the angle of the constraint yielding the smallest distance``int LF[8] = {};  // array used store which constraint yields the smallest distance``// array used to store the distance between system constraint coordinates and k-th constraint``long double w=0, v=0; // angles recorded from triangles formed, which are used to determine which plane formed by the binding a system constraint and the k-th constraint intersects the line formed by binding the coefficient variables and the origin``long double sol=0; // operator used to sum parameters for each constraint; this is equivalent to a sumproduct of the constraint with a unity vector``long double SOLL[2]; // array used to store the solution set for the maximization project``long double N[2] = { 18.3333333333333333, 20 }; // array of coefficients for variables in the objective function, which will be used in the maximization project within the prescribed constraint``// parameters for each of the six constraints are assigned to the variable to be optimized``long double constraints[6][2]= {``{1, 2}, ``{3, 4},``{5, 6}, ``{15, 12}, ``{12, 15}, ``{11, 12}``};``// limiting parameters for each of the six constraints``long double limit[6]= {``10, 20, 30, 70, 70, 60``};``//list of functions``void cosine_and_angle(long double array1[8], long double array2[8], int upper_bound); //compute cosine value and angle of the triangle formed between the variable coefficients, a given constraint, and the origin``void min(long double array3[8], int upper_bound); //function used to determine the minimum within an array and below an upper bound``void matrix_inverse(long double array4[2][2], int amount6, int amoutn7); //function used to compute the inverse of a 2 x 2 matrix``long double cosine(long double amount1, long double amount2, long double amount3); //function used to compute the cosine ``void dist_constr_var (long double array5[8][2], int amount5, int amount4, long double return_array[8], int upper_bound, int increment); //measure distance between constraint coordinates and variable coefficients, by taking the square root for the sum of squares``//int main begins``int main () ``{``    ``    // defined coefficients are provided for each variable of the objective function for the maximization problem``    for(i=0;i= v) {` `                x++;` `                p++;` `            }` `       }` `       if (i == k) {` `           x++;` `       }` `   }` `   if (y == 1) {` `       if (i != k) {` `           if (newconstr[i][s] < newconstr[k][s]) {//repeat loop for each "s" coordinate of the k-th constraint``                    f++;``                }` `            ` `            if (newconstr[i][s] >= newconstr[k][s]) {//repeat loop for each "s" coordinate of the k-th constraint``                    x++;``                    p++;` `            }` `       }` `       if (i == k) {` `            x++;` `       }` `   }` `   if ( f != 0 ) {` `       LB[b] = i; //i-th constraint will be recorded in the LB array, which includes all constraints that will be excluded from the set of primary constraints``           b++;// ”b” operator indicates the total number of constraints bound by the k-th constraint``        }``        if ( x != 0 ) {// array used to sort the reference set of primary constraints` `        LF[g] = i;``            if (i == k) {``                k=g;``            }``            g++;` `   }``    }``    f=0;``    // if the number of constraints excluded from the set of primary constraints amounts to the total number constraints minus one, which is the k-th constraint, then the k-th constraint is the only binding one``    a=0;``    g=0;``    ``    if (p == 0) { a=1; } // a is an operator used to determine whether the first reference constraint is the only binding constraint``    p=0;``    ``    if (a == 1) {``        ``        //first constraint reference provides bounds for solution; the L-th and k-th constraints are used to determine the solution``        //the following provide the inverse of a 2x2 matrix and output of solution``        if (y != 1) {``            matrix_inverse(newconstr, q, k);``        }``        ``        if (y == 1) {``            for(i=0;i t-1 ) {    ``        cout<< "all other constraints within the set are listed \n";``        for(j=0;j