Re: [Help-glpk] use GLPK to solve LP without printing anything on terminal

2015-04-13 Thread Nigel Galloway
Have you considered looking at t1.cs from glpk's example directory and
glpk's API documentation?

Let us look now at t1.cs.

First the example was written for Linux so we change the line

const string glpkLibrary = libglpk.so; to const string glpkLibrary =
glpk.dll; //***

and run it as is t1.exe 98 1001 produces: a = 98, b = 1001 Hello Nigel
Trying 98 GLPK Simplex Optimizer, v4.55 1 row, 2 columns, 2 non-zeros 0:
obj = 0.0e+000 infeas = 1.000e+000 (0) * 1: obj =
0.0e+000 infeas = 0.000e+000 (0) OPTIMAL LP SOLUTION FOUND GLPK
Integer Optimizer, v4.55 1 row, 2 columns, 2 non-zeros 2 integer
variables, none of which are binary Integer optimization begins... + 1:
mip = not found yet = -inf (1; 0) Solution found by heuristic: 0 + 2:
mip = 0.0e+000 = tree is empty 0.0% (0; 5) INTEGER OPTIMAL
SOLUTION FOUND x = -10, y = 1, a*x + b*y = 21 Trying 21 GLPK Simplex
Optimizer, v4.55 1 row, 2 columns, 2 non-zeros * 2: obj =
0.0e+000 infeas = 0.000e+000 (0) OPTIMAL LP SOLUTION FOUND GLPK
Integer Optimizer, v4.55 1 row, 2 columns, 2 non-zeros 2 integer
variables, none of which are binary Integer optimization begins... + 2:
mip = not found yet = -inf (1; 0) Solution found by heuristic: 0 + 2:
mip = 0.0e+000 = tree is empty 0.0% (0; 3) INTEGER OPTIMAL
SOLUTION FOUND x = 41, y = -4, a*x + b*y = 14 Trying 14 GLPK Simplex
Optimizer, v4.55 1 row, 2 columns, 2 non-zeros * 2: obj =
0.0e+000 infeas = 0.000e+000 (0) OPTIMAL LP SOLUTION FOUND GLPK
Integer Optimizer, v4.55 1 row, 2 columns, 2 non-zeros 2 integer
variables, none of which are binary Integer optimization begins... + 2:
mip = not found yet = -inf (1; 0) Solution found by heuristic: 0 + 3:
mip = 0.0e+000 = tree is empty 0.0% (0; 5) INTEGER OPTIMAL
SOLUTION FOUND x = -51, y = 5, a*x + b*y = 7 Trying 7 Solution is 7
Goodbye Nigel

All this output from glpk shows its working but is distracting so:

1. define GLP_OFF. In C# 5 these constants would better in an enum say
   GPL so we could then use GLP.OFF but this is the example written in
   2008 that we have for now.

readonly int GLP_OFF = 0; //***

2. add the link into glpk.dll for glp_term_out:

[DllImport(glpkLibrary, SetLastError = true)] //*** static extern int
glp_term_out(int flag); //***

3. use it to turn glpk's terminal output off:

glp_term_out(GLP_OFF); //***

compiling and running this version t1.exe 98 1001 produces:

a = 98, b = 1001 Hello Nigel Trying 98 x = -10, y = 1, a*x + b*y = 21
Trying 21 x = 41, y = -4, a*x + b*y = 14 Trying 14 x = -51, y = 5, a*x +
b*y = 7 Trying 7 Solution is 7 Goodbye Nigel

which I hope is close to what you want.

I have attached the modified t1.cs with the changes marked by //***
--
Nigel Galloway nigel_gallo...@operamail.com



