TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Kotlin and linear programming

89 点作者 andrewtorkbaker超过 7 年前

10 条评论

graycat超过 7 年前
&gt; “Linear” means continuous<p>No. As in G. Simmons, the two pillars of the field of &#x27;analysis&#x27; in math are linearity and continuity. The two are quite different.<p>Linearity usually has to do with numbers and vectors. The numbers are usually in the set R of real numbers or the set C of complex numbers. Commonly the numbers are called scalars. Then, a function f is &#x27;linear&#x27; provided for scalars a and b and vectors x and y we have<p>f(ax + by) = af(x) + bf(y)<p>The role, utility? It&#x27;s an enormous, powerful simplification and, in particular, is crucial to systems (high school style) &#x27;systems of linear equations&#x27;, linearity, essentially &#x27;super position&#x27;, in quantum mechanics, and linear operators, as in the classic Dunford and Schwarz, e.g., as in the results of S. Banach. In calculus, differentiation and integration are both linear operators.<p>And, in particular, linearity is crucial in both linear programming and integer linear programming. Local linear approximations are crucial in non-linear optimization, e.g., the Kuhn-Tucker conditions and their associated constraint qualifications.<p>Continuity is also a biggie, e.g., for a function to be continuous on a compact set, e.g., [0,1], means it is also uniformly continuous, bounded, and achieves its greatest lower bound and least upper bound. Continuity, compactness, and uniform continuity are the standard assumptions that guarantee that the Riemann integral of freshman calculus exists.<p>Maybe what was meant was usually when we mention linear programming we have, say, find x to solve Ax = b, x &gt;= 0 where x, where for positive integer n, is n x 1 and, thus, for the set of real numbers R, in the set R^n. Here the A is a matrix, say, for some positive integer m, m x n. Then from the beginnings of the start of matrix theory, for real a and b and n x 1 y we have<p>A(ax + by) = aAx + bAy<p>which says that A is a linear function (operator, transformation, etc.). That&#x27;s the &#x27;linearity&#x27; in linear programming. And it holds in linear integer programming where we ask that some or all of the components of x be integers.
评论 #16236248 未加载
sevensor超过 7 年前
Adding to my other comment, my biggest dissatisfaction with this article is that all it did was show the quite excessively verbose problem setup, without actually showing an algorithm for integer linear programming. An interesting post would have explained how to <i>implement</i> branch and bound in Kotlin, not how to call somebody else&#x27;s library. Needless to say, I&#x27;m not sold on Kotlin from reading this.
评论 #16236482 未加载
评论 #16236878 未加载
cschmidt超过 7 年前
If anyone is interested in solving LP&#x27;s, I&#x27;d suggest taking a look at the JuMP library in Julia. It has a lovely interface for specifying math programming problems.<p><a href="http:&#x2F;&#x2F;www.juliaopt.org&#x2F;JuMP.jl&#x2F;0.17&#x2F;index.html" rel="nofollow">http:&#x2F;&#x2F;www.juliaopt.org&#x2F;JuMP.jl&#x2F;0.17&#x2F;index.html</a>
zmmmmm超过 7 年前
Without wishing to disparage the article at all (I really love this kind of article, including this specific one) ...<p>I feel like Kotlin is almost exactly the wrong language in this space. You either go all the way to a more powerfully typed language where Scala has grabbed mindshare, or you go fully towards dynamic languages like Python or (my favorite, even though it has almost no mindshare in this space), Groovy. It really feels like all Kotlin did here was add verbosity and cloud the actual question being answered with more syntax.
评论 #16244950 未加载
bitL超过 7 年前
Not sure why Kotlin would be picking this fight - Python and to some extent R already dominate in data science with a little bit of Scala added in Spark - where does author see an opening for Kotlin? For high performance libraries nobody would pick Python or any JVM-based language either, and that&#x27;s what most of the wrappers end up calling anyway (C++, CUDA, Fortran, OpenCL).
评论 #16236500 未加载
评论 #16236917 未加载
评论 #16236612 未加载
评论 #16236388 未加载
评论 #16236550 未加载
评论 #16237973 未加载
aisofteng超过 7 年前
&gt;Linear programming (also called linear optimization) is an applied field of mathematics often used in operations research and planning. It attempts to find an optimal solution to a planning problem when a set of business constraints exist.<p>No, linear programming is an applied field of mathematics that attempts to find an optimal solution to a goal within a system which is under some sort of constraint(s). Whether those constraints are business constraints is irrelevant; the theory exists outside of any particular application.
stuaxo超过 7 年前
I kind of glazed over when I saw all the algebraic notation. I&#x27;m sure there&#x27;s a simple concept buried in here somewhere.
RacerRex9727超过 7 年前
Part II of this article series does a real-world application.<p><a href="http:&#x2F;&#x2F;tomstechnicalblog.blogspot.com&#x2F;2018&#x2F;01&#x2F;kotlin-for-linear-programming-part-ii.html" rel="nofollow">http:&#x2F;&#x2F;tomstechnicalblog.blogspot.com&#x2F;2018&#x2F;01&#x2F;kotlin-for-lin...</a>
santialbo超过 7 年前
Just adding that there are tricks that allow adding (apparently) non linear conditions to the problem such as variables that activate or not based on other conditions or even if-then-else statements.<p>Without these tricks the technique is pretty limited at solving real world problems.
tw1010超过 7 年前
Good article, but man, no love was given to the math typesetting.