Hi Raniere.

How do you translate this

############
var x1, >=0, <=40;
var x2;
var x3;
var x4, >=2, <=3;
#############

into (MathProg equation format)


var x {n in NUMBER};


Thanks.

Noli



On 11/7/12, Noli Sicad <nsi...@gmail.com> wrote:
> Hi Raniere,
>
> OK. Thanks.
>
> However, I need a MathProg formulation that uses MathProg equations.
>
> For example.
>
> #################
>
> param number := 4;
>
> set NUMBER := {1..number};
>
> var x {n in NUMBER};
>
> Maximise
> .
> .
> .
> ##################
>
> I need to know how to declare integer in variable in MathProg in the
> format above.
>
> This question is related to the MIP problem that I posted earlier
> (i.e. MIP Harvest Scheduling).
>
> Thanks.
>
> Regards, Noli
>
>
> On 11/7/12, Raniere Gaia Silva <r.gaia...@gmail.com> wrote:
>> Hi Noli,
>> translate the code you request to MathProg:
>>
>> ###
>>
>> var x1, >=0, <=40;
>> var x2;
>> var x3;
>> var x4, >=2, <=3;
>>
>> s.t. c1: - x1 + x2 + x3 + 10 * x4, <= 20;
>> s.t. c2: x1 - 3 * x2 + x3, <= 30;
>> s.t. c3: x2 - 3.5 * x4, == 0;
>>
>> maximize obj: x1 + 2 * x2 + 3 * x3 + x4;
>>
>> end;
>>
>> ###
>>
>> E a saĆ­da ao resolver com o glpsol:
>>
>> ###
>>
>> $ glpsol -m foo.mod
>> GLPSOL: GLPK LP/MIP Solver, v4.47
>> Parameter(s) specified in the command line:
>>  -m foo.mod
>> Reading model section from foo.mod...
>> 12 lines were read
>> Generating c1...
>> Generating c2...
>> Generating c3...
>> Generating obj...
>> Model has been successfully generated
>> GLPK Simplex Optimizer, v4.47
>> 4 rows, 4 columns, 13 non-zeros
>> Preprocessing...
>> 3 rows, 4 columns, 9 non-zeros
>> Scaling...
>>  A: min|aij| =  1.000e+00  max|aij| =  1.000e+01  ratio =  1.000e+01
>> Problem data seem to be well scaled
>> Constructing initial basis...
>> Size of triangular part = 3
>>       0: obj =   0.000000000e+00  infeas =  2.000e+00 (0)
>> *     2: obj =   2.300000000e+01  infeas =  0.000e+00 (0)
>> *     4: obj =   1.252083333e+02  infeas =  0.000e+00 (0)
>> OPTIMAL SOLUTION FOUND
>> Time used:   0.0 secs
>> Memory used: 0.1 Mb (115425 bytes)
>>
>> ###
>>
>> More information you can find in the file $GLPK_SRC/doc/gmpl.pdf.
>>
>> Raniere
>>
>

_______________________________________________
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to