Skip to content

Instantly share code, notes, and snippets.

@denis-bz
Created January 17, 2021 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save denis-bz/8866b5e35ae3d8b7e2c11669d3121c9b to your computer and use it in GitHub Desktop.
Save denis-bz/8866b5e35ae3d8b7e2c11669d3121c9b to your computer and use it in GitHub Desktop.
LP sparse testcase generator: 4n^3 x n^4, 4n^4 non0 17 Jan 2021
#!/usr/bin/env python
""" lpgen34.py LP testcase generator
d=3: 3n^2 x n^3, 3 1s in each column
n=55: A 9075 x 166375, 499125 nnz, glpsol simplex 100 minutes
d=4: 4n^3 x n^4, 4 1s in each column, n in each row
n=16: A 2^14 x 2^16, 2^18 nnz, glpsol simplex 10 hours
"""
# keywords: linear programming, test case, generator, Latin-square
# https://stackoverflow.com/questions/57936789/many-vertex-test-problems-for-the-simplex-method
# https://math.stackexchange.com/questions/3370934/3d-permutation-matrices -- 4d too
from __future__ import division, print_function
import numpy as np
from scipy import sparse as sp
__version__ = "2019.10.08" # 8 oct
__author_email__ = "denis-bz-py t-online.de"
#...............................................................................
def lpgen34( n, d=3, cint=9, seed=0, verbose=2 ):
""" -> A b c LP test: d=3: A 3n^2 x n^3, 3 1s in each column sparse csr
b = 1
c randint 0 .. cint / uniform
"""
# csr ? csc most efficient for sksparse.cholmod
Agen = { 2: A2, 3: A3, 4: A4 }[d]
A = Agen( n )
nr, nc = A.shape
b = np.ones( nr )
random = seed if isinstance(seed, np.random.RandomState) \
else np.random.RandomState( seed=seed )
if cint > 0:
c = random.randint( 0, cint+1, size=nc ).astype(float) # 0 .. cint inclusive
else:
c = random.uniform( size=nc )
if verbose:
print( "\nlpgen34: n %d d %d A %s %s %d non0 seed %d c %s ..." % (
n, d, A.shape, type(A).__name__, A.nnz, seed, c[:10] ))
if verbose >= 2:
for j in range( 0, nr, nr // d ):
print( A[j:j+5] .A ) # caller's printoptions
print( " ..." )
return A, b, c
def A2( n ):
""" -> A 2n x n^2, 2 1s in each column sparse csr """
# ~ lpgen_2d 2014
square = np.arange( n**2 ).reshape( n, n )
line = np.arange( n )
def row01( *ix ):
row = sp.lil_matrix( (1, n**2) )
row[0, square[ix]] = 1
return row.tocsr()
return sp.vstack( # csr* -> csr, else coo
# i j
[row01( i, line ) for i in line] +
[row01( line, j ) for j in line]
)
def A3( n ):
""" -> A 3n^2 x n^3, 3 1s in each column sparse csr """
cube = np.arange( n**3 ).reshape( n, n, n )
line = np.arange( n )
pairs = np.array([ [i, j] for i in line for j in line ])
def row01( *ix ):
row = sp.lil_matrix( (1, n**3) )
row[0, cube[ix]] = 1
return row.tocsr()
return sp.vstack(
# i j k
[row01( i, j, line ) for i, j in pairs] +
[row01( i, line, k ) for i, k in pairs] +
[row01( line, j, k ) for j, k in pairs]
)
def A4( n ):
""" -> A 4n^3 x n^4, 4 1s in each column sparse csr """
cube = np.arange( n**4 ).reshape( n, n, n, n )
line = np.arange( n )
triples = np.array([ [i, j, k] for i in line for j in line for k in line ])
def row01( *ix ):
row = sp.lil_matrix( (1, n**4) )
row[0, cube[ix]] = 1
return row.tocsr()
return sp.vstack(
# i j k, l
[row01( i, j, k, line ) for i, j, k in triples] +
[row01( i, j, line, l ) for i, j, l in triples] +
[row01( i, line, k, l ) for i, k, l in triples] +
[row01( line, j, k, l ) for j, k, l in triples]
)
#...............................................................................
if __name__ == "__main__":
import sys
np.set_printoptions( threshold=20, edgeitems=32, linewidth=150,
formatter = dict( float = lambda x: "%.2g" % x )) # float arrays %.2g
d = 4
n = 16
cint = 9 # c randint 0 .. cint+1 / uniform
bmul = 1
save = "" # > save.lp
seed = 0
# to change these params, run this.py a=1 b=None c='expr' ...
# in sh or ipython --
for arg in sys.argv[1:]:
exec( arg )
A, b, c = lpgen34( n, d=d, cint=cint, seed=seed )
if save:
import glp # numpy/scipy arrays <-> glpk
b *= bmul
lp = glp.LP( A=A, b=b, blo=b, c=c, problemname=save ) # Ax = b, 0 <= x
glp.save_lp( save + ".lp.gz", lp ) # .glp / .lp cplex / .mod gmpl / .mps
params: test-lpgen.py d 4 n 10 tol 1e-06 solvers highs-ds
lpgen34: n 10 d 4 A (4000, 10000) csr_matrix 40000 non0 seed 0 c [5 0 3 3 7 9 3 5 2 4] ...
[[1 1 1 1 1 1 1 1 1 1 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]]
...
[[1 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 1 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 1 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 1 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 1 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]]
...
[[1 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 1 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 1 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 1 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 1 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]]
...
[[1 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 1 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 1 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 1 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 1 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]]
...
--------------------------------------------------------------------------------
-- highs-ds
test-lpgen.py:50: OptimizeWarning: Sparse constraint matrix detected; setting 'sparse':True.
res = linprog( c, A_eq=A, b_eq=b, method=solver, options=options )
test-lpgen.py:50: OptimizeWarning: Unknown solver options: sparse
res = linprog( c, A_eq=A, b_eq=b, method=solver, options=options )
Presolve : Reductions: rows 4000(-0); columns 10000(-0); elements 40000(-0) - Not reduced
INFO : Problem not reduced by presolve: solving the LP
INFO : Scaling: Matrix has [min, max] values of [1, 1] within [0.2, 5] so no scaling performed
INFO : Initial basis condition estimate of 1 is within the tolerance of 1e+14
WARNING: Number of OMP threads available = 0 < 1 = Number of HiGHS threads to be used: Parallel performance will be less than anticipated
INFO : Using dual simplex solver - serial
INFO : LP has all |entries|=1; max column count = 4 (limit 24); average column count = 4 (limit 6): So is a candidate for LiDSE
Iteration Objective Infeasibilities num(sum)
DuPh2 0 0.0000000000e+00 Pr: 4000(4000)
DuPh2 180 7.0001625673e+01 Pr: 3416(3420); Du: 0(9.46589e-06)
DuPh2 374 1.6800350146e+02 Pr: 2887(2912); Du: 0(1.76788e-05)
DuPh2 583 2.5700540677e+02 Pr: 2460(2538); Du: 0(2.42991e-05)
DuPh2 806 3.7900746561e+02 Pr: 2068(2211); Du: 0(2.90745e-05)
DuPh2 1043 5.1500917459e+02 Pr: 1820(2006); Du: 0(3.06919e-05)
DuPh2 1295 7.1401088117e+02 Pr: 1609(1835); Du: 0(3.06377e-05)
DuPh2 1561 9.1701251346e+02 Pr: 1464(1797); Du: 0(2.94614e-05)
DuPh2 1830 1.0890138058e+03 Pr: 1593(2380); Du: 0(2.15557e-05)
DuPh2 2026 1.1710149845e+03 Pr: 1772(3547); Du: 0(9.34974e-06)
DuPh2 2247 1.2810154921e+03 Pr: 1609(3233); Du: 0(1.02796e-05)
DuPh2 2462 1.3560162709e+03 Pr: 1615(3692); Du: 0(6.02167e-06)
DuPh2 2648 1.3920174030e+03 Pr: 1756(5285); Du: 0(6.14233e-06)
DuPh2 2809 1.4280167480e+03 Pr: 1742(5825); Du: 0(4.98297e-06)
DuPh2 2956 1.4470171660e+03 Pr: 1809(6701); Du: 0(4.79045e-06)
DuPh2 3086 1.4570184423e+03 Pr: 2177(34700); Du: 0(4.95536e-06)
DuPh2 3215 1.4670174301e+03 Pr: 2040(13149); Du: 0(4.16578e-06)
DuPh2 3336 1.4720213859e+03 Pr: 2232(171881); Du: 0(4.55109e-06)
DuPh2 3463 1.4765208738e+03 Pr: 2198(85668.8); Du: 0(2.44967e-06)
DuPh2 3571 1.4825217775e+03 Pr: 2227(137204); Du: 0(2.83756e-06)
DuPh2 3681 1.4845269876e+03 Pr: 2226(241673); Du: 0(2.44967e-06)
DuPh2 3800 1.4861241794e+03 Pr: 2159(233507); Du: 0(3.35127e-06)
DuPh2 3902 1.4874849537e+03 Pr: 2223(39742.9); Du: 0(3.02353e-06)
DuPh2 4006 1.4898614423e+03 Pr: 2369(150697); Du: 0(2.57854e-06)
DuPh2 4100 1.4907366999e+03 Pr: 2222(163139); Du: 0(3.68271e-06)
DuPh2 4189 1.4926670078e+03 Pr: 2194(45972.5); Du: 0(3.42026e-06)
DuPh2 4286 1.4942649571e+03 Pr: 2237(339535); Du: 0(3.42026e-06)
DuPh2 4380 1.4964599723e+03 Pr: 2287(48998.5); Du: 0(3.42026e-06)
DuPh2 4469 1.4991359165e+03 Pr: 2216(352031); Du: 0(3.42026e-06)
DuPh2 4573 1.5017664442e+03 Pr: 2119(29010); Du: 0(3.42026e-06)
DuPh2 4668 1.5045484936e+03 Pr: 2210(325844); Du: 0(3.2914e-06)
DuPh2 4771 1.5057795171e+03 Pr: 2333(122531); Du: 0(3.2914e-06)
DuPh2 4867 1.5073807618e+03 Pr: 2062(38154); Du: 0(3.2914e-06)
DuPh2 4965 1.5088938203e+03 Pr: 2291(415341); Du: 0(3.2914e-06)
DuPh2 5069 1.5096260877e+03 Pr: 2286(603060); Du: 0(3.2914e-06)
DuPh2 5166 1.5102429890e+03 Pr: 2290(241178); Du: 0(3.2914e-06)
DuPh2 5264 1.5109456120e+03 Pr: 2320(166012); Du: 0(2.44967e-06)
DuPh2 5364 1.5115720113e+03 Pr: 2114(53233.5); Du: 0(2.44967e-06)
DuPh2 5465 1.5122253402e+03 Pr: 2309(939137); Du: 0(2.44967e-06)
DuPh2 5565 1.5133503489e+03 Pr: 2294(1.6502e+06); Du: 0(1.55432e-06)
DuPh2 5667 1.5138673308e+03 Pr: 2347(6.88956e+06); Du: 0(1.55432e-06)
DuPh2 5764 1.5146861231e+03 Pr: 2274(2.23724e+06); Du: 0(1.55432e-06)
DuPh2 5864 1.5154964047e+03 Pr: 2133(27002.6); Du: 0(1.55432e-06)
DuPh2 5964 1.5161611243e+03 Pr: 2157(370631); Du: 0(1.03928e-06)
DuPh2 6071 1.5165515237e+03 Pr: 2210(193620); Du: 0(1.03928e-06)
DuPh2 6170 1.5169253294e+03 Pr: 2269(4.41507e+06); Du: 0(1.03928e-06)
DuPh2 6275 1.5172145871e+03 Pr: 2086(32017.4); Du: 0(1.03928e-06)
DuPh2 6377 1.5174756969e+03 Pr: 2283(482801); Du: 0(1.03928e-06)
DuPh2 6480 1.5177100895e+03 Pr: 2208(518429); Du: 0(1.03928e-06)
DuPh2 6581 1.5182266944e+03 Pr: 2287(630095); Du: 0(1.03928e-06)
Iteration Objective Infeasibilities num(sum)
DuPh2 6685 1.5193072940e+03 Pr: 2267(847888); Du: 0(1.03928e-06)
DuPh2 6781 1.5205769891e+03 Pr: 2121(101102); Du: 0(1.03928e-06)
DuPh2 6880 1.5213246468e+03 Pr: 2321(1.20581e+06); Du: 0(1.03928e-06)
DuPh2 6971 1.5220169607e+03 Pr: 2112(274082); Du: 0(1.03928e-06)
DuPh2 7065 1.5223391943e+03 Pr: 2303(550445); Du: 0(1.03928e-06)
DuPh2 7166 1.5227045194e+03 Pr: 2331(710443); Du: 0(1.03928e-06)
DuPh2 7273 1.5233503947e+03 Pr: 2271(1.54566e+06); Du: 0(1.03928e-06)
DuPh2 7365 1.5241194844e+03 Pr: 2283(2.02434e+06); Du: 0(1.03928e-06)
DuPh2 7458 1.5245534491e+03 Pr: 2240(301104); Du: 0(1.03928e-06)
DuPh2 7554 1.5252159345e+03 Pr: 2329(1.40521e+06); Du: 0(1.03928e-06)
DuPh2 7653 1.5260000431e+03 Pr: 2121(864766); Du: 0(1.03928e-06)
DuPh2 7758 1.5263490603e+03 Pr: 2254(1.38844e+06); Du: 0(1.03928e-06)
DuPh2 7855 1.5267952426e+03 Pr: 2318(152807); Du: 0(1.03928e-06)
DuPh2 7950 1.5287859896e+03 Pr: 2360(5.00106e+06); Du: 0(1.12136e-06)
DuPh2 8043 1.5305251862e+03 Pr: 2224(35100.1); Du: 0(1.12136e-06)
DuPh2 8136 1.5327613834e+03 Pr: 2296(1.60169e+06); Du: 0(1.12136e-06)
DuPh2 8243 1.5359735454e+03 Pr: 2282(48232.5); Du: 0(1.12136e-06)
DuPh2 8337 1.5376586995e+03 Pr: 2363(971363); Du: 0(1.12136e-06)
DuPh2 8431 1.5388183952e+03 Pr: 2352(59607); Du: 0(1.12136e-06)
DuPh2 8533 1.5405205323e+03 Pr: 2329(199332); Du: 0(1.12136e-06)
DuPh2 8635 1.5417880665e+03 Pr: 2322(148711); Du: 0(1.12136e-06)
DuPh2 8738 1.5427193753e+03 Pr: 2354(347500); Du: 0(1.03928e-06)
DuPh2 8840 1.5447530504e+03 Pr: 2341(149689); Du: 0(1.03928e-06)
DuPh2 8939 1.5466112081e+03 Pr: 2344(1.0031e+06); Du: 0(1.03928e-06)
DuPh2 9044 1.5484292280e+03 Pr: 2321(280597); Du: 0(1.03928e-06)
DuPh2 9146 1.5501748683e+03 Pr: 2300(380805); Du: 0(1.03928e-06)
DuPh2 9247 1.5516470831e+03 Pr: 2309(3.1873e+06); Du: 0(1.03928e-06)
DuPh2 9351 1.5531705643e+03 Pr: 2173(17071.7); Du: 0(1.03928e-06)
DuPh2 9462 1.5549328606e+03 Pr: 2276(180124); Du: 0(1.03928e-06)
DuPh2 9565 1.5561826303e+03 Pr: 2082(8087.68); Du: 0(1.03928e-06)
DuPh2 9669 1.5580549166e+03 Pr: 2315(1.20853e+06); Du: 0(1.03928e-06)
DuPh2 9783 1.5595272060e+03 Pr: 2316(944080); Du: 0(1.03928e-06)
DuPh2 9890 1.5610087214e+03 Pr: 2309(1.32678e+07); Du: 0(1.03928e-06)
DuPh2 9995 1.5625906161e+03 Pr: 2251(77014.9); Du: 0(1.03928e-06)
DuPh2 10105 1.5644206699e+03 Pr: 2297(959888); Du: 0(1.03928e-06)
DuPh2 10220 1.5657258948e+03 Pr: 2285(485017); Du: 0(1.03928e-06)
DuPh2 10348 1.5671678446e+03 Pr: 2279(178665); Du: 0(1.03928e-06)
DuPh2 10468 1.5691639245e+03 Pr: 2281(51743.6); Du: 0(1.03928e-06)
DuPh2 10574 1.5714502036e+03 Pr: 2333(372934); Du: 0(1.03928e-06)
DuPh2 10689 1.5726124691e+03 Pr: 2299(473673); Du: 0(1.03928e-06)
DuPh2 10799 1.5741882884e+03 Pr: 2281(308936); Du: 0(1.03928e-06)
DuPh2 10901 1.5761095028e+03 Pr: 2272(220660); Du: 0(1.03928e-06)
DuPh2 11003 1.5772623632e+03 Pr: 2241(350230); Du: 0(1.03928e-06)
DuPh2 11110 1.5784499674e+03 Pr: 2238(124080); Du: 0(1.03928e-06)
DuPh2 11231 1.5797237374e+03 Pr: 2259(123110); Du: 0(1.03928e-06)
DuPh2 11343 1.5817962195e+03 Pr: 2127(41736.5); Du: 0(1.03928e-06)
DuPh2 11457 1.5828548274e+03 Pr: 2073(10846.3); Du: 0(1.03928e-06)
DuPh2 11561 1.5840474419e+03 Pr: 2249(74979.8); Du: 0(1.03928e-06)
DuPh2 11666 1.5853137991e+03 Pr: 2296(2.37586e+06); Du: 0(1.03928e-06)
DuPh2 11787 1.5869411066e+03 Pr: 2226(381953); Du: 0(1.03928e-06)
Iteration Objective Infeasibilities num(sum)
DuPh2 11902 1.5881436227e+03 Pr: 2200(1.02754e+06); Du: 0(1.03928e-06)
DuPh2 12012 1.5894829203e+03 Pr: 2141(14678.7); Du: 0(1.03928e-06)
DuPh2 12129 1.5905378176e+03 Pr: 2270(368535); Du: 0(1.03928e-06)
DuPh2 12254 1.5913033389e+03 Pr: 2263(126355); Du: 0(1.03928e-06)
DuPh2 12366 1.5924115125e+03 Pr: 2285(1.00095e+07); Du: 0(1.03928e-06)
DuPh2 12484 1.5940579071e+03 Pr: 2257(4.96586e+06); Du: 0(1.03928e-06)
DuPh2 12608 1.5954756044e+03 Pr: 2160(45447.8); Du: 0(1.03928e-06)
DuPh2 12722 1.5970216848e+03 Pr: 2287(1.47889e+06); Du: 0(1.03928e-06)
DuPh2 12849 1.5985638955e+03 Pr: 2214(318730); Du: 0(1.03928e-06)
DuPh2 12973 1.5999348274e+03 Pr: 2241(416590); Du: 0(1.03928e-06)
DuPh2 13097 1.6012685569e+03 Pr: 2249(825768); Du: 0(1.03928e-06)
DuPh2 13219 1.6024581629e+03 Pr: 2271(878117); Du: 0(1.03928e-06)
DuPh2 13344 1.6035133326e+03 Pr: 2254(212336); Du: 0(1.03928e-06)
DuPh2 13496 1.6048998026e+03 Pr: 2266(1.5996e+06); Du: 0(1.03928e-06)
DuPh2 13636 1.6063449654e+03 Pr: 2232(1.42782e+06); Du: 0(1.03928e-06)
DuPh2 13770 1.6075003501e+03 Pr: 2218(49130.9); Du: 0(1.03928e-06)
DuPh2 13913 1.6084703463e+03 Pr: 2244(285643); Du: 0(1.03928e-06)
DuPh2 14063 1.6093662052e+03 Pr: 2195(93294.4); Du: 0(1.03928e-06)
DuPh2 14216 1.6109518372e+03 Pr: 2272(1.83802e+06); Du: 0(1.03928e-06)
DuPh2 14378 1.6125029661e+03 Pr: 2245(105709); Du: 0(1.03928e-06)
DuPh2 14523 1.6136874988e+03 Pr: 2258(378175); Du: 0(1.03928e-06)
DuPh2 14676 1.6145939076e+03 Pr: 2206(61069.4); Du: 0(1.03928e-06)
DuPh2 14830 1.6162623861e+03 Pr: 2252(1.99586e+06); Du: 0(1.03928e-06)
DuPh2 14987 1.6180100657e+03 Pr: 2223(307164); Du: 0(1.03928e-06)
DuPh2 15156 1.6195978241e+03 Pr: 2232(194702); Du: 0(1.03928e-06)
DuPh2 15320 1.6215035318e+03 Pr: 2224(2.54722e+06); Du: 0(1.03928e-06)
DuPh2 15486 1.6230607847e+03 Pr: 2195(229647); Du: 0(1.03928e-06)
DuPh2 15655 1.6261753116e+03 Pr: 2175(647627); Du: 0(1.03928e-06)
DuPh2 15830 1.6275442989e+03 Pr: 2164(3.50127e+06); Du: 0(1.03928e-06)
DuPh2 15995 1.6293640932e+03 Pr: 2181(180282); Du: 0(1.03928e-06)
DuPh2 16185 1.6313783954e+03 Pr: 2220(2.50797e+06); Du: 0(1.03928e-06)
DuPh2 16399 1.6339011130e+03 Pr: 2146(1.77269e+06); Du: 0(1.03928e-06)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 16576 1.6353636643e+03 Pr: 2197(139052); Du: 0(1.03928e-06)
DuPh2 16758 1.6379495769e+03 Pr: 2172(5.00995e+06); Du: 0(1.03928e-06)
DuPh2 16954 1.6403522554e+03 Pr: 2159(253557); Du: 0(1.03928e-06)
DuPh2 17161 1.6420404965e+03 Pr: 2166(107367); Du: 0(1.03928e-06)
DuPh2 17348 1.6441716358e+03 Pr: 2147(291034); Du: 0(1.03928e-06)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 17561 1.6469001506e+03 Pr: 2168(2.59079e+06); Du: 0(1.03928e-06)
DuPh2 17793 1.6505798196e+03 Pr: 1977(9902.55); Du: 0(5.34915e-07)
DuPh2 18035 1.6550810990e+03 Pr: 2089(185749); Du: 0(5.34915e-07)
DuPh2 18347 1.6597474227e+03 Pr: 2068(28689); Du: 0(5.34915e-07)
DuPh2 18656 1.6663235530e+03 Pr: 2028(17633.4); Du: 0(5.34915e-07)
DuPh2 18975 1.6724133614e+03 Pr: 1835(3322.17); Du: 0(5.34915e-07)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 19241 1.6779123286e+03 Pr: 1954(30861.7); Du: 0(5.34915e-07)
DuPh2 19623 1.6830920692e+03 Pr: 1813(4473.41)
DuPh2 19993 1.6870515663e+03 Pr: 1696(82807.4)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 20308 1.6901126621e+03 Pr: 1612(17329.6)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 20640 1.6934330416e+03 Pr: 1642(25909.1)
DuPh2 21043 1.6975282746e+03 Pr: 1605(10632.4)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 21328 1.7003053161e+03 Pr: 1691(218509)
WARNING: HiGHS has identified numerical trouble so reinvert
Iteration Objective Infeasibilities num(sum)
DuPh2 21563 1.7024296986e+03 Pr: 1587(6265.09)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 21903 1.7056699915e+03 Pr: 1560(4739.34)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 22219 1.7083643001e+03 Pr: 1676(66269.7)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 22473 1.7103478236e+03 Pr: 1540(6236.54)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 22759 1.7133431662e+03 Pr: 1632(36347.4)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 22992 1.7153079387e+03 Pr: 1645(98271.6)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 23172 1.7168070611e+03 Pr: 1600(9017.57)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 23455 1.7189825580e+03 Pr: 1676(155442)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 23833 1.7217927849e+03 Pr: 1560(5664.53)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 24055 1.7234562162e+03 Pr: 1658(31270.8)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 24307 1.7253014636e+03 Pr: 1353(1187.02)
DuPh2 24686 1.7286260607e+03 Pr: 1526(2706.36)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 24941 1.7309543912e+03 Pr: 1643(12411.1)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 25176 1.7327165414e+03 Pr: 1488(2962.23)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 25464 1.7348803032e+03 Pr: 1678(2.11184e+06)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 25689 1.7358246585e+03 Pr: 1673(22894.7)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 25948 1.7369212743e+03 Pr: 1562(5067.67)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 26133 1.7381021080e+03 Pr: 1593(9272.56)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 26387 1.7392623560e+03 Pr: 1597(5435.07)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 26620 1.7402666589e+03 Pr: 1673(98092.2)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 26929 1.7429230765e+03 Pr: 1550(4215.25)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 27284 1.7449127735e+03 Pr: 1175(766.454)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 27604 1.7466811466e+03 Pr: 1637(16864.6)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 27850 1.7482438059e+03 Pr: 1651(15983.5)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 28164 1.7491102920e+03 Pr: 1678(204287)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 28415 1.7505739521e+03 Pr: 1639(9050.45)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 28673 1.7516371426e+03 Pr: 1693(63452.5)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 28898 1.7528950422e+03 Pr: 1679(59415)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 29252 1.7545162528e+03 Pr: 1609(9937.04)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 29533 1.7556684495e+03 Pr: 1634(13336.9)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 29813 1.7567470144e+03 Pr: 1579(4277.58)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 30117 1.7584499787e+03 Pr: 1507(2386.95)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 30357 1.7594211493e+03 Pr: 1498(2718.37)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 30640 1.7604062996e+03 Pr: 1586(8463.56)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 30960 1.7615734841e+03 Pr: 1650(21082.6)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 31204 1.7624775049e+03 Pr: 1215(810.796)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 31523 1.7638479397e+03 Pr: 1116(598.092)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 31800 1.7648969401e+03 Pr: 1677(82372.3)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 31965 1.7656029268e+03 Pr: 1582(7619.4)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 32285 1.7670120260e+03 Pr: 1530(3519.12)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 32680 1.7688486024e+03 Pr: 1458(2791.73)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 33039 1.7702830369e+03 Pr: 1511(2549.88)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 33298 1.7714575467e+03 Pr: 1669(25977.5)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 33551 1.7724159709e+03 Pr: 1032(444.757)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 33827 1.7734279506e+03 Pr: 1565(5387.48)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 34053 1.7741536236e+03 Pr: 1672(18440.8)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 34393 1.7751245493e+03 Pr: 1390(1618.82)
DuPh2 34818 1.7763460100e+03 Pr: 1650(10051.8)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 35134 1.7771857470e+03 Pr: 1637(18272.4)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 35418 1.7783069993e+03 Pr: 1529(3469.46)
WARNING: HiGHS has identified numerical trouble so reinvert
Iteration Objective Infeasibilities num(sum)
DuPh2 35687 1.7792812190e+03 Pr: 1022(358.105)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 35895 1.7798993550e+03 Pr: 1655(15766.8)
DuPh2 36339 1.7812553576e+03 Pr: 1477(1931.68)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 36652 1.7820359384e+03 Pr: 1643(12128.4)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 36917 1.7826649813e+03 Pr: 1693(34275.6)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 37288 1.7838673660e+03 Pr: 1651(26503.4)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 37534 1.7842873132e+03 Pr: 943(345.502)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 37715 1.7845452143e+03 Pr: 1577(4278.98)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 38031 1.7852333009e+03 Pr: 1603(5302.05)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 38378 1.7858374339e+03 Pr: 1347(1364.82)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 38671 1.7865626587e+03 Pr: 1287(983.989)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 39100 1.7875367321e+03 Pr: 1455(2521.57)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 39468 1.7881755884e+03 Pr: 1584(4588.89)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 39788 1.7888799211e+03 Pr: 1379(1345.6)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 40044 1.7893126796e+03 Pr: 1569(4785.46)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 40388 1.7898832492e+03 Pr: 1354(1273.83)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 40692 1.7906955634e+03 Pr: 1072(464.917)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 41034 1.7914172019e+03 Pr: 1580(5188.42)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 41309 1.7917391438e+03 Pr: 1566(4010.05)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 41673 1.7922969135e+03 Pr: 1675(10698.6)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 41956 1.7925655449e+03 Pr: 1721(19573.5)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 42237 1.7929413433e+03 Pr: 1669(23012.1)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 42473 1.7932923234e+03 Pr: 1210(757.06)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 42729 1.7937045052e+03 Pr: 1671(27398.8)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 43001 1.7941916820e+03 Pr: 1533(3704.31)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 43278 1.7945753564e+03 Pr: 1348(1180.66)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 43602 1.7950818591e+03 Pr: 1097(535.696)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 43935 1.7955524229e+03 Pr: 1575(5527.27)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 44182 1.7958387726e+03 Pr: 1236(894.569)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 44490 1.7962513941e+03 Pr: 875(259.411)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 44778 1.7964389906e+03 Pr: 1436(1484.11)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 45032 1.7967605927e+03 Pr: 1551(3482.01)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 45329 1.7971662810e+03 Pr: 1671(25339.3)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 45710 1.7975005882e+03 Pr: 762(180.816)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 45886 1.7975827449e+03 Pr: 462(56.9916)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 46149 1.7978053214e+03 Pr: 407(41.3334)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 46441 1.7980361733e+03 Pr: 1015(439.045)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 46756 1.7983228165e+03 Pr: 1263(799.612)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 47063 1.7985640225e+03 Pr: 1449(2018.73)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 47413 1.7988367065e+03 Pr: 1286(1024.13)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 47751 1.7990698492e+03 Pr: 1672(9178.17)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 47992 1.7992362159e+03 Pr: 1410(1593.8)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 48348 1.7994955643e+03 Pr: 242(13.7757)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 48517 1.7995537755e+03 Pr: 598(88.4479)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 48795 1.7996927070e+03 Pr: 312(23.8718)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 49079 1.7997850308e+03 Pr: 602(96.4739)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 49385 1.7998844950e+03 Pr: 245(14.0999)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 49709 1.7999601791e+03 Pr: 133(4.01925)
WARNING: HiGHS has identified numerical trouble so reinvert
DuPh2 50006 1.8000070109e+03 Pr: 65(1.26916)
DuPh2 50246 1.8000274635e+03 Pr: 0(7.03611e-10)
Iteration Objective Infeasibilities num(sum)
DuPh2 50246 1.8000084362e+03 Pr: 0(7.03611e-10)
INFO : Dual simplex iterations [Ph1 0; Ph2 50246; Pr 0] Total 50246
Postsolve :
Time : 36.5
Time Pre : 0.00218
Time PreLP : -1
Time PostLP: 36.5
For LP : Presolve 0.00218 ( 0%): Solve original LP 36.5 ( 99%)
res:
con: array([0, 0, 0, 0, 0, 0, 0, -1.4e-12, 0, 0, ..., 0, 9.1e-13, 0, 0, 8.7e-13, 1.2e-12, 0, 0, 0, -3e-12])
crossover_nit: 0
fun: 1800.008436208187
message: 'Optimization terminated successfully.'
nit: 50246
slack: array([], dtype=float64)
status: 0
success: True
x: array([0, 0.46, 0, 0, 0, 0, 0.19, 0, 0.23, 0.12, ..., 0, 0, 0, 0, 0.52, 0, 0, 0.19, 0, 0.3])
38.43 real time 38.64 user 0.42 sys 101% of 4 cores imac 2.7 GHz
params: test-lpgen.py d 4 n 10 tol 1e-06 solvers highs-ipm
lpgen34: n 10 d 4 A (4000, 10000) csr_matrix 40000 non0 seed 0 c [5 0 3 3 7 9 3 5 2 4] ...
[[1 1 1 1 1 1 1 1 1 1 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]]
...
[[1 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 1 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 1 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 1 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 1 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]]
...
[[1 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 1 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 1 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 1 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 1 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]]
...
[[1 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 1 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 1 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 1 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 1 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0]]
...
--------------------------------------------------------------------------------
-- highs-ipm
test-lpgen.py:50: OptimizeWarning: Sparse constraint matrix detected; setting 'sparse':True.
res = linprog( c, A_eq=A, b_eq=b, method=solver, options=options )
test-lpgen.py:50: OptimizeWarning: Unknown solver options: sparse
res = linprog( c, A_eq=A, b_eq=b, method=solver, options=options )
Presolve : Reductions: rows 4000(-0); columns 10000(-0); elements 40000(-0) - Not reduced
INFO : Problem not reduced by presolve: solving the LP
INFO : IPX model has 4000 rows, 10000 columns and 40000 nonzeros
IPX version 1.0
Input
Number of variables: 10000
Number of free variables: 0
Number of constraints: 4000
Number of equality constraints: 4000
Number of matrix entries: 40000
Matrix range: [1e+00, 1e+00]
RHS range: [1e+00, 1e+00]
Objective range: [1e+00, 9e+00]
Bounds range: [0e+00, 0e+00]
Preprocessing
Dualized model: no
Number of dense columns: 0
Range of scaling factors: [1.00e+00, 1.00e+00]
Interior Point Solve
Iter P.res D.res P.obj D.obj mu Time
0 1.58e+00 1.73e+01 4.42897561e+03 4.42897561e+03 2.83e+01 0s
1 3.97e-02 1.73e-05 4.14779783e+03 -1.07549769e+04 1.47e+00 0s
2 1.06e-02 3.92e-06 3.80935573e+03 -5.43340415e+02 3.57e-01 0s
3 3.57e-03 1.33e-06 2.74644570e+03 1.05251308e+03 1.34e-01 0s
4 1.41e-03 4.86e-07 2.20059412e+03 1.50499933e+03 5.49e-02 0s
5 5.71e-04 1.71e-07 1.98176990e+03 1.67888302e+03 2.41e-02 0s
6 1.51e-04 4.29e-08 1.87957222e+03 1.74892902e+03 9.79e-03 0s
Constructing starting basis...
7 4.42e-05 1.55e-08 1.83400174e+03 1.77713539e+03 5.81e-03 1s
8 1.52e-05 4.06e-09 1.81774492e+03 1.79021290e+03 2.79e-03 1s
9 4.42e-06 1.32e-09 1.80702370e+03 1.79584578e+03 1.13e-03 1s
10 1.54e-06 5.20e-10 1.80298626e+03 1.79809669e+03 4.93e-04 1s
11 3.82e-07 1.29e-10 1.80136202e+03 1.79921094e+03 2.16e-04 2s
12 5.43e-08 3.96e-11 1.80040483e+03 1.79967760e+03 7.29e-05 2s
13 1.37e-08 1.49e-11 1.80015257e+03 1.79986459e+03 2.88e-05 2s
14 2.16e-09 7.64e-12 1.80007152e+03 1.79992247e+03 1.49e-05 2s
15 7.11e-10 3.51e-12 1.80003351e+03 1.79996718e+03 6.63e-06 2s
16 2.09e-10 1.72e-12 1.80002048e+03 1.79998646e+03 3.40e-06 2s
17 4.09e-11 3.86e-13 1.80001115e+03 1.80000333e+03 7.82e-07 2s
18* 9.14e-12 6.57e-14 1.80000915e+03 1.80000765e+03 1.50e-07 2s
19* 1.55e-12 1.91e-14 1.80000863e+03 1.80000834e+03 2.83e-08 2s
20* 5.55e-16 1.95e-14 1.80000845e+03 1.80000841e+03 3.58e-09 2s
21* 4.44e-16 1.69e-14 1.80000844e+03 1.80000844e+03 1.11e-10 2s
22* 3.89e-16 2.09e-14 1.80000844e+03 1.80000844e+03 1.52e-11 2s
23* 4.44e-16 2.15e-14 1.80000844e+03 1.80000844e+03 8.57e-17 2s
Crossover
Primal residual before push phase: 1.77e-13
Dual residual before push phase: 3.72e-12
Number of dual pushes required: 6
Number of primal pushes required: 0
Summary
Runtime: 2.29s
Status interior point solve: optimal
Status crossover: optimal
objective value: 1.80000844e+03
interior solution primal residual (abs/rel): 4.59e-15 / 2.29e-15
interior solution dual residual (abs/rel): 2.15e-14 / 2.15e-15
interior solution objective gap (abs/rel): 2.96e-12 / 1.64e-15
basic solution primal infeasibility: 0.00e+00
basic solution dual infeasibility: 0.00e+00
INFO : Ipx: IPM optimal
INFO : Ipx: Crossover optimal
Postsolve :
Time : 2.31
Time Pre : 0.00217
Time PreLP : -1
Time PostLP: 2.3
For LP : Presolve 0.00217 ( 0%): Solve original LP 2.3 ( 99%)
res:
con: array([0, 0, 0, 0, 0, 0, 0, 0, -2.6e-12, 0, ..., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
crossover_nit: 6
fun: 1800.0084362082396
message: 'Optimization terminated successfully.'
nit: 23
slack: array([], dtype=float64)
status: 0
success: True
x: array([0, 0.46, 0, 0, 0, 0, 0.19, 0, 0.23, 0.12, ..., 0, 0, 0, 0, 0.52, 0, 0, 0.19, 0, 0.3])
4.17 real time 4.37 user 0.44 sys 115% of 4 cores imac 2.7 GHz
#!/usr/bin/env python3
""" test scipy.optimize.linprog highs* lpgen34 """
import sys
import numpy as np
from scipy import sparse
from scipy.optimize import linprog # $scopt/_linprog_doc.py
# from scipy.optimize.tests.test_linprog import lpgen_2d # dense
from lpgen34 import lpgen34 # https://gist.github.com/denis-bz/
__version__ = "2021-01-17" # denis-bz-py t-online.de
np.set_printoptions( threshold=20, edgeitems=10, linewidth=120,
formatter = dict( float = lambda x: "%.2g" % x )) # float arrays %.2g
# print( nu.versionstr() ) # numpy 1.19.5 scipy 1.6.0 python 3.7.6
thispy = sys.argv[0]
#...............................................................................
d = 4
n = 12
solvers = "highs-ds highs-ipm " # highs == ds
disp = True
timelimit = 600 # .1 -> f, x None
tol = 1e-6 # IPM should quit when mu < this
# to change these params, run this.py a=1 b=None 'c = expr' ... in sh or ipython --
for arg in sys.argv[1:]:
exec( arg )
params = "%s d %d n %d tol %g solvers %s " % (
thispy, d, n, tol, solvers )
print( "params:", params )
A, b, c = lpgen34( n, d=d ) # d=4: 4n^3 x n^4, 4 1s in each column, n in each row
# A, b, c = lpgen_2d( n, n ) # 2n x n^2, 2 n^2 nnz dense
# A = sparse.csr_matrix( A )
options = dict(
disp=disp, time_limit=timelimit,
dual_feasibility_tolerance=tol,
primal_feasibility_tolerance=tol,
ipm_optimality_tolerance=tol )
#...............................................................................
for solver in solvers.split():
print( "\n" + 80 * "-" )
print( "-- %s n %d" % (solver, n ))
res = linprog( c, A_eq=A, b_eq=b, method=solver, options=options )
print( "res: \n", res )
# quantiles |x| and |b - Ax|, save > .npz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment