Lab5 (1).pdf - IEMS 313 Lab 5 The deliverables for this lab...

This preview shows page 1 - 3 out of 4 pages.

IEMS 313 Lab 5 11/12/2018 The deliverables for this lab are: 1. Submit the .mod, .run and .log files for the problem in Section 2. Put your .mod, .run and .log file in a single zip file, name it as “Lab5.zip” and submit it via Canvas. In your .log file, you should display an optimal solution for each subproblem of the practice problem as well as the optimal values of the objective functions. 1 Using the .run files 1.1 For Loops We can use the “for” statement to loop through a set in the .run file. The structure of a “for” loop in AMPL is shown below: for {j in J} {Iterative Executions} Here J is the set we would like to loop through. The execution inside the loop could use iterative index j to accomplish different tasks. If we only wanted to execute the action for specific elements of J , say j = 2,3,4,5 , we could write: for {j in 2..5} {Iterative Executions} 1.2 If-Else Statements The structure of the “if-else” statement is shown below: if CONDITION then {Execution 1} else {Execution 2} If the CONDITION is true, then AMPL will carry out Execution 1 , while if it is not true, AMPL will carry out Execution 2 . 1.3 While Statements Using the while statement, we repeatedly execute a task until some condition is met. The syntax is as follows: repeat while {SOME CONDITION} {Iterative Executions} 1
Image of page 1

Subscribe to view the full document.

1.4 Generating Random Variables To generate random variables with normal distribution with mean 1 and variance 10, you can use a syntax similar to the following: for {i in I, j in J} let c[i,j]:= Normal(1,10); We can do this for other distributions too. For example, we can generate a parameter uniformly distributed on the interval [0 , 10] as follows: let a := Uniform(0,10); 1.5 Dropping and Restoring Constraints In the deliverable of this lab, you will be comparing two formulations that only differ by one set of constraints.
Image of page 2
Image of page 3

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern