customer-arrangement-optimization's People
customer-arrangement-optimization's Issues
組み合わせ生成関数について
組み合わせ生成関数で、特に何も考えずnCr=nCn-rに従ってr>n/2のときnCn-rに変換してたけど、そうすると得られるイテレータにまで影響が及んでしまう。
たとえば5C4に対応するイテレータが欲しいとなったら
[1,2,3,4],[1,2,3,5][1,2,4,5],[1,3,4,5],[2,3,4,5]
が欲しい、ということになるが、0114現在でのプログラムでは、rをn-rに変換して
[1],[2],[3],[4]
を出力してしまう。
でもかといってnCr=nCn-rの性質を使わないのももったいないので、もしr>n/2となったときには'r=n-rとしてイテレータを作った上で、最後に"n個の数字"から"出力結果に入っている数字"だけを取り出す'という形で作り直したい。(5C4の例なら、一旦[1],[2],[3],[4]をつくったうえで、最後に[1,2,3,4,5]から各数字を抜いた配列を作る
組み合わせ生成関数が引数(特にr)の値が大きくなると動かない
組み合わせはn!/r!(n-r)!で表されることからわかるように、オーダーはほぼ階乗といっていい。たとえば96C26を計算サイトで計算すると、2.052799757E+23とでてくる。組み合わせの単純な数値でさえこの大きさなのだから、そこでイテレータを生成しようとしたらとてつもなく長い時間がかかるのは目に見えている。
ということで、全通りの配置図を検証する方式は現実的に無理。
抽象度を上げてもっと楽に計算できる方法を探したい
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.