help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] Node.js Async API


From: Henri Gourvest
Subject: [Help-glpk] Node.js Async API
Date: Tue, 09 Jun 2015 03:13:05 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

Hi,

I just released node-glpk v0.0.5
https://github.com/hgourvest/node-glpk
npm install/update glpk

As promised, now the module can also solve problems asynchronously.

So I made some internal changes to GLPK to make it possible.

The first change concern glp_intopt function, because I need to
synchronize the callback (cb_func) with the nodejs main thread.
It was not possible with the current implementation of the function.
With the new API I can leave the running thread when the callback occur,
serialize the execution context, and continue in another thread
of the nodejs thread pool.
https://github.com/hgourvest/node-glpk/commit/6871c1595912ecfd3d3ab239e592cd608cedc95b

The second change concern the global environment variable (env.h).
Storing the global variable in a TLS was useless because a problem can
run in different threads. So I added a compiler option to removed it. I
sacrificed everything related to this global variable.
https://github.com/hgourvest/node-glpk/commit/4be9fc0032714672747305f247d83fde45da795c

The last change is a new option in the iocp structure: cb_reasons
With this filter I can tell the mip solver to invoke the callback only
for certain reasons. when you only want to get intermediate results,
it is a good thing to use this option to prevent unnecessary thread
switching for others events.
https://github.com/hgourvest/node-glpk/commit/dda09b72170042f55c311d5e1d3726b00a999951

Now the next step is writing the manual.

Regards

--
Henri Gourvest




reply via email to

[Prev in Thread] Current Thread [Next in Thread]