GreyTrout Software, Inc.
  About Us Search Products
  Support Download Store

NExS Plug-Ins and Utilities

You can increase the capabilities of the NExS by adding ``plug-ins'' from GreyTrout or third-party developers. You can download these plug-ins and utilities using the following table. Descriptions of what the plug-ins do are also provided below.

These plug-ins are offered "AS-IS." GreyTrout Software, Inc. makes them available in hopes that they will be of value but does not support them or guarantee they will work on your system.

NOTE: All of these plug-ins and utilties are for use with the NExS X Window GUI application (our traditional spreadsheet product). They do not work with the new SpreadScript product.
NExS Plug-Ins and Utilities
NExS-Perl Interface Source Code
NExS Data Mailer Source Code
Linear Programming Source Code
Genetic Algorithms Source Code
Simulated Annealing Source Code

Perl Interface to NExS

This is a Perl interface to the NExS GUI Application. For a Perl interface to the spreadsheet engine in NExS without the X Window GUI, see our SpreadScript for Perl product.

Contributed by: Remco Wouts, Centre for Estuarine and Coastal Ecology, Vierstraat 28, 4401 EA Yerseke, The Netherlands.

This kit contains the source and examples for an interface between Perl and the NExS spreadsheet that maps most of the NExS API to Perl functions. You get a rough interface that allows you to read and write individual cells or files in a NExS sheet from Perl. You can also add Perl subroutines as remote cell functions or as menu bar functions.

All simple functions are implemented so you can write simple Perl scripts to load multiple files in a sheet (e.g., import 1000 csv files). You can write data in the sheet, read it back, and evaluate formulas in the sheet.

The main file to look at when you want to understand what is going on is Nexs.xs. If you want to understand all of it you must read the perlxs (perlxstut), perlguts, and perlcall manual pages (in this order please). The NExS-Perl interface code starts at the line beginning with 'MODULE = Nexs' with a few functions to implement Perl subs as callbacks and wrappers around almost all NExS-API functions (as specified in the NExS-API docs) in the XSUB language. The code that imports the constants from nexs.h was automatically generated by h2xs. The strategy was to keep things as close as possible to the NExS-API, Perlifying only the obvious things. For instance, the call to nexs_open(name,timeout) translates in Perl to Nexs::open($name[,timeout]) with a default timeout of 5 sec. Similarly, the nexs_store... family of functions translates to Nexs::set(port,row,col,val[,flag]) where Perl decides whether to store a number or a string, etc.

Look in the example.pl script to get an overview of most features.

 

NExS Data Mailer

The NExS Data Mailer (ndm) is a freely distributable application based on the NExS spreadsheet from GreyTrout, built using Tcl/Tk and the tclNExS API. It functions as an "e-mail merge" application to facilitate sending spreadsheet data to lists of e-mail addresses contained in the spreadsheet. The basic idea is that the spreadsheet contains a table of data, e.g., student grades, customer data, etc., and that one row or column in the table contains the e-mail addresses of the individuals with whom the data is associated.

The file ndm.doc contains documentation, including installation and usage instructions, copyright information and standard disclaimers.

 

Linear Programming Plug-In for NExS

This kit contains the source and documentation for the linear programming plug-in for NExS. The LP plug-in provides two new NExS functions: @CONSTRAINT(...) which allows you to enter the allowable bounds on a set of variables; and @LP(...) which optimizes a cost function while satisfying the constraints on the variables. Any NExS function or combination of functions can be used to specify the constraint and cost functions, as long as the results are linear with respect to the decision variables of the problem.

 

Genetic Algorithm Plug-In for NExS

This kit contains the source and documentation for the genetic programming plug-in for NExS.

Genetic algorithms (GA) solve optimization problems by modeling potential solutions as chromosomes which can breed with one another to produce better solutions through the forces of natural selection. Each solution or chromosome is made up of individual genes which are either one or zero. The fitness of a solution is determined by plugging the values of its genes into a function that returns a numerical fitness score. GA proceeds by randomly selecting two chromosomes and connecting a portion of one with a portion of the other to create an offspring chromosome. GA also injects some mutations by randomly flipping the value of a gene in a chromosome. If the fitness of the offspring is improved, it will probably survive to reproduce itself. However, if the fitness score is worse, the offspring will eventually die off. Over the course of generations, the fittest chromosomes will be represented more often in the total population. Hopefully, one of these fit chromosomes will be the optimal solution to the problem.

The GA plug-in provides one new NExS function: @GENALG(...) which optimizes a fitness function that is affected by a group of 1/0 variables in the sheet. Any NExS function or combination of functions can be used to specify the fitness function.

 

Simulated Annealing Plug-In for NExS

This kit contains the source and documentation for the simulated annealing plug-in for NExS.

Simulated annealing (SA) solves optimization problems by modeling potential solutions as electron spins which flip into a configuration that lowers the total energy of a system. Each solution is made up of individual spins which are either one or zero. The energy rating of a solution is determined by plugging the values of its spins into a function that returns a numerical energy score. SA proceeds by randomly selecting and flipping it to its opposite value. If the energy of the new configuration is improved, it will be accepted as the new solution. If the energy increases, however, the new solution may be accepted if the increase in the energy satisfies the following equation:

displaymath92

where URANDOM is a uniformly distributed random number and T is a parameter referred to as the temperature. When T is high, it is possible for the system to make jumps to higher energy states. This prevents the solutions from becoming stuck in a local optimum. As T is decreased, the chance of the system increasing its energy is also decreased. Thus, the cooling created by lowering T will eventually force the solution into a low energy state.

The SA plug-in provides one new NExS function: @SIMANNEAL(...) which optimizes a fitness function that is affected by a group of 1/0 variables in the sheet. Any NExS function or combination of functions can be used to specify the fitness function.

© 1999-2003 GreyTrout Software, Inc. All Rights Reserved