help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] fixing the value of a variable


From: Andrew Makhorin
Subject: Re: [Help-glpk] fixing the value of a variable
Date: Sat, 6 Jan 2007 10:24:16 +0300

> I have a linear program which works fine with variables and fixed
> parameters. But I want to fix values of some variables for testing 
> purposes. 
> More specifically, I have a set of variables and constraints in my 
> model file: 
> set x; 
> var vars{x}; 
> subject to constraint1{i in x}: 
>    vars[i] ... ; 
> And data file defines the members of the set. 
> set x := x1 x2; 
> This works fine, but I want to assign a constant to vars[x1] and see the 
> output of the program and its effect on the other variables. I cannot 
> put constraints in my model file using names x1 or x2 because they are 
> not defined yet, and I cannot define the value of vars[x1] in data file 
> because set x is formed of variables. Does anyone know a way of doing 
> this without changing variables to parameters? 

The following way is not elegant, but it must work in glpsol 4.13:

var vars{j in x}, >= if ... then -Infinity else c[j],
                  <= if ... then +Infinity else c[j];







reply via email to

[Prev in Thread] Current Thread [Next in Thread]