2013-05-11 2 views
1

와 비교 지수 (세트의 요소)에 의해 유발 나는 또 다른 버그 아래 볼 수 있습니다 :AMPL의 ecopy() 오류 변수

Error at _cmdno 8 executing "solve" command 
(file ./script/runConfiguration.run, line 5, offset 127): 
error processing constraint c1a[2,'o1',1]: 
unexpected type 0x14205 in ecopy() 

내가 문제가 인덱스와 비교를 일으키는 추측 (세트의 요소) c1a 제약 조건의 변수. 이 버그를 피할 수 있습니까?

나의 새로운 AMPL 모델 :

#Data file for 'CDN allocation copies' problem simple example 

#indices 
set K := 2 3 4;    #index of nodes with group of clients 
set N := 1 2 3 4;    #nodes 
set E := 1_2 2_3 2_4;   #edges 
set O := o1;     #objects 

#parameters 
param d (tr):     #demands for object o 
     2  3  4 := 
o1  0  512  512; 
#opt= 63 + 75 = 138 

param t (tr):     #destination nodes 
     2  3  4 := 
o1  2  3  4; 

param r (tr):     #1 if node n is ancestor of node k, 0 otherwise 
     1  2  3  4 := 
2  1  0  0  0  
3  1  1  0  0 
4  1  1  0  0; 

param a (tr):     #1 if edge begins in vertex, 0 otherwise 
     1  2  3  4 := 
1_2  1  0  0  0 
2_3  0  1  0  0 
2_4  0  1  0  0; 

param b (tr):     #1 if edge ends in vertex, 0 otherwise 
     1  2  3  4 := 
1_2  0  1  0  0 
2_3  0  0  1  0 
2_4  0  0  0  1; 

param c :=  #cost of using an edge 
1_2  3 
2_3  1 
2_4  1; 

param Hmax := 1; #available capacity for allocation object in proxy servers 

이 데이터 파일은 다음과 토폴로지와 4 개 노드와 네트워크를 설명합니다 :

 1 
    | 
    2 
    /\ 
    3 4 

#sets 
#------------------------------------------------------------------------------------- 
set K;    #index of nodes with group of clients 
set N;    #nodes 
set E;    #edges 
set O;    #objects 

#parameters 
#------------------------------------------------------------------------------------- 
param d {K,O};  #demands for object o 
param t {K,O} symbolic;  #destination nodes 
param r {N,K} binary;  #1 if node n is ancestor of node k, 0 otherwise 

param a {N,E} binary;  #1 if edge begins in vertex, 0 otherwise 
param b {N,E} binary;  #1 if edge ends in vertex, 0 otherwise 

param c {E};  #cost of using an edge 
param Hmax;   #available capacity for allocation object in proxy servers 

#variables 
#------------------------------------------------------------------------------------- 
var f {N,O} binary;   #1 if object saved at node k, 0 otherwise 
var x {E,K,O};    #value of the demand realised over edge for object 
var s {K,O} symbolic in N;    #source nodes 

#goal function 
#------------------------------------------------------------------------------------- 
#The function minimizes cost of routing 
#By saving copies at CDN proxies we minimizing all traffic from all demands 
#with all objects 
minimize goal: 
    sum{e in E} 
    sum{k in K} 
    sum{o in O} 
     (x[e,k,o]*c[e]); 

#constraints 
#------------------------------------------------------------------------------------- 
subject to c1a {k in K, o in O, n in N: n!=t[k,o]}: 
(s[k,o]==n) 
==> 
     sum{e in E} 
      (a[n,e]*x[e,k,o]) - 
     sum{e in E} 
      (b[n,e]*x[e,k,o]) = 
           d[k,o]*(1-f[k,o]); 

subject to c1b {k in K, o in O, n in N: n!=t[k,o]}: 
(s[k,o]!=n) 
    ==> 
     sum{e in E} 
      (a[n,e]*x[e,k,o]) - 
     sum{e in E} 
      (b[n,e]*x[e,k,o]) = 
           0; 

subject to c1c {k in K, o in O, n in N: n==t[k,o]}: 
sum{e in E} 
    (a[n,e]*x[e,k,o]) - 
sum{e in E} 
    (b[n,e]*x[e,k,o]) = 
          -d[k,o]*(1-f[k,o]); 

subject to c2: 
sum{k in K} 
sum{o in O} 
    f[k,o] <= Hmax; 

subject to c3 {k in K, o in O}: 
sum{n in N} 
    r[n,k]*f[n,o] <= 2; 

