New to GAMS - Can't find the issue with Error 149

Problems with syntax of GAMS
Post Reply
ncanderson91
User
User
Posts: 2
Joined: 3 years ago

New to GAMS - Can't find the issue with Error 149

Post by ncanderson91 »

I realize there are pages and pages on error 149 but I've done my due diligence and looked through several trying to find out why I keep getting this error.

This is a basic assignment problem.

I am getting Error 149 when I try to define tasks. I'm trying to tell GAMS to make it so the sum the rows(r) and make them equal to 1 for each column(c).

Code: Select all

Set r row labels
    c column labels;
    
Parameter p(r,c);

$onecho > tasks.txt
set=r  rng=Sheet1!a2        rdim=1
set=c  rng=Sheet1!b1            cdim=1
par=p  rng=Sheet1!a1 rdim=1 cdim=1
$offecho

$call GDXXRW indata.xlsx trace=5 @tasks.txt 
$GDXIN indata.gdx
$LOAD  r c
$LOAD p
$GDXIN


Display r, c, p;
$call XLSDUMP indata.xlsx mydump.gdx
Binary Variable x person assigned to task;
Variable
    z total minutes to complete all tasks;
    
Equations
    total objective function
    tasks all tasks assigned;
    
total.. z =e= sum((r,c), x(r,c)*p(r,c));
tasks.. sum(r, x(r,c)) =e= 1 ;


Model assign /all/ ;
Solve assign using lp minimizing z;

display x.l;
Any help would be appreciated. I am very new to GAMS but I've watched several videos and searched this forum and google for an answer that I have yet to find.
abhosekar
Moderator
Moderator
Posts: 295
Joined: 3 years ago

Re: New to GAMS - Can't find the issue with Error 149

Post by abhosekar »

As you said, you want tasks constraint to hold for 'each column' c.

You should define the constraint as tasks(c) and not tasks.

In the current form, GAMS does not know which c you are talking about when you write x(r,c).

- Atharv
ncanderson91
User
User
Posts: 2
Joined: 3 years ago

Re: New to GAMS - Can't find the issue with Error 149

Post by ncanderson91 »

Thank you! I actually figured it out right after I submitted the post but it was under moderation and I couldn't delete the posting. Appreciate the helpfulness from the community!
Post Reply