ENH: LinearOperator for linprog arguments A_ub and A_eq
See original GitHub issueIs your feature request related to a problem? Please describe.
The estimation of linear quantile regression can be recast as a linear programming problem with equality matrix
n_samples = X.shape[0]
A_eq = np.concatenate(
[X, -X, np.eye(n_samples), -np.eye(n_samples)], axis=1
)
where X
is the feature matrix (predict will give X @ coef
), see https://github.com/scikit-learn/scikit-learn/blob/0d378913be6d7e485b792ea36e9268be31ed52d0/sklearn/linear_model/_quantile.py#L203-L217.
This could help to save computation time and memory.
Describe the solution you’d like.
I’d like be able to pass a scipy.sparse.linalg.LinearOperator
to linprog
as argument A_ub
and A_eq
.
Describe alternatives you’ve considered.
No response
Additional context (e.g. screenshots, GIFs)
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:16 (9 by maintainers)
Top Results From Across the Web
MATLAB linprog - Solve linear programming problems
Set Aeq = [] and beq = [] if no equalities exist. Note. If the specified input bounds for a problem are inconsistent,...
Read more >linprog (Optimization Toolbox)
linprog. Solve a linear programming problem. where f, x, b, beq, lb, and ub are vectors and A and Aeq are matrices. Syntax....
Read more >scipy.optimize.linprog — SciPy v1.9.3 Manual
Guess values of the decision variables, which will be refined by the optimization algorithm. This argument is currently used only by the 'revised...
Read more >How can I get integer solutions with scipy.optimize.linprog?
Following is a python module that includes a function LPmi(.) to solve mixed integer linear programs. It employs the Branch and Bound algorithm ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I see what you mean now. Thanks. Been a productive discussion for me, but I think it’s run its course. Cheers Julian
No, HiGHS cannot handle anything other than an actual sparse matrix.
It’s conceivable that the simplex solver could be adapted to handle an abstracted linear operator as a means of obtaining columns of the implied constraint matrix, and performing matrix-vector products. However, a square submatrix of the constraint matrix would have to be formed periodically as an actual sparse matrix, so some overhead comparable to supplying the whole matrix in that form would be inevitable unless the whole matrix has overwhelmingly more columns than rows.
Although it’s an interesting challenge, incorporating it would be a lot of work, for which resources are currently unavailable. Thus, whoever wanted it would have to come up with a lot of cash!