subject to c4 {o in O}: 
    f[1,o]=1; 

subject to c5 {k in K, o in O}: 
    s[k,o]= 
     2-sum{n in N}(r[n,k]*f[n,o]) 
     +(sum{n in N} 
       (r[n,k]*f[n,o])-1) 
     *(sum{i in K}(r[i,k]*f[i,o]*i)); 

subject to c0 {e in E, k in K, o in O}: 
    x[e,k,o]>=0; 

여기 아주 간단한 데이터입니다 최상의 솔루션은 노드 2의 컨텐트 만 저장하는 것입니다. 객체 함수 = 1024 및 f_2, o1 = 1.

Whis 모델 나는 다른에 내 게시물 설명 Strorage 용량 할당 문제, 해결하려고 : CPLEX의 해결에 대한 적용은 다음과 같이 재정의 CDN SCAP 문제에 대한 내 친구를 찾을 솔루션 Bug when solving CDN allocation rule

답변

0

I를, :

#Model for 'CDN allocation copies' problem 

#sets 
#------------------------------------------------------------------------------------- 
set K;    #index of nodes with group of clients 
set N;    #nodes 
set E;    #edges 
set O;    #objects 

#parameters 
#------------------------------------------------------------------------------------- 
param d {K,O};  #demands for object o 
param t {K,O} symbolic;  #destination nodes 
param r {N,K} binary;  #1 if node n is ancestor of node k, 0 otherwise 

param a {N,E} binary;  #1 if edge begins in vertex, 0 otherwise 
param b {N,E} binary;  #1 if edge ends in vertex, 0 otherwise 

param c {E};  #cost of using an edge 
param Hmax;   #available capacity for allocation object in proxy servers 

#variables 
#------------------------------------------------------------------------------------- 
var f {N,O} binary;   #1 if object saved at node k, 0 otherwise 
var x {E,K,O} >= 0;    #value of the demand realised over edge for object 
var s {K,O} binary;    #source nodes 

#goal function 
#------------------------------------------------------------------------------------- 
#The function minimizes cost of routing 
#By saving copies at CDN proxies we minimizing all traffic from all demands 
#with all objects 
minimize goal: 
    sum{e in E} 
    sum{k in K} 
    sum{o in O} 
     (x[e,k,o]*c[e]); 

#constraints 
#------------------------------------------------------------------------------------- 

subject to c1a {k in K, o in O, n in N: n==1}: 
s[k,o] = 0 
    ==>  
     sum{e in E} 
      (a[n,e]*x[e,k,o]) - 
     sum{e in E} 
      (b[n,e]*x[e,k,o]) - 
           d[k,o]*(1-f[k,o]) = 0 
else 
     sum{e in E} 
      (a[n,e]*x[e,k,o]) - 
     sum{e in E} 
      (b[n,e]*x[e,k,o]) = 
           0; 


subject to c1b1 {k in K, o in O, n in N: n!=t[k,o] and n!=1}:  
     sum{e in E} 
      (a[n,e]*x[e,k,o]) - 
     sum{e in E} 
      (b[n,e]*x[e,k,o]) - 
           r[n,k]*d[k,o]*(1-f[k,o]) <= 0; 

subject to c1b2 {k in K, o in O, n in N: n!=t[k,o] and n!=1}: 
     sum{e in E} 
      (a[n,e]*x[e,k,o]) - 
     sum{e in E} 
      (b[n,e]*x[e,k,o]) - 
           r[n,k]*d[k,o]*s[k,o] <= 0; 

subject to c1b3 {k in K, o in O, n in N: n!=t[k,o] and n!=1}:  
     sum{e in E} 
      (a[n,e]*x[e,k,o]) - 
     sum{e in E} 
      (b[n,e]*x[e,k,o]) - 
           r[n,k]*d[k,o]*f[n,o] <= 0; 

subject to c1c {k in K, o in O, n in N: n==t[k,o]}: 
sum{e in E} 
    (a[n,e]*x[e,k,o]) - 
sum{e in E} 
    (b[n,e]*x[e,k,o]) = 
          -d[k,o]*(1-f[k,o]); 

subject to c2: 
sum{k in K} 
sum{o in O} 
    f[k,o] <= Hmax; 

subject to c3 {k in K, o in O}: 
sum{n in N} 
    r[n,k]*f[n,o] <= 2; 

subject to c4 {o in O}: 
    f[1,o]=1; 

subject to c5 {k in K, o in O}: 
    s[k,o]=sum{n in N}(r[n,k]*f[n,o])-1;