Declaration of ordered pairs sets in AMPL -
I have a variable i [i, j, p] where i and j are set sets i specially I have defined variables like
set I; Jets set; Set p; Set the link within (i, j}; Ultimate U {LINKS, P} In the .mod file, I have written in my .dat:
< Code> Set I: = 1 2 3 4; Set J: = Factory1 Factory2 Factory3 Factory4 Set Link: = (1, Factory 1) (2, Factory 1) (3, Factory 2) (4, Factory 2); Set P : = Prod1 prod2 prod3; Ultimate U default 0: = [1, Factory 1, *] prod1 0.5251 prod2 0.3738 [2, Factory 1, *] prod1 0.5052 prod2 0.3311 [3, Factory 2, *] prod1 0.5555 prod3 0.6666 [4] , Factory 2, *] prod3 0.6156 prod4 0.3353;
But this gives me errors as to how u is declared. I tried when trying to follow the document
Ultimate link: U: = [1, Factory 1, *] prod1 0.5251 prod2 0.3738 [2, Factory 1, *] prod1 0.5052 prod2 0.3311 [3, Factory 2, *] prod1 0.5555 prod3 0.6666 [4, Factory 2, *] prod3 0.6156 prod4 0.3353; but also gives error
I hope someone can give me some help
There are two problems with your code:
and
set j: = factory factory 1 factory 2 factory 3 factory 4 innot available Th semicolon
Use prod4, which is not a member of theP.Otherwise it looks right.
Comments
Post a Comment