Title: Segmentation fault when running LPs repeatedly · Issue #8 · sharpbracket/python-qsoptex · GitHub
Open Graph Title: Segmentation fault when running LPs repeatedly · Issue #8 · sharpbracket/python-qsoptex
X Title: Segmentation fault when running LPs repeatedly · Issue #8 · sharpbracket/python-qsoptex
Description: Hello I am using a MAC OS Big Sur Version 11.3.1 When I run the solver multiple times SOMETIMES it segmentation faults, I dont know if this is because of qsopt_ex or because of the cython library. Just copy the code below into a file cal...
Open Graph Description: Hello I am using a MAC OS Big Sur Version 11.3.1 When I run the solver multiple times SOMETIMES it segmentation faults, I dont know if this is because of qsopt_ex or because of the cython library. ...
X Description: Hello I am using a MAC OS Big Sur Version 11.3.1 When I run the solver multiple times SOMETIMES it segmentation faults, I dont know if this is because of qsopt_ex or because of the cython library. ...
Opengraph URL: https://github.com/sharpbracket/python-qsoptex/issues/8
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Segmentation fault when running LPs repeatedly","articleBody":"Hello I am using a MAC OS Big Sur Version 11.3.1 \r\n\r\nWhen I run the solver multiple times SOMETIMES it segmentation faults, I dont know if this is because of qsopt_ex or because of the cython library. Just copy the code below into a file called `reproducing_seg_fault.py` and run the program like 20 or so times consecutively. One of the times will result in a segfault (see here) \r\n\u003cimg width=\"738\" alt=\"Screen Shot 2023-03-24 at 8 20 21 PM\" src=\"https://user-images.githubusercontent.com/5061556/227667055-e091b53e-aa03-4197-a068-489729020300.png\"\u003e\r\n\r\nCode here:\r\n\r\n```\r\nimport qsoptex\r\n\r\nimport faulthandler\r\nfaulthandler.enable()\r\n\r\n#import logging\r\n#logging.basicConfig(level=logging.NOTSET)\r\n\r\nclass Polytope:\r\n def __init__(self, A, b):\r\n self.A = A\r\n self.b = b\r\n self.status = None\r\n \"\"\"\r\n The status variable carries the status of a most recent solve, if it is set to None then an LP run has not occurred yet \r\n \"\"\"\r\n self.p = None\r\n\r\n def dimension(self):\r\n return len(self.A[0])\r\n \r\n def inequality_count(self):\r\n return len(self.A)\r\n\r\n #given an objective array c we attempt to maximize it and return the status, surprising the \"c\" tells us what the dimension of the problem is \r\n def maximize(self, c, flag_integers=True): \r\n self.p = qsoptex.ExactProblem()\r\n for var_number in range(len(c)):\r\n self.p.add_variable(name='x' + str(var_number), \r\n objective=c[var_number], \r\n lower=0, upper=1)\r\n\r\n for constraint_number in range(self.inequality_count()):\r\n self.p.add_linear_constraint(qsoptex.ConstraintSense.LESS, \r\n dict(('x' + str(var_number), self.A[constraint_number][var_number]) for var_number in range(len(c))), \r\n rhs = self.b[constraint_number], \r\n name='c' + str(constraint_number))\r\n\r\n self.p.set_objective_sense(qsoptex.ObjectiveSense.MAXIMIZE)\r\n self.p.set_param(qsoptex.Parameter.SIMPLEX_DISPLAY, 1)\r\n print(\"before seg fault: \")\r\n self.status = self.p.solve()\r\n print(\"after seg fault: \")\r\n\r\n\r\n \r\n\r\nif __name__ == '__main__':\r\n\r\n #running one at a time never results in a segfault\r\n #running both of these repeatedly results in a segfault \r\n\r\n \r\n A_matrix = [[1037066, 2074132, 1648264, 796528, 1593056, 686112, 1372224, 244448, 488896, 977792, 1955584, 1411168, 322336, 644672, 1289344, 78688, 157376, 314752, 629504, 1259008], [-1037066, -2074132, -1648264, -796528, -1593056, -686112, -1372224, -244448, -488896, -977792, -1955584, -1411168, -322336, -644672, -1289344, -78688, -157376, -314752, -629504, -1259008]]\r\n b_matrix = [2463098, -2463098]\r\n c_matrix = [0, -1, 1, -1, 1, -1, 0, 0, 0, 0, -1, 0, -1, -1, 0, 1, 0, 1, 1, -1]\r\n\r\n test_polyhedron = Polytope(A_matrix, b_matrix)\r\n \r\n test_polyhedron.maximize( c_matrix)\r\n\r\n A_matrix = [[1037066, 2074132, 1648264, 796528, 1593056, 686112, 1372224, 244448, 488896, 977792, 1955584, 1411168, 322336, 644672, 1289344, 78688, 157376, 314752, 629504, 1259008], [-1037066, -2074132, -1648264, -796528, -1593056, -686112, -1372224, -244448, -488896, -977792, -1955584, -1411168, -322336, -644672, -1289344, -78688, -157376, -314752, -629504, -1259008]]\r\n b_matrix = [2463098, -2463098]\r\n c_matrix = [0, -1, 1, -1, 1, -1, 0, 0, 0, 0, -1, 0, -1, -1, 0, 1, 0, 1, 1, -1]\r\n\r\n test_polyhedron = Polytope(A_matrix, b_matrix)\r\n\r\n test_polyhedron.maximize( c_matrix)\r\n```","author":{"url":"https://github.com/frogeyedpeas","@type":"Person","name":"frogeyedpeas"},"datePublished":"2023-03-25T00:21:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/8/python-qsoptex/issues/8"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d460218e-6134-c46c-a796-ee50a19f0040 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A370:21F0CB:D6FE07:125AF9C:6A63BA93 |
| html-safe-nonce | 0c2f3353074551ab32779d2a684fa735106277b75e4d87b357e8ed317ff2c183 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzcwOjIxRjBDQjpENkZFMDc6MTI1QUY5Qzo2QTYzQkE5MyIsInZpc2l0b3JfaWQiOiI2MzIwMTEyODk5NzU3MTYxMTA3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | aa774c0e5e21670176826cab239e52a604e1a073d9eaba6d2e25f35a8d52f586 |
| hovercard-subject-tag | issue:1640235762 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/sharpbracket/python-qsoptex/8/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c62ab2628ce5ce131996dfd30c66eea1c1ae37a2c02fc867b390b52e3e46d404/sharpbracket/python-qsoptex/issues/8 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c62ab2628ce5ce131996dfd30c66eea1c1ae37a2c02fc867b390b52e3e46d404/sharpbracket/python-qsoptex/issues/8 |
| og:image:alt | Hello I am using a MAC OS Big Sur Version 11.3.1 When I run the solver multiple times SOMETIMES it segmentation faults, I dont know if this is because of qsopt_ex or because of the cython library. ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | frogeyedpeas |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4c1c4f1792dfc705b5a5073fed6c61988f59766cec1277f24f55d4b876f9881c |
| turbo-cache-control | no-preview |
| go-import | github.com/sharpbracket/python-qsoptex git https://github.com/sharpbracket/python-qsoptex.git |
| octolytics-dimension-user_id | 272925331 |
| octolytics-dimension-user_login | sharpbracket |
| octolytics-dimension-repository_id | 28111148 |
| octolytics-dimension-repository_nwo | sharpbracket/python-qsoptex |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 28111148 |
| octolytics-dimension-repository_network_root_nwo | sharpbracket/python-qsoptex |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | fefaad6f0be5c33f57f42bb65ed668f74c872364 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width