Re: [Help-glpk] ANSI C program as definning entry point for glpk
Glpk 4.55 comes with file doc/glpk.pdf. Please, read the sections on glp_mpl_read_data and glp_mpl_read_model. Best regards Heinrich Schuchardt john tass schrieb: Hi everybody, I have a C program that it is to define an entry point for a glpk project, i.e. I want to run the glpk trough the command line using a C application. In addition there is a file called MyModel.mod which contains my model and a separate file called MyData.dat containing the data used by the model. Inside my C application there are the statements: glp *lp; char *ModelFileName = "MyModel.mod"; char *DataFileName = "MyData.dat"; lp = lp_read_model(ModelFileName, NULL, NULL); The last statement above is for reading the model. I would like to ask which is the corresponding statement to read the MyData.dat file. In addition, I would like to ask how can I proceed in order to force the glpk to run using an initial solution file. Note that when I am using the glpk via the command line (without using a C application) I use the option: --ini InitialSolution.txt And a last question: how can I use the command line options : --pcost and --cuts , when I utilize a C application? Thank you very much for your time. -- Ioannis X. Tassopoulos ___ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk ___ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk
[Help-glpk] ANSI C program as definning entry point for glpk
Hi everybody, I have a C program that it is to define an entry point for a glpk project, i.e. I want to run the glpk trough the command line using a C application. In addition there is a file called MyModel.mod which contains my model and a separate file called MyData.dat containing the data used by the model. Inside my C application there are the statements: glp *lp; char *ModelFileName = "MyModel.mod"; char *DataFileName = "MyData.dat"; lp = lp_read_model(ModelFileName, NULL, NULL); The last statement above is for reading the model. I would like to ask which is the corresponding statement to read the MyData. dat file. In addition, I would like to ask how can I proceed in order to force the glpk to run using an initial solution file. Note that when I am using the glpk via the command line (without using a C application) I use the option: --ini InitialSolution.txt And a last question: how can I use the command line options : --pcost and --cuts , when I utilize a C application? Thank you very much for your time. -- Ioannis X. Tassopoulos ___ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk
Re: [Help-glpk] Modeling exclusive OR in Mathprog language
I'm a bit fuzzy on what you want. If you want to express x=a XOR b, where a, b and x are binaries, you just need four constraints, the constraints that cut off 001, 010, 100 and 111. That will give you the convex hull, which is as good as can be done. n To express, x=XOR a[j] , for some large n, j=1 n note that 0 = x XOR XOR a[j] . j=1 Add another integer variable: n 0 = x + SUM a[j] - 2*s j=1 The range of s in 0..floor((n+1)/2) -- Michael henne...@web.cs.ndsu.nodak.edu "SCSI is NOT magic. There are *fundamental technical reasons* why it is necessary to sacrifice a young goat to your SCSI chain now and then." -- John Woods ___ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk
[Help-glpk] Modeling exclusive OR in Mathprog language
Hi, everybody, I am facing the following situation: Let X[t, c] binary variable, H[t] binary variable, where t in T, c in C (1) I want to write a formula like sum{c in C}X[t, c] <= H[t], which will work for: 1. t = 1 or t = 30 2. t = 2 or t = 40 3. t = 3 or t = 50 .. ... One way, I think, is to repeat formula (1) so many times as the number of conditions (here, 3 times). The problem is that actually the above conditions are not only three, as I describe here just for example, but much more. So, I would like to avoid enumerating all these cases. Obviously, the way of linking the tree conditions by OR is not suitable in my case, since I don want the formula (1) to work for the case where (t =1 or t =2). I probably have to link the 3 conditions via an XOR operator. But I am not sure if such an operator exists in Mathprog language. Does anybody know if XOR exists in Mathprog? Or, if not, how can I model the above situation in an elegant way? Thanks for your time. -- Ioannis X. Tassopoulos ___ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk