I am solving a same mixed integer problem several times (I am using different scenarios for each mixed integer program so that the optimal values of each mixed integer program are different) and trying to store optimal values of each mixed integer program in an array.

The following is the code that I wrote and I checked it is working properly:

parameters f=1 and u=10 are defined.

while ((f le u),
    Solve scheduling using mip maximizing objvalue;
    display objvalue.l;

    *** NEED some sentence(s) to store the objective values in an array ****.

    f = f+1;
);

Is there any way to store each optimal value in an array?

Thank you very much in advance.

asked 13 Feb '14, 15:58

Mike390's gravatar image

Mike390
214
accept rate: 0%

edited 14 Feb '14, 04:14

fbahr's gravatar image

fbahr ♦
4.6k716


Define a parameter with its size equal to the number of scenarios (in your case 10) outside a loop.
Then, set its values within the loop accordingly.

The general template would as follows:

//outside the loop 
set f scenarios/f1*f10/;
parameter log(f);
//the loop
loop(f,
  //Solve the problem
  log(f) = z.l;
);
link

answered 13 Feb '14, 16:13

Ehsan's gravatar image

Ehsan ♦
4.8k31122
accept rate: 16%

edited 14 Feb '14, 04:13

fbahr's gravatar image

fbahr ♦
4.6k716

Ehsan, Thank you very much. It's working well now

(13 Feb '14, 16:36) Mike390
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×51
×2

Asked: 13 Feb '14, 15:58

Seen: 2,049 times

Last updated: 14 Feb '14, 04:14

OR-Exchange! Your site for questions, answers, and announcements about operations research.