1

私は最初の GNU MathProg (AMPL) プログラムを作成して、特定の基数、ホスト数、および二分帯域幅に対する HyperX トポロジ (グラフ) の最小スイッチ (頂点) カウント インスタンスを見つけています。すべての方程式は次の論文で説明されているため、これは単純な最初のプログラムです: http://cal.snu.ac.kr/files/2009.sc.hyperx.pdf

仕様とサンプル プログラムを読みましたが、非常に単純な構文エラーで立ち往生しています。次の 2 つの変数が必要です。ネットワークの次元数 L と、長さ L の配列 S (S の各要素は各次元のスイッチの数) です。私の MathProg プログラムでは、これを次のように表現します。

var L >= 1, integer;
var S{1 .. L} >= 2, integer;

ただし、 を実行する$ glpsol --check --math hyperx.modと、次のエラーが発生します。

hyperx.mod:28: operand following .. has invalid type
Context: ...isec ; param radix ; var L >= 1 , integer ; var S { 1 .. L }

この関係を適切に表現する方法を説明できる人がいれば、感謝します。また、参照と追加のヘルプのために、私が書いたプログラム全体を含めています。プログラムには多くの構文エラーがあると思いますが、最初のエラーを修正するまで、残りを見つける方法がありません。

/* 
 * A MathProg linear program to find an optimal HyperX topology of a
 *  given network size, switch radix, and bisection bandwidth.  Optimal
 *  is simplistically defined as minimum switch count network. 
 *
 * A HyperX topology is a multi-dimensional network (graph) where, in
 *  each dimension, the switches are fully connected.  Every switch
 *  (vertex) is a point in an L-dimensional integer lattic.  Each switch
 *  is identified by a multi-index I = (I_1, ..., I_L) where 0 <= I_k <
 *  S_k for each k = 1..L, where S_k is the number of switches in each
 *  dimension.  A switch connects to all others whose multi-index is the
 *  same in all but one coordinate.
 */

/* Network size in number of hosts. */
param hosts;

/* Desired bisection bandwidth. */
param bisec;

/* Maximum switch radix. */
param radix;

/* The number of dimensions in the HyperX. */
var L >= 1, integer;

/* The number of switches in each dimension. */
var S{1 .. L} >= 2, integer;

/* 
 * Relative bandwidth of the dimension, i.e., the number of links in a
 * given dimension. 
 */
var K{1 .. L} >= 1, integer;

/* The number Terminals (hosts) per switch */
var T >= 1, integer;

/* Minimize the total number of switches. */
minimize cost: prod{i in 1..L} S[i];

/* The total number of links must be less than the switch radix. */
s.t. Radix: T + sum{i in 1..L} K[i] * (S[i] - 1) <= radix;

/* There must be enough hosts in the network. */
s.t. Hosts: T * prod{i in 1..L} S[i] >= hosts;

/* There must be enough bandwidth. */
s.t. Bandwidth: min{K[i]*S[i]} / (2 * T) >= bisec;

/* The order of the dimensions doesn't matter, so constrain them */
s.t. SwitchDimen: forall{i in 1..(L-1)} S[i] <= S[i+1];

/* 
 * Bisection bandwidth depends on the smallest S_i * K_i, so we know
 * that the smallest switch count dimension needs the most links.
 */
s.t. LinkDimen: forall{i in 1..(L-1)} K[i] >= K[i+1];

# TODO: I would like to constrain the search such that the number of
# terminals, T, is bounded to T >= (hosts / O), where O is the switch
# count of the smallest switch count topology discovered so far, but I
# don't know how to do this.

/* Data section */
data;

param hosts := 32

param bisec := 0.5

param radix := 64

end;
4

1 に答える 1

0

問題の変数の固定数は、ソルバーおよびAMPL/MathProgを含む代数モデリング言語での一般的な仮定です。したがって、定数式、特にパラメータのみを使用でき、インデックス式では変数を使用できません。考えられる解決策の1つはL、パラメーターを作成し、のさまざまな値について問題を解決しL、最適な客観的値を与えるものを選択することです。これは、単純なAMPLスクリプトで実行できます。

于 2012-05-29T00:05:08.733 に答える