On Sat, Apr 11, 2015, at 07:04 AM, usa usa wrote:
 Also,

 How to indicate algorithms in GLPK to solve LP or IP from API ?

 GLPK has simplex, primal-dual and branch-bound algorithms, are
 there others?

 thanks

 On Sat, Apr 11, 2015 at 8:39 AM, Nigel Galloway
 nigel_gallo...@operamail.com wrote:
 __
 If you are using the API then the output is controlled with GLP_ON
 and GLP_OFF. If you are using mathprog  glpsol then -y filename
 will send the output to a file rather than your terminal. If using
 Linux and you absolutely don't want the output then -y /dev/nul
 should do you.

 --
 Nigel Galloway nigel_gallo...@operamail.com



 On Fri, Apr 10, 2015, at 08:24 PM, usa usa wrote:
 Hi,

 I am using GLPK to solve some linear programming models.

 The model size is 200k variables and has one constraint.

 It took GLPK 13 minutes to load data and build the LP model.

 But, it took GLPK 17 minutes to solve it.

 Is it normal ? Why building a model took so long time ?

 Also, when GLPK is solving the model, it print out the detailed
 process of solving model on the command line terminal.

 How to make GLPK to solve the model silently without printing
 anything on terminal ?

 Thanks



 _
 Help-glpk mailing list Help-glpk@gnu.org
 https://lists.gnu.org/mailman/listinfo/help-glpk



 --
 http://www.fastmail.com - Or how I learned to stop worrying and
love email again



 ___

Help-glpk mailing list
 Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk




-- 
http://www.fastmail.com - Faster than the air-speed velocity of an
  unladen european swallow



t1.cs
Description: Binary data
___
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk


Re: [Help-glpk] use GLPK to solve LP without printing anything on terminal

2015-04-11 Thread usa usa
please refer to my answsers below.

I called GLPK from C# in VS 2013 on win7.

On Sat, Apr 11, 2015 at 12:13 AM, Reginald Beardsley pulask...@yahoo.com
wrote:

 The answers to your questions depend almost entirely upon the computer
 you're using.

 What processor?

Xeon


 What clock rate?

 2.4 GHz


 How much memory?
  8GB



 What else is running?

 no large applications are running. My GLPK application is the largest
one. The GLPK used 80 MB memory.


 What operating system?

 win 7


 You'll need to answer those questions to get a proper answer.  Without all
 of that information any answer is just a wild guess.  It's sometimes hard
 to determine even with that information.

 The information you don't want to see is there in part to answer some of
 your other questions.  So to some degree you're asking to be told the
 answer without being told the answer.

 Reg

 
 On Fri, 4/10/15, usa usa usact2...@gmail.com wrote:

  Subject: [Help-glpk] use GLPK to solve LP without printing anything on
 terminal
  To: help-glpk@gnu.org
  Date: Friday, April 10, 2015, 10:24 PM

  Hi,

  I am using GLPK to solve some linear programming
  models.

  The model size is 200k variables and has one
  constraint.

  It took GLPK 13 minutes to load data and build the LP
  model.

  But, it took GLPK 17 minutes to solve it.

  Is it normal ? Why building a model took so long time
  ?

  Also, when GLPK is solving the model, it print out the
  detailed process of solving model on the command line
  terminal.

  How to make GLPK to solve the model silently without
  printing anything on terminal ?

  Thanks



  -Inline Attachment Follows-

  ___
  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


Re: [Help-glpk] use GLPK to solve LP without printing anything on terminal

2015-04-11 Thread usa usa
Also,

How to indicate algorithms in GLPK to solve LP or IP from API ?

GLPK has simplex, primal-dual and branch-bound algorithms, are there
others?

thanks

On Sat, Apr 11, 2015 at 8:39 AM, Nigel Galloway 
nigel_gallo...@operamail.com wrote:

  If you are using the API then the output is controlled with GLP_ON and
 GLP_OFF. If you are using mathprog  glpsol then -y filename will send the
 output to a file rather than your terminal. If using Linux and you
 absolutely don't want the output then -y /dev/nul should do you.

 --
 Nigel Galloway
 nigel_gallo...@operamail.com



 On Fri, Apr 10, 2015, at 08:24 PM, usa usa wrote:

 Hi,

 I am using GLPK to solve some linear programming models.

  The model size is 200k variables and has one constraint.

  It took GLPK 13 minutes to load data and build the LP model.

  But, it took GLPK 17 minutes to solve it.

  Is it normal ? Why building a model took so long time ?

  Also, when GLPK is solving the model, it print out the detailed process
 of solving model on the command line terminal.

  How to make GLPK to solve the model silently without printing anything
 on terminal ?

  Thanks


  *___*
 Help-glpk mailing list
 Help-glpk@gnu.org
 https://lists.gnu.org/mailman/listinfo/help-glpk



 -- http://www.fastmail.com - Or how I learned to stop worrying and
   love email again


 ___
 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


