Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

subejct to is not working after another subject to

17 views
Skip to first unread message

Anwar Muheidat

unread,
Nov 4, 2024, 7:45:00 PM11/4/24
to AMPL Modeling Language
Hey guys, 

currently Im working on an task which needs multiple subject to commands.

this is my mod: 
param J; # Anzahl der Produkte

param T; # Anzahl der Perioden

set j := 1..J;

set t := 1..T;

set j0:=0;

param d{j,t}; # Nachfrage nach Produkt j in Periode t

param I0; # Anfangslagerbestand des Produktes j

param s{j}; # Rüstkostensatz des Produktes j

param h{j}; # Lagerhaltungskostensatz des Produktes j

param C{t}; # Verfügbare Kapazität in Periode t

param p{j}; # Produktionskoeffizient des Produktes j

var q{j,t} >= 0; # Produktionsmenge von j in Periode t

var x{j,t} binary; # 1 wenn in Periode t für j gerüstet wird, sonst 0

var I{j,t} >= 0; # Lagerbestand von Produkt j am Ende der Periode t

minimize costs: sum {a in J, b in T} (s[a] * x[a,b] + h[a] * I[a,b]);

subject to Lager {a in J, b in T}: (if a = 1 then 0 else I[a-1,b]) + q[a,b] - d[a,b] = I[a,b];

subject to Kapazität {a in J, b in T}: p[a] * q[a,b] <= C[a] * x[a,b];

subject to Lager seems to be alright because first i couldnt do another subejct to command after it, but when i fixed it, it turned out to be right, because then another subejct to command was possible.
But now it seems that something is wrong with subject to Kapazität, because i cant put in another subject to command after that one, which shows me that something is incorrect but so far I couldnt figure out the mistake.

Help ASAP pls :)

Anwar

AMPL Google Group

unread,
Nov 5, 2024, 3:18:36 PM11/5/24
to AMPL Modeling Language
Your question has been moved to our new user forum at discuss.ampl.com, and a response has been posted there. To see the response, use this link:

https://discuss.ampl.com/t/ampl-25061-subejct-to-is-not-working-after-another-subject-to/1971/2

To reply, click the red "Reply" button that follows the response. (Do not send an email reply to this message.)


--
Robert Fourer

We're switching to a new, enhanced user forum.
Join it now at discuss.ampl.com.
{#HS:2753901612-130005#}
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ampl/09085bf2-bef8-4d12-8a30-bcf621b5b72an%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages