Hello Yi,
In your optimization problem quadratic terms my(k) * my(k) appear. GLPK
can only solve linear problems.
Hence if you want to use GLPK you will have to change the formulation a
bit. Below I give a description in GMPL which you could use with the
standalone solver glpsol:
param H; # replaces H_p - 1
set K := {0..H};
set I := {0..10};
param c{K};
param t{I}; # t replaces the term (T_in[K] - T_ref)^ 2
var x[K,I], binary;
minimize obj :
sum{k in K, i in I} c[k] * i * x[k,i] + sum{k in K, i in I} x[k,i] *
t[i];
s.t. c1{k in K}
sum{i in I} x[k,i] = 1;
solve;
printf {k in K} "my[%d] = %d\n", k, sum{i in I} i * x[k,i];
end;
GLPK for Java comes with a file examples/Mip.java showing how to create
a MIP problem in Java.
For details of the methods and constants used consult doc/glpk.pdf of
the GLPK source distribution.
Best regards
Xypron
Zong, Yi wrote:
Hi!
I have an objective function described as following:
The optimized variables are , which are integer between [0, 10],
is a lineal function of an
, and
Can I use GLPK for JAVA to get the optimized results? If it is
possible, could you give me an example?
_______________________________________________
Help-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-glpk