Hi Luca,

> The problem is as follows:
> 
> minimize { sum[from i=1 to 96] of {c1*x1(i)+c2*x2(i)+c3*x3(i)} } 
> with this constraints:
> x1(i)+x2(i)+x3(i)=c4(i)
> x1(i)+x3(i)=c5
> x1>=5 
> 0<=x2<=1 binary 
> 0<=x3<=1 binary
> 
> where x1, x2, x3 and c4 are vectors of 96 elements. c1,c2,c3,c5 are
> contants.
> 
> someone could write the corresponding model?
> I am using the language c and visual studio as a compiler.

Did you take a look at the brief example [1]? If you are having problem
with the C API maybe
https://github.com/r-gaia-cs/glpk_bindings/blob/master/c/assign.c you
help you.

If you need only to solve the problem and know the solution it will be
easy if you use the gmpl [2]. Take a look at the attached.

Raniere

[1] GNU Linear Programming Kit Reference Manual, Andrew Makhorin. Pag. 14.
[2] Modeling Language GNU MathProg Language Reference, Andrew Makhorin.
set N := 1..96;

param c1;
param c2;
param c3;
param c4{i in N};
param c5;

var x1{i in N}, >= 5;
var x2{i in N}, binary;
var x3{i in N}, binary;

s.t. f{i in N}: x1[i] + x2[i] + x3[i] = c4[i];
s.t. s{i in N}: x1[i] + x3[i] = c5;

minimize obj: sum{i in N} c1 * x1[i] + c2 * x2[i] + c3 * x3[i];
_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to