- A matrix with with entries A0i,j≥0.
- Row- and column-totals ri and cj.
Matrix Balancing Problem |
---|
mindist(A,A0)∑iAi,j=cj∀j∑jAi,j=ri∀iAi,j=0∀i,j|A0i,j=0Ai,j≥0 |
I am a full-time consultant and provide services related to the design, implementation and deployment of mathematical programming, optimization and data-science applications. I also teach courses and workshops. Usually I cannot blog about projects I am doing, but there are many technical notes I'd like to share. Not in the least so I have an easy way to search and find them again myself. You can reach me at erwin@amsterdamoptimization.com.
Matrix Balancing Problem |
---|
mindist(A,A0)∑iAi,j=cj∀j∑jAi,j=ri∀iAi,j=0∀i,j|A0i,j=0Ai,j≥0 |
In [1] an optimization model is proposed for the following problem:
Using a list of 5-letter words, try to find a set of 5 words such that each letter is used at most once.
The list of 5-letter words is from the wordle [2] game. Words with duplicate letters are removed. A partial list is:
---- 1035 SET w words: large list of 5-letter words abdom, abend, abets, abhor, abide, abies, abyes, abilo, abime, abysm, abled, abler, ables ablet, ablow, abmho, abner, abnet, abode, abody, abohm, aboil, abord, abort, abote, about above, abret, abrim, abrin, abris, abrus, absey, absit, abstr, abune, abuse, abush, abuts acedy, acerb, ached, achen, acher, aches, achor, acidy, acids, acier, acies, acyls, acing ackey, acker, aclys, acmes, acned, acnes, acoin, acold, acone, acorn, acost, acoup, acred acres, acrid, acryl, acron, acrux, acted, actin, acton, actor, actos, actus, acute, adcon
The total number of 5-letter words in this list is: 10,175.
Primal formulation |
---|
min∑i,jcosti,j⋅xi,j∑jxi,j≤supplyi⊥ui≤0∀i∑ixi,j≥demandj⊥vj≥0∀jxi,j≥0 |
The problem from [1], slightly generalized, is easy to describe:
Given an n vector vi with data, select k<n elements that are closest to each other.
Of course, we can state the problem as a formal optimization model:
Optimization Model |
---|
minU−Lδi=1⇒vi∈[L,U]∑iδi=kδi∈{0,1} |
In [1] I was trying out different formulations of a large, sparse (but very easy) transportation model using different modeling tools and solvers. The conclusion was:
Don't overinterpret these numbers: this is a single model, which may not be at all representable for your models. Let's see how CVXPY[2] and CVXR[3] are doing. To recap we want to solve a large (but easy) transportation model:
Dense Transportation Model |
---|
min∑i,jci,j⋅xi,j∑jxi,j≤ai∀i∑ixi,j≥bj∀jxi,j≥0 |
The additional wrinkle is that only a small fraction of the links i→j exist.
There are (at least) three ways to model this:
Transportation Model in Matrix Notation |
---|
mintr(CTX)Xe≤aXte≥bX≥0 |
Newer versions of Windows come with a very useful tool to download files: curl.exe.
The standard help is:
C:\Users\erwin>where curl C:\Windows\System32\curl.exe C:\Users\erwin>curl --help Usage: curl [options...]
<url> -d, --data <data> HTTP POST data -f, --fail Fail fast with no output on
HTTP errors -h, --help <category> Get help for commands -i, --include Include protocol response
headers in the output -o, --output <file> Write to file instead of stdout -O, --remote-name Write output to a file named as the
remote file -s, --silent Silent mode -T, --upload-file <file> Transfer local FILE to destination -u, --user <user:password> Server user
and password -A, --user-agent <name> Send User-Agent <name> to server -v, --verbose Make the operation more
talkative -V, --version Show version number and quit
This is not the full help, this
menu is stripped into categories. Use "--help category"
to get an overview of all categories. For all options use the manual
or "--help all".
C:\Users\erwin> |
MIP model with semi-continuous variables |
---|
max∑ixi⋅ratei∑ixi≤budgetxi∈{0}∪[Li,Ui] |