Simplex Program
|
02-28-2016, 05:15 PM
(This post was last modified: 02-28-2016 05:16 PM by markelg.)
Post: #1
|
|||
|
|||
Simplex Program
Does anyone know how I can get or what I can change to get exact answers from this Simplex program?
Thanks Code:
|
|||
02-28-2016, 06:18 PM
Post: #2
|
|||
|
|||
RE: Simplex Program
(02-28-2016 05:15 PM)markelg Wrote: Does anyone know how I can get or what I can change to get exact answers from this Simplex program? Three cheers for even trying to implement a complex LP algorithm on a pocket calculator--I too attempted this task many years ago on an HP41c, with no success at all. It would be helpful to have your sample input data as well as the current output you got. Also, what do you mean by "exact answers"? If my memory serves, "integer" programming might be necessary if you want, for example, the optimal number of machines needed to satisfy the constraint in a production model. (i.e. you can't have 2.57 machines) |
|||
02-28-2016, 06:27 PM
Post: #3
|
|||
|
|||
RE: Simplex Program
(02-28-2016 06:18 PM)dbbotkin Wrote: Three cheers for even trying to implement a complex LP algorithm on a pocket calculator--I too attempted this task many years ago on an HP41c, with no success at all. For example, if I input 5 variables x 2 constraints, then input the values Quote:Max: 0 36 24 0 6it will output my answer as for x5=5.1667. This is close to correct, but I need it to be 5.16666666667 so that I can convert that to 31/6 (the correct answer option on a piece of homework I'm working on). When I convert 5.1667 to a fraction it's 51667/1000. There may be another way around this, I'm new to the prime and programming so sorry if it's not making much sense or if I'm overlooking a simple setting to fix it. |
|||
02-28-2016, 07:24 PM
(This post was last modified: 02-28-2016 07:36 PM by DrD.)
Post: #4
|
|||
|
|||
RE: Simplex Program
Would the home variable HDigits be useful for you?
HDigits:=11; // Example. Another way that may be helpful: You can use the [a b/c] key to toggle the fraction result: 5.16666666667 31/6 5+1/6 -Dale- |
|||
02-28-2016, 08:23 PM
Post: #5
|
|||
|
|||
RE: Simplex Program
(02-28-2016 07:24 PM)DrD Wrote: Would the home variable HDigits be useful for you?I'm reading what HDigits is used for, but I'm not sure how it would tie into this. When [a b/c] is pressed in the program it exits out, but even then it would still just be converting 5.1667. 31/6 would be an unknown if I didn't have the answer key. I'm thinking it has to do something with the rounding in the code itself but I'm not sure how that works since I didn't write the program. It seems as if all answers given are rounded to the ten thousandth. |
|||
02-28-2016, 11:29 PM
Post: #6
|
|||
|
|||
RE: Simplex Program
(02-28-2016 06:27 PM)markelg Wrote:Ah yes, a 'homework assignment' where exact answers matter. In the real world, an LP problem, or other algorithm for that matter, is bound not only by the constraints applied to the variables but also by the precision and accuracy of the input data. Often these data are either forecasts or averages with only a few significant digits, neither of which would support an answer out to 12 places. Besides, a repeating decimal like .1666...7 is best regarded as just plain one-sixth and the same goes for the other repeating-series answers.(02-28-2016 06:18 PM)dbbotkin Wrote: Three cheers for even trying to implement a complex LP algorithm on a pocket calculator--I too attempted this task many years ago on an HP41c, with no success at all. If it is any comfort, I had the same frustration back in grad-school cranking out Simplex solutions by doing the matrix math by hand. A fraction like '1/3' says all that can be said about the data at that point in the computation and using decimals makes it harder. |
|||
02-28-2016, 11:45 PM
(This post was last modified: 02-28-2016 11:47 PM by DrD.)
Post: #7
|
|||
|
|||
RE: Simplex Program
I guess I didn't quite understand your questions. I was thinking that your exercise left 5.1667 in the display. From that you wanted to get it in the form of an improper fraction. You asked how to get the display output to indicate 5.16666666667, which HDigits would do, if not already there by default. Then you wanted to convert that number to 31/6, which could be done using the [a b/c] key.
Did you want the program to just handle that during run time, instead? -Dale- |
|||
02-29-2016, 12:54 AM
Post: #8
|
|||
|
|||
RE: Simplex Program
Have you considered writing a CAS program instead?
Graph 3D | QPI | SolveSys |
|||
02-29-2016, 05:14 AM
(This post was last modified: 02-29-2016 05:18 AM by markelg.)
Post: #9
|
|||
|
|||
RE: Simplex Program
(02-28-2016 11:45 PM)DrD Wrote: I guess I didn't quite understand your questions. I was thinking that your exercise left 5.1667 in the display. From that you wanted to get it in the form of an improper fraction. You asked how to get the display output to indicate 5.16666666667, which HDigits would do, if not already there by default. Then you wanted to convert that number to 31/6, which could be done using the [a b/c] key. Correct, sorry for the misunderstanding. Is that possible? (02-29-2016 12:54 AM)Han Wrote: Have you considered writing a CAS program instead? I've never written a program, I found this one and I'm simply trying to build on it/make it better for what I'm doing. I can see how learning to write programs would be useful, may try it out here and there when I have the time. |
|||
02-29-2016, 10:23 AM
Post: #10
|
|||
|
|||
RE: Simplex Program
(02-29-2016 05:14 AM)markelg Wrote:(02-28-2016 11:45 PM)DrD Wrote: I guess I didn't quite understand your questions. I was thinking that your exercise left 5.1667 in the display. From that you wanted to get it in the form of an improper fraction. You asked how to get the display output to indicate 5.16666666667, which HDigits would do, if not already there by default. Then you wanted to convert that number to 31/6, which could be done using the [a b/c] key. The short answer is "yes." ... |
|||
02-29-2016, 05:52 PM
(This post was last modified: 02-29-2016 09:09 PM by markelg.)
Post: #11
|
|||
|
|||
RE: Simplex Program
(02-29-2016 10:23 AM)DrD Wrote:(02-29-2016 05:14 AM)markelg Wrote: Correct, sorry for the misunderstanding. Is that possible? I might have found the solution, using the hp ppl reference the syntax for rounding is Quote:ROUND(value, [places])so somewhere in the program there's a value of 4 with the round command. I'll find/switch them and post result. Update: I was correct, just had to change the syntax! |
|||
03-01-2016, 05:48 PM
Post: #12
|
|||
|
|||
RE: Simplex Program
(02-28-2016 06:18 PM)dbbotkin Wrote: Three cheers for even trying to implement a complex LP algorithm on a pocket calculator--I too attempted this task many years ago on an HP41c, with no success at all. Well, it's not so hard to do it - within the last 30 years I've written such LP/Simplex programs for the Sharp-PC1500, the HP-48SX and the TI-92+. I've also made several versions for the PC, which are of course much more powerful - the last version (LinOpt v6.0) can be downloaded from my website: http://fhub.jimdo.com/ (02-28-2016 06:27 PM)markelg Wrote: For example, if I input 5 variables x 2 constraints, then input the values These conditions can't lead to a solution, there must be any error in your numbers (e.g. x5 doesn't appear in any of the 2 constraints, so how could its solution be 5.1667? I've tried your problem with my own program (with the result 'infinite solution') and also with an other program on the internet (with the same result). Franz |
|||
03-01-2016, 06:30 PM
Post: #13
|
|||
|
|||
RE: Simplex Program
(03-01-2016 05:48 PM)fhub Wrote:(02-28-2016 06:18 PM)dbbotkin Wrote: Three cheers for even trying to implement a complex LP algorithm on a pocket calculator--I too attempted this task many years ago on an HP41c, with no success at all. Impressive contribution Franz! You wouldn't happen to have done any work with 'Non-Negative Least Squares' (NNLS) that could run on the Prime? I developed an algorithm back in the '90s that I would like to implement on the Prime. Pretty small matrices: 4x16 for the independent and 1x16 for the dependent with 4 betas ('weights' =>0 ) and 1 alpha output. It was done in Excel as a DLL, but MSFT doesn't run it anymore. Thanks, Donal |
|||
03-01-2016, 06:39 PM
Post: #14
|
|||
|
|||
RE: Simplex Program
(03-01-2016 06:30 PM)dbbotkin Wrote: You wouldn't happen to have done any work with 'Non-Negative Least Squares' (NNLS) that could run on the Prime? No, sorry - I've written quite a lot of math programs (especially for the above mentioned calcs), but not for this problem. And I've not yet programmed anything for the HP-Prime, I don't want to learn one more language, and IMO the Prime's language and handling is rather complicated - I still like the TI-92+/Voyage 200 much more, and they are enough powerful for my purposes. Franz |
|||
03-01-2016, 11:23 PM
(This post was last modified: 03-01-2016 11:29 PM by Gerson W. Barbosa.)
Post: #15
|
|||
|
|||
RE: Simplex Program
(03-01-2016 05:48 PM)fhub Wrote:(02-28-2016 06:18 PM)dbbotkin Wrote: Three cheers for even trying to implement a complex LP algorithm on a pocket calculator--I too attempted this task many years ago on an HP41c, with no success at all. Back in '85 or '86 I wrote such a program in MSX BASIC. The 125 short BASIC lines should be easy to port to the HP-71B. It served my purpose then, but it needs improvement. For whatever reason it handles only < and >. Thus, the two constraints in the second example here become four: Those were the days :-) |
|||
03-02-2016, 11:47 PM
(This post was last modified: 03-02-2016 11:58 PM by informach.)
Post: #16
|
|||
|
|||
RE: Simplex Program
Hi!, all:
In the Web, have, one program, for SOLVEX, with solution (but, in Portuguese Language), from ... HP Prime - solução de Simplex - Youtube The program write, in this Forum, have error, in the MIN. 1) Where see MIN:=1(little rectangle)12 ..., replace, in each case, by MIN:=1E12 2) The result MAXIMIZE, can be, 'Z' or 'P'. and configure, CAS Setting ... Number Format ... Standard Kind Regards. informach |
|||
10-08-2016, 05:00 AM
(This post was last modified: 10-08-2016 05:09 AM by cclinus.)
Post: #17
|
|||
|
|||
RE: Simplex Program
Hi,
Simplex program was updated to V17. It support CAS mode calculation. It provides exact value answer (no decimals, leave answer in terms of fractions). http://www.hpmuseum.org/forum/thread-5281.html |
|||
11-11-2016, 02:53 PM
(This post was last modified: 11-11-2016 02:54 PM by cclinus.)
Post: #18
|
|||
|
|||
RE: Simplex Program
Hi,
Simplex program is updated to v18, add integer solution and fixed some bugs. Download link: http://www.hpmuseum.org/forum/thread-5281.html Regards, |
|||
11-19-2016, 10:59 AM
Post: #19
|
|||
|
|||
RE: Simplex Program
Hi,
Simplex program is updated to V19. Here are the new features: 1) Mixed integer, continuous and binary solution. 2) Target Z value 3) Mixed branch and cut method for integer solution. 4) Allow Re-edit and save equation data. 5) fix a bug Regards, Download Link: http://www.hpmuseum.org/forum/thread-5281.html |
|||
11-26-2016, 07:57 AM
(This post was last modified: 11-26-2016 07:59 AM by cclinus.)
Post: #20
|
|||
|
|||
RE: Simplex Program
Hi,
Minor update to v19.8. fix a bug , a not unbounded solution misidentify as unbounded. Hope it will not cause some new bugs! Thanks! |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)