Skip to content

Commit

Permalink
Merge branch 'v7.1' of github.com:JuliaPolyhedra/lrslib
Browse files Browse the repository at this point in the history
  • Loading branch information
bzinberg committed Apr 22, 2021
2 parents dd90626 + ab1a531 commit c48b994
Show file tree
Hide file tree
Showing 170 changed files with 6,541 additions and 1,963 deletions.
Empty file modified 2nash.c
100644 → 100755
Empty file.
Empty file modified COPYING
100644 → 100755
Empty file.
141 changes: 140 additions & 1 deletion README
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,147 @@ Documentation is currently being maintained at the URL:

http://cgm.cs.mcgill.ca/~avis/C/lrs.html
-----------------------------------------------------------------------------

Version 7.1
manual: http://cgm.cs.mcgill.ca/~avis/C/lrslib/USERGUIDE71.html

2020.10.17

Memory leak in countonly option fixed for mplrs/lrs.

2020.5.25
Version 7.1 is a major revision completing the move to an all C library begun
in 7.0 which was work in progress and has been removed from distribution.

Major changes to lrs:
1. redund function is now performed by lrs via options, but legacy redund maintained
2. extract option to extract columns from the input especially with linearities
3. hvref makes a cross reference list between H and V representations

Major changes to mplrs:
1. Temporary files no longer used for communicating with workers.
2. Parallel version of redund is now available

Thanks to David Bremner and Jerry James for advice, patches and other help!

Details below

2020.5.19

redund binaries are no longer produced and lrs does redund
functioning via the redund option. For a standard redund run (ie all lines checked)
set up a link:
%ln -s lrs redund and if needed %ln -s lrs1 redund1 etc. for single arithmetic
Now no options are needed and

% redund filename

will remove all redundant inequalities

In mplrs this can be achieved by:

% mpirun -np <procs> mplrs -redund filename

2020.4.27

Changes in mplrs relative to 7.0:
1. All C++ code removed or rewritten in C; C++ compiler no longer required.
2. mplrs uses the new lrslib API (2019.11.8) instead of temporary files for
parallel jobs.
3. Support for parallel redund runs using the redund option in input files.
4. Compiler warnings removed.
5. Additional warning and informational messages printed when relevant.
6. New option -redund, for redund runs without adding option to file.
7. Avoid duplicate output lines that were possible on an overflow in
hybrid mode.
8. Fix a rare bug that could omit output lines at the start of a run.

2020.2.5
The extract option is a preprocessing step to remove linearities (if any) and resize
the A matrix using standard lrs processing, which is output as a valid lrs input file.
The resulting file will not contain any equations but may not be full dimensional.
Options in the input file are stripped.
User can specify the cols to retain (where this possible by linear independence).
If there are no linearities in the input file the columns in the option are retained
and the other ones are deleted. This is useful for projecting a V-representation.

extract 0

retains columns in order 1,2,...,n

extract k i1 .. ik

retains columns in order i1,...,ik then the missing 1..n as necessary
Column 0 is always retained.

Use redund to remove redundancies from the output as necessary.
A full lrs run is not performed, however output can be piped:

% lrs file | redund | lrs

2019.12.30

hvref makes a cross reference list between H and V reps
Usage (same for ext file):

Add printcobasis and incidence options to cube.ine

% lrs cube.ine cube.ext
% xref cube.ext

Edit the output file cube.ext.x so that the second line contains two integers

rows maxindex

where rows >= # output lines in cube.ext.x
maxindex >= # input lines in cube.ine

or just use 0 0 and the program will tell you which values to use

% hvref cube.ext.x


2019.11.8

New redund option causes lrs to perform redund function:

redund start end

limits redundancy checking to input rows numbered start,...,end.
Defaults start=1 and end=m is legacy redund and can be obtained by

redund 0 0

lrs_main has been rewritten as lrsv2_main to avoid temporary files in mplrs.
It now passes pointers to P and Q back to mplrs and is called 3 times
according to the stage flag.

stage=0 performs problem setup and reads the input file
stage=1 performs reverse search or redund function
stage=2 performs clean up and closes files

2019.6.13

If lrs is compiled with -DLRS_QUIET lrs produces an ouput file with only the data
between the begin and end lines, ie. a matrix of the V or H representation.
The only exception is if the input is a V-rep and output has linearities
in which case line one has the linearity information

--------------------------------------------------------------------------------------
2019.1.5
Various pivot rules are implemented for solving LPs using variations of the lponly option.
To get pivot counts correct it is best to use lrsgmp at least for now

lponly default, currently Dantzig's rule
lponly_b Bland's rule, which is used for vertex enumeration
lponly_d Dantzig's rule, the only rule used up to Version 7.1
lponly_r random edge rule
lponly_rd alernates random edege and Dantzig

-----------------------------------------------------------------------------

2018.7.1
Version 7.0 (Beta release) (lrslib-070)
Version 7.0 (lrslib-070)

User's guide: http://cgm.cs.mcgill.ca/~avis/C/lrslib/USERGUIDE70.html

Expand Down
96 changes: 96 additions & 0 deletions buffer.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@

/* buffer.c Reads standard input and builds a circular buffer of maxbuffer lines */
/* input line should have max length maxline and is printed only if it is not in the buffer */
/* calling arguments: maxline maxbuffer */
/* defaults: 50000 500 */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAXBUFFER 5000 /*max number of lines in buffer */
char *line;

int maxline;
int Getline(void);
void notimpl(char s[]);

int
main(int argc, char *argv[])
{
extern int maxline;
extern char *line;
int i;
int bufsize;
int next;
int count, counton;
char *c;
char *buffer [MAXBUFFER];
int maxbuffer=500;
void *calloc();

maxline=50000;
/* allocate space for buffer */
if (argc >= 2 ) maxline=atoi(argv[1])+2; /* allow for \n and \0 */
if (maxline <= 2 ) notimpl("line length must be greater than zero");
if (argc >= 3 ) maxbuffer=atoi(argv[2]);
if (maxbuffer <= 0 ) notimpl("buffer length must be greater than zero");
for(i=0;i<maxbuffer;i++) buffer[i]=calloc(maxline,sizeof(char));
line=calloc(maxline,sizeof(char));

next= -1; /*next location to write in buffer*/
bufsize= -1; /*upper index of buffer size*/
count=-1; /* count lines output "begin" before "end" minus 1*/
counton=0;
while ( Getline() > 0 )
{
i=0;
if(strncmp(line,"end",3)==0) counton=0;
while ( i <= bufsize && (strcmp(line,buffer[i])) != 0 )
i++;
if ( i > bufsize ) /* write out line and put in buffer */
{
next++;
if ( next > maxbuffer-1 ) next=0;
if ( bufsize < maxbuffer-1 ) bufsize++;
c=strcpy(buffer[next],line);
printf("%s",line);
if(counton)count++;
}
if(strncmp(line,"begin",5)==0) counton=1;
}
printf("\n*Number of output lines between begin/end = %d",count);
if(count > maxbuffer )
printf("\n*Buffer size of %d lines exceeded-some duplicates may remain",maxbuffer);
else
printf("\n*All duplicates removed");

printf("\n");
return 0;
}

/* getline from KR P.32 */
int Getline(void)
{
int c,i;
extern int maxline;
extern char *line;

for (i=0;i<maxline-1
&& (c=getchar()) != EOF && c != '\n'; ++i)
line[i]=c;

if (i == maxline-1 ) {
fprintf(stderr,"\n%s ",line);
fprintf(stderr,"\nmaximum line length = %d ",maxline-2);
notimpl("maximum line length exceded");
}
if (c == '\n' ) {
line[i]=c;
++i;
}
line[i]= '\0';
return i;
}
void notimpl( char s[])
{fprintf(stderr,"\n%s\n",s);
exit(1);
}
Binary file modified c30-15.ext
100644 → 100755
Binary file not shown.
1 change: 1 addition & 0 deletions chdemo.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <stdio.h>
#include <string.h>
#include "lrsdriver.h"
#include "lrslib.h"

#define MAXCOL 1000 /* maximum number of colums */
Expand Down
6 changes: 3 additions & 3 deletions cube.ext
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
cube.ext
cube
V-representation
begin
8 4 rational
1 1 1 1
1 -1 1 1
1 1 -1 1
1 -1 -1 1
1 1 1 -1
1 -1 1 -1
1 1 -1 -1
1 -1 -1 -1
1 1 -1 1
1 -1 -1 1
end
3 changes: 1 addition & 2 deletions cube.ine
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
cube.ine
cube
H-representation
linearity 1 1
begin
6 4 rational
1 1 0 0
Expand Down
Empty file modified ext/metric/cp4.ext
100644 → 100755
Empty file.
Empty file modified ext/metric/cp5.ext
100644 → 100755
Empty file.
Empty file modified ext/metric/cp6.ext
100644 → 100755
Empty file.
Empty file modified ext/metric/cp7.ext
100644 → 100755
Empty file.
Empty file modified ext/metric/mp5.ext
100644 → 100755
Empty file.
Loading

0 comments on commit c48b994

Please sign in to comment.