[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Printing constraint for report using printf and for
From: |
Noli Sicad |
Subject: |
Re: [Help-glpk] Printing constraint for report using printf and for |
Date: |
Tue, 6 Mar 2012 09:21:35 +1100 |
Hi Xypron,
OK. I removed the extra %.2f in prinf statement, I still go this error.
ForestValue_r2_0.mod:720: 0-ary slice not allowed
Context: ..., spec , prd , orig , dest , ( sum { ( dmd , spec , prd ) in
MathProg model processing error
>Exit code: 1 Time: 0.420
I got a similar printf statement with (sum...) that works (below).
#######################
for{t in PERIOD} {
printf "%d,%f",t, (sum {(t,i,j) in HARVEST} Y[t,i,j]);
for {p in PRODUCT: Status[p] in COST} printf ",%.2f", (sum{(t,i,j) in
HARVEST} Y[t,i,j]*Yield[p,i,j]);
printf "\n";
}
#######################
Any suggestion what is needed to be rearranged in this statement to
make it working.
################################
for{dmd in DEMAND, t in PERIOD, (dmd,spec,prd) in GRADE_MIX,
(t,spec,prd,orig,dest) in WOODFLOW: dest = DemandDest[dmd]} {
printf "%d,%s,%s,%s,%s,%.2f,%.2f",
t,spec,prd,orig,dest,
(sum {(dmd,spec,prd) in GRADE_MIX, (t,spec,prd,orig,dest) in
WOODFLOW: dest = DemandDest[dmd]} U[t,spec,prd,orig,dest]),
Demand[dmd];
printf "\n";
}
Thanks.
Regards, Noli
On 3/6/12, glpk xypron <address@hidden> wrote:
> Helo Noli,
>
> you have on %2f too many in
>
> printf "%d,%s,%s,%s,%s,%.2f,%.2f,%.2f",
>
> Regards
>
> Xypron
>
> -------- Original-Nachricht --------
>> Datum: Mon, 5 Mar 2012 18:38:12 +1100
>> Betreff: [Help-glpk] Printing constraint for report using printf and for
>
>> Hi,
>>
>> I want to print this constraint (below) as one of my reports i.e. screen
>> output.
>>
>> constraint
>> #############
>> subject to Mill_Demand_Allocation {dmd in DEMAND, t in PERIOD: t >=
>> MinPeriod[dmd] and t <= MaxPeriod[dmd]}:
>>
>> sum {(dmd,spec,prd) in GRADE_MIX, (t,spec,prd,orig,dest) in
>> WOODFLOW: dest = DemandDest[dmd]}
>>
>> U[t,spec,prd,orig,dest] = Demand[dmd];
>> #############
>>
>>
>> This is not working, I need help on this,
>>
>> printf "\n";
>>
>> printf "Log Allocation - Mill Demands \n";
>>
>> printf "Period,Species,Products,Origin,Destination,Demand";
>>
>> printf "\n";
>>
>>
>>
>> for{dmd in DEMAND, t in PERIOD, (dmd,spec,prd) in GRADE_MIX,
>> (t,spec,prd,orig,dest) in WOODFLOW: dest = DemandDest[dmd]} {
>>
>> printf "%d,%s,%s,%s,%s,%.2f,%.2f,%.2f",
>>
>> t,spec,prd,orig,dest,
>>
>> (sum {(dmd,spec,prd) in GRADE_MIX, (t,spec,prd,orig,dest) in
>> WOODFLOW: dest = DemandDest[dmd]} U[t,spec,prd,orig,dest]),
>>
>> Demand[dmd];
>>
>> printf "\n";
>>
>> }
>>
>> Any suggestion how to fix this thing above?
>>
>> Thanks.
>>
>> Noli
>>
>> _______________________________________________
>> Help-glpk mailing list
>> address@hidden
>> https://lists.gnu.org/mailman/listinfo/help-glpk
>
> --
> Follow me at http://twitter.com/#!/xypron
>
> NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!
>
> Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a
>