
1. Re: Simplex method in FileMaker
psijmons Dec 29, 2011 10:22 AM (in response to marco_terrile)hello Marco,
I couldn't help you with the actual algorithm, but you are definintely heading for a CustomFunction to get this done (requires FMP Advanced).
Have a look at http://www.briandunning.com/filemakercustomfunctions/recentlist.php to get a feel of all the things that are possible.
Your visual basic or Java examples should give good clues how you can translate that into a CustomFunction where [sugar] [fats] [protein] come in as parameters.
If you get stuck, then post your issues (unless you want to keep this private) and you may get help when building the CF.

2. Re: Simplex method in FileMaker
marco_terrile Dec 29, 2011 11:14 AM (in response to psijmons)Thank you psijmons,
i know Brian Dunning site an already checked out the CF archive to find a possible answer to my simplex problem...
I'll take another look to the last functions: maybe something new...
At the moment i'm studying all the simplex examples on the math sites around the internet.
Sure, a CF would be the best solution, but the simplex is not so easy: it will require more than a custom function to get rid of it... i fear.
Thanks

3. Re: Simplex method in FileMaker
psijmons Dec 30, 2011 7:14 AM (in response to marco_terrile)OK, I wasn't sure of your level of expertise in FMP.
If you have a Java program available that does the Simplex algorithm, you may try to send an executable event from an FMP script and see if you can pickup the outcome or display it in a webviewer inside FMP.

4. Re: Simplex method in FileMaker
marco_terrile Dec 30, 2011 9:53 AM (in response to psijmons)...thanks for the hint, but it's not so simple.
The whole thing is a bit more articulated: the solution is a packed runtime directed to ice cream makers. The level of the end user is very very low. They don't need to know anything about the simplex. They simply have to choose some ingredients, click a button and get the weights or percentages for each ingredient...
So the calculations must be in background and passing data to a java external program doesn't seem to me a good way to follow :(
Anyway i appreciate your help!
Thanks again and happy new year!!!
Marco

5. Re: Simplex method in FileMaker
DrewTenenholz Dec 30, 2011 11:15 AM (in response to marco_terrile)1 of 1 people found this helpfulMarco 
Take a look into the 360Works ScriptMaster plugin.
1) It's free.
2) It can be distributed with a FileMaker runtime.
3) It uses a language called Groovy, which is Javalike. It is surprising what you can paste into it and have it just work.
One way the plugin works is that you call it on file startup to load a function into FileMaker. You can call it anything you like . Then, when you want to use the function, it is there, just like a builtin FileMaker function.
I'm pretty sure something like the simplex algorithm can be translated into Groovy. I've been using hashing and AES encryption, which have some complexity themselves. ScriptMaster makes this pretty easy.
Good Luck!
 Drew Tenenholz
>The question is: did anybody deal with the Simplex Algorithm?
>The Simplex (not simple at all) created by G.B.Dantzig in 1947 is a linear programming method which makes possible to find an optimal solution among thousands of variables with hundreds of constraints in a limited number of iterations.
>i found some programs in c, visual basic and java which can solve these problems. It is embedded in Excel Solver function too...
>But i MUST to do it with FM (a required and necessary implementation in a solution )

6. Re: Simplex method in FileMaker
marco_terrile Dec 31, 2011 4:04 AM (in response to DrewTenenholz)Thanks a lot Drew, i didn'knew ScriptMaster. I read the documentation and found it very very interesting.
I'm going to download and try the plugin: it could be a good solution to my problem, and very useful for many other functions to add to custom solutions.
Regards
marco

7. Re: Simplex method in FileMaker
btrammel52 Jan 26, 2012 8:17 PM (in response to marco_terrile)Marco, how big will your linear system be? How many variables and constraints in a typical problem?

8. Re: Simplex method in FileMaker
marco_terrile Jan 27, 2012 5:09 AM (in response to btrammel52)Hi btrammel52, the scenery: a typical recipe may have 6/10 ingredients. Each one of them has 4 parameters to be evalued, which are the contents of sugars, fats, proteins and solids. There are also two fields for min% and MAX% of use: these may bring two constraints into the simplex such as the type (family) of ingredient, which may be 1,2 or 3. The objective function is to reach in the recipe precise values in the composition in sugars, fats, proteins and solids. Let's say, I want a recipe with 18% sugars, 7% fats, 10% proteins and not more than 44% solids (the remaining 36% will be water).
So there may be 42/70 variables and 18/30 constraints i guess...
The simplex should do the job...
At the moment i have a running VB version of the program and i'm translating the VB script into a series of FM scripts. So the subs and the functions of VB have been separated in single scripts.
I'm working with variables to try to keep it faster, but i have encountered a problem with matrix variables, as i can set as many repetitions i want in a FM variable, but only in one direction: an array... To store more values in each repetition i'm using a cf, in order to emulate the matrix. The cf is SetRep (rep;value)  from BrianDunning.com  , but still I have to test if it really works as i hope...
That's all folks !
Bye
marco

9. Re: Simplex method in FileMaker
osmancabi@gmail.com Nov 1, 2015 12:39 PM (in response to marco_terrile)Hi Marco,
Is there any improvements on your solution?
We are planning to use a FileMaker solution to solve some LP (at most 56 variables). Do you suggest doing such thing in FileMaker?
Thank you,
Osman Cabi

10. Re: Simplex method in FileMaker
disabled_ScottKoontz Mar 22, 2016 8:22 AM (in response to osmancabi@gmail.com)I have a solution to this type of problem. Let me know if you are still interested in a FileMakerSimplex solution.