help-glpk
[Top][All Lists]

## Re: [Fwd: What is this format?]

 From: Alexandre Garreau Subject: Re: [Fwd: What is this format?] Date: Tue, 26 Jan 2021 16:34:43 +0100

Le mardi 26 janvier 2021, 13:33:39 CET Domingo Alvarez Duarte a écrit :
> It seems to be a cplex OPL format.
>
> After manually convert it to GMPL (see bellow)

Oh… but is this format planned to be supported one day? are there
automated convertors or other free software that understand it?

> Manually converting to GMPL could be something like this:
>
> ====
>
> param N integer;
> param D;
> param dureeJournee integer;
> param planchesJournee integer;
> set objets := {1..N};
> param planches{objets} integer;
> param duree{i in objets} := planches[i] / D;
> param profit{objets};
>
> var aFabriquer{objets} , >= 1, integer;
>
> maximize result: sum{o in objets} profit[o]*aFabriquer[o];
>
> s.t. cstTemps: sum{o in objets} duree[o]*aFabriquer[o] <= dureeJournee;
> cstPlanches: sum{o in objets} planches[o]*aFabriquer[o] <=
> planchesJournee; # une contrainte en plus: chaque objet est au moins
> fabriqu´e en 1 exemplaire
> #auMoins1: forall(o in objets) aFabriquer[o] >= 1;
>
> solve;
>
> #display duree, planches, profit;
> printf "Il faut fabriquer :\n";
> printf{i in objets} "%f objet(s) %d\n", aFabriquer[i], i;
> printf "Il faut fabriquer :%f\n", result;
>
> data;
>
> param N := 5;
> param D := 3.4;
> param dureeJournee := 8;
> param planchesJournee := 40;
> param planches := 1 4, 2 5, 3 8, 4 3, 5 7;
> param profit := 1 12.6, 2 45.0, 3 8.0, 4 76.0, 5 7.5;
>
> end;
>
> ====

I see, it’s pretty different, and I guess I will have to use that for
exams/tests, so well maybe I’ll just leave that