无法在glpk模型中找出表达式中的语法错误

时间:2018-12-01 03:57:06

标签: syntax-error glpk

我对glpk很陌生。我有以下型号

  #include <iostream>
  #include <csignal>
  #include <unistd.h>
  using namespace std;

  class Crap {
    public:
    Crap() {};
    ~Crap() {printf("destructor called\n");} 
  };

  Crap* p;
  static volatile sig_atomic_t got_signal = 0;

  void signalHandler( int signum ) {
     // AVOID REENTRANCY !!!!
     got_signal = 1;
  }

  int main () {
     signal(SIGINT, signalHandler);  

     // ON HEAP
     p = new Crap;


     while(1) {
        cout << "PLEASE GIVE ME A SIGINT SIGNAL" << endl;
        if(got_signal == 1){
            delete p; // DELETE OBJECT ON HEAP AND CALL DESTRUCTOR 
            exit(0);
        }
        sleep(1);
     }

     return 0;
  }

我收到以下错误:

set MES;
set MAYORISTA;

param z{m in MES}, binary;
param Ck{m in MES};
param v{i in MAYORISTA, m in MES}, binary;
param Std{m in MES}>= 0;
param St{i in MAYORISTA, m in MES}>= 0;
param D{i in MAYORISTA, m in MES};
param Cfd;
param Cfm;
param Pd;
param P{i in MAYORISTA};
param Cad; 
param Ca {i in MAYORISTA};

var y{m in MES}>= 0;
var x{i in MAYORISTA, m in MES}>= 0;
minimize cost: sum{m in MES} y[m] * Pd + Cfd * sum{m in MES} z[m] + sum{m in MES} Ck[m] + sum{m in MES} (sum{i in MAYORISTA} x[i,m] * P[i] ) + Cfm * sum{i in MAYORISTA, m in MES} v[i,m] + sum{i in MAYORISTA} Ca [i] * ( sum{m in MES} St[i,m]) + sum{m in MES} (Std[m] - sum{i in MAYORISTA} * x[i,m]);

s.t. stock_dini{m in MES: m=1}: Std[m] = 0; 
s.t. stock_d{m in MES: m>1}: Std[m] = Std[m-1] + y[m] - (sum{i in MAYORISTA} x[i,m]);
s.t. stock_mini{i in MAYORISTA, m in MES: m=1}: St[i,m] = 0 ;
s.t. stock_m{i in MAYORISTA, m in MES: m>1}: St[i,m] = St[i,m-1] + x[i,m] - D[i,m];
s.t. costofijo_d {m in MES: z[m]=1}: y[m] > 0;
s.t. costofijo_m {i in MAYORISTA, m in MES: v[i,m]}: x[i,m] > 0;
s.t. entregas1{m in MES: w[m]=250}: prod{i in MAYORISTA} x[i,m] > 0 ;
s.t. entregas1{m in MES: w[m]=0}: sum{i in MAYORISTA} x[i,m] = 0 ;
s.t. entregas1{m in MES: w[m]=200}: sum{i in MAYORISTA} x[i,m] > prod{i in MAYORISTA} x[i,m];

data;
set MES := 1 2 3 4 5 6 7 8 9 10 11 12;
set MAYORISTA := A B;

param Cfd := 5000;
param Cfm := 1000;
param Pd := 5;
param Cad := 1;
param P:    A      B    :=
            13     10 ;

param Ca:    A      B    :=
             3      2 ;

end;

我不知道这是怎么回事。我不确定这是语法错误还是从参数定义派生而来的错误。 错误出在股票变量上,除此之外我真的不知道该如何定义它们。 我迷路了,在这里我将不胜感激

0 个答案:

没有答案