Re: [Help-glpk] use GLPK to solve LP without printing anything on terminal

2015-04-11 Thread usa usa
Hi,

I called GLPK from C# in VS 2013 on win7.

The API that I called is:

Solution mySolution = solver.Solve(myMathLPModel);

How to use GLP_OFF to close the output on terminal ?


Any help would be appreciated.

Thanks

On Sat, Apr 11, 2015 at 8:39 AM, Nigel Galloway 
nigel_gallo...@operamail.com wrote:

  If you are using the API then the output is controlled with GLP_ON and
 GLP_OFF. If you are using mathprog  glpsol then -y filename will send the
 output to a file rather than your terminal. If using Linux and you
 absolutely don't want the output then -y /dev/nul should do you.

 --
 Nigel Galloway
 nigel_gallo...@operamail.com



 On Fri, Apr 10, 2015, at 08:24 PM, usa usa wrote:

 Hi,

 I am using GLPK to solve some linear programming models.

  The model size is 200k variables and has one constraint.

  It took GLPK 13 minutes to load data and build the LP model.

  But, it took GLPK 17 minutes to solve it.

  Is it normal ? Why building a model took so long time ?

  Also, when GLPK is solving the model, it print out the detailed process
 of solving model on the command line terminal.

  How to make GLPK to solve the model silently without printing anything
 on terminal ?

  Thanks


  *___*
 Help-glpk mailing list
 Help-glpk@gnu.org
 https://lists.gnu.org/mailman/listinfo/help-glpk



 -- http://www.fastmail.com - Or how I learned to stop worrying and
   love email again


 ___
 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


Re: [Help-glpk] use GLPK to solve LP without printing anything on terminal

2015-04-11 Thread Nigel Galloway
If you are using the API then the output is controlled with GLP_ON and
GLP_OFF. If you are using mathprog  glpsol then -y filename will send
the output to a file rather than your terminal. If using Linux and you
absolutely don't want the output then -y /dev/nul should do you.

--
Nigel Galloway nigel_gallo...@operamail.com



On Fri, Apr 10, 2015, at 08:24 PM, usa usa wrote:
 Hi,

 I am using GLPK to solve some linear programming models.

 The model size is 200k variables and has one constraint.

 It took GLPK 13 minutes to load data and build the LP model.

 But, it took GLPK 17 minutes to solve it.

 Is it normal ? Why building a model took so long time ?

 Also, when GLPK is solving the model, it print out the detailed
 process of solving model on the command line terminal.

 How to make GLPK to solve the model silently without printing anything
 on terminal ?

 Thanks


 _
 Help-glpk mailing list Help-glpk@gnu.org
 https://lists.gnu.org/mailman/listinfo/help-glpk


-- 
http://www.fastmail.com - Or how I learned to stop worrying and
  love email again

___
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk


Re: [Help-glpk] use GLPK to solve LP without printing anything on terminal

2015-04-10 Thread Reginald Beardsley
The answers to your questions depend almost entirely upon the computer you're 
using.

What processor?

What clock rate?

How much memory?

What else is running?

What operating system?

You'll need to answer those questions to get a proper answer.  Without all of 
that information any answer is just a wild guess.  It's sometimes hard to 
determine even with that information.

The information you don't want to see is there in part to answer some of your 
other questions.  So to some degree you're asking to be told the answer without 
being told the answer.

Reg


On Fri, 4/10/15, usa usa usact2...@gmail.com wrote:

 Subject: [Help-glpk] use GLPK to solve LP without printing anything on terminal
 To: help-glpk@gnu.org
 Date: Friday, April 10, 2015, 10:24 PM
 
 Hi, 
 
 I am using GLPK to solve some linear programming
 models. 
 
 The model size is 200k variables and has one
 constraint. 
 
 It took GLPK 13 minutes to load data and build the LP
 model. 
 
 But, it took GLPK 17 minutes to solve it. 
 
 Is it normal ? Why building a model took so long time
 ? 
 
 Also, when GLPK is solving the model, it print out the
 detailed process of solving model on the command line
 terminal. 
 
 How to make GLPK to solve the model silently without
 printing anything on terminal ? 
 
 Thanks
 
 
 
 -Inline Attachment Follows-
 
 ___
 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