Results 1 to 2 of 2

Thread: How to return a solution from a series of Multi Linear Inequality Equations

Threaded View

  1. #1

    Thread Starter
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397

    How to return a solution from a series of Multi Linear Inequality Equations

    First, go ahead and read:
    http://cgm.cs.mcgill.ca/~beezer/Publ...is-kaluzny.pdf

    Then check out the bas in my attached project.
    The form is just a front end to load data from formatted txt files,
    where, inside the zip, are 3 examples of such files, with corresponding txt files explaining more legibly what those equations are.
    {oops, just noticed...didn't include em. Well, their in the zip file now.}

    BTW, the .trt extension is an association on my pc to wordpad, since I don't like using notepad on txt files.

    This is NOT a finished project, just an illustration of how to program whats in that PDF.


    Any questions, just ask!


    -Lou

    BTW,
    As that PDF explains, this method only works to return Non-Negative solutions, if any exists.

    So, if all solutions to the input set of equations have negative values, this supposedly fails.

    Obviously, if ALL the values of all solutions are in negative space, if the values of the multipliers are multiplied by -ve 1, then the method will return a solution which, again multiplied by -ve 1, would be the solution of your original equations.

    The true delema occurs when all possible solution sets span both sides of zero.

    In that case, if you know the low limits of your variables, then translate them via : OldVar = NewVar + LowLim

    Adjust your equations, solve them, then retranslate back via: NewVar = OldVar - LowLim.




    Now, if you Don't know if any of your variables will result in a general solution if they are < 0, then if all of those variables were translated into OldVar = NewVar - NewVar2, then if its possible, the process would return NewVar & NewVar2, where both would be >= 0, which when retranslated back, would give you your solution to your original variable. {As you can see, if NewVar ended up < NewVar2, then your OldVar would indeed be negative, while the method would truly have returned only positive solutions}

    However, this is an expensive operation, in effect doubling the # of input variables into the method.

    Therefore:

    My next development will do the following.
    1. The Input Matrix will be dimensioned to allow the input variables room to split 1 time. So instead of the input matrix being dimmed to -1 + #Vars + NumEquations-NumEquations that explicitely set a variable to a value, the input matrix is dimmed to -1 + 2*#Vars + ...
    2. Instead of referencing the uBound of the input matrix, a counter will be used pointing to the effective ubound of the matrix. This counter will initially be set to the value -1 + #Vars + ..., since no variables have yet split.
    3. An Identity matrix will be used that, when multiplied by the solution matrix generated by the equation solver, will return the solution set of the original variables.
    4. The Counter will incriment by 1 every time an original variable is to be split.
    5. When a variable is split, Wherever it exists in the input matrix, that spot that is identified by the counter will be set to -1* the multiplier of the splitted variable. Also the identity matrix will be updated with a -1 value at the row of the split variable, and column = the counter's current value.
    6. A Boolean matrix will indicate which original variables have not split. This will be used to determine which original variables can still be split.

    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width