I tried to model it like below:
Can somebody please help me where my mistake is?
Thanks a lot in advance!!
BR
Janina
I would also need some help how to build the objective function.
I tried like this but it does not seem correct:
I know that I have to define h in C_h[h] somehow?
C_max is supposed to be the maximum out of the complecion times of products h =1..H
I appreciate any help!
Thanks
Janina
On Tue, May 11, 2021 at 3:41 PM UTC, AMPL Modeling Language <am...@googlegroups.com> wrote:
Dear Robert,
thank you for your help!
Does it work the same way for constraint (17)? So it would be :
subj to C17 {l in 1..L}: sum{l in 1..L, k in 1..K_l[l], i in N} x_oik[i,k] = K_l[l];
Thanks in advance for help
BR
Janina
On Sun, May 9, 2021 at 6:44 PM UTC, AMPL Google Group <am...@googlegroups.com> wrote:
The indexing expression has two errors. First, l in 1..l should be l in 1..L. Second, you need to define l before you write k in 1..K_l[l]. Thus you should have
{l in 1..L, k in 1..K_l[l]}
You can use the AMPL command "expand XYC;" to see the constraints that AMPL is generating and check whether they are what you want.
--
Robert Fourer
am...@googlegroups.com
[image: Bildschirmfoto 2021-05-12 um 13.29.52.png]
[image: Bildschirmfoto 2021-05-12 um 13.29.43.png]
maybe my mod and data file make it more clear
Janina Sand schrieb am Mittwoch, 12. Mai 2021 um 13:28:14 UTC+2:
On Wed, May 12, 2021 at 11:28 AM UTC, AMPL Modeling Language <am...@googlegroups.com> wrote:
Dear Robert,
thank you so much for your help!
now I tried to solve my model but it is say for the data file that e.g H is not a parameter:
and also when I try to solve it it shows:
I do not know where my mistake is. When I check the mod file for mistakes by AMPL it is not showing me any error.
BR
Janina
On Wed, May 12, 2021 at 2:17 AM UTC, AMPL Google Group <am...@googlegroups.com> wrote:
If you index constraint C17 over {l in 1..L}, you can't also sum over {l in 1..L} in the constraint's expression. Maybe you just want to leave "l in 1..L" out of the summation:
subj to C17 {l in 1..L}: sum{k in 1..K_l[l], i in N} x_oik[i,k] = K_l[l];
Your objective "minimize Makespan: C_max;" is good, but you should define just "var C_max;" and then add a constraint "C_max >= C_h[h]" for every h in 1..H.
--
Robert Fourer
am...@googlegroups.com
yes, this worked now.
But something is still wrong since i do not get any results...
Ich checked more closely the constraints and i am wondering why it computes e.g C29 differently that stated in the mod file?
AMPL Google Group schrieb am Mittwoch, 12. Mai 2021 um 16:59:10 UTC+2:
You need to read a model file before the data file. For example, if you have a model file named FinalMod.mod in the same folder as the data file, you would give these commands:
ampl: reset;
ampl: model '/Users/Jani/Desktop/AMPL Beispiele/FinalMod.mod';
ampl: data '/Users/Jani/Desktop/AMPL Beispiele/FinalDat.dat';
--
Robert Fourer
On Wed, May 12, 2021 at 2:58 PM UTC, AMPL Google Group <am...@googlegroups.com> wrote:
You need to read a model file before the data file. For example, if you have a model file named FinalMod.mod in the same folder as the data file, you would give these commands:
ampl: reset;
ampl: model '/Users/Jani/Desktop/AMPL Beispiele/FinalMod.mod';
ampl: data '/Users/Jani/Desktop/AMPL Beispiele/FinalDat.dat';
--
Robert Fourer
am...@googlegroups.com
thank you for you answer, Robert! I am only wondering how i can write constraints where I have a pram M that is multiplied by a binary variable. For e.g I have a constraint :M is a very gib positive (put it in the data file as 1000) number that is only multiplied by 1 if the binary variable x_ijk is 0. If x_ijk is 1 than M is not supposed to be respected. AMPL now moves all param on the right side which does not represent the original sense of the constraint anymore since i have M respected on the right side with 1000 if x_ijk is 0. On the left side it the term 1002*x_ijk becomes 0. Is there any way i can set the constraint in the way the AMPL does not move the terms?
Thank you in advance for any help!!
Best regards, Janina
On Thu, May 13, 2021 at 5:57 PM UTC, AMPL Google Group <am...@googlegroups.com> wrote:
AMPL's "expand" command moves all of the terms involving variables to the left of the relational operator (= or <= or >=) and puts the constant term to the right. Thus for a constraint whose general expression is F_h[h] + A_h[h] <= C_h[h] with A_h being a param, it's normal that expand would show you F_h[1] - C_h[1] <= -9 and F_h[2] - C_h[2] <= -7.
You are not getting any results because AMPL's presolve phase has determined -- without even sending the problem to the solver -- that no feasible solution is possible. That is, there is no way to assign values to the variables so that all the conditions on the variables and all the constraints are satisfied.
In your particular case the presolve messages suggest that, in constraints such as C19[2,2], presolve was able to deduce fixed values for all of the variables, but those values did not satisfy the constraint. So you should look more closely at the constraints mentioned in the presolve messages:With this information together with your knowledge of the model and data, you will have a start on figuring out why no feasible solution is possible and what should be done to make your problem feasible.
- Use AMPL commands like "expand C19[2,2];" to see exactly what AMPL generated for the constraints mentioned in the presolve messages. (Normally only the first 5 presolve messages are shown, but you can use "option eexit 0, presolve_warnings 100;" to see all of.)
- Use commands like "display F_h.lb, F_h.ub;" to show the lower and upper bounds that presolve computed on constraints like C19; variables that were fixed will have the lower bound equal to the upper bound. (You can use "display _varname, _var.lb, _var.ub;" to show the lower and upper bounds on all the variables.)
--
Robert Fourer
am...@googlegroups.com