Skip to main content

write a code

  • September 22, 2019
  • 6 replies
  • 202 views

Dear all,
I want to write a code in the MainExecution section.
I want to consider in the first cycle a constraint, but I wan't to consider this constraint in the second cycle.
How can I write this?
Thanks
Best
GL

6 replies

  • Author
  • Newcomer
  • 27 replies
  • September 24, 2019
Dear all,
I have this error in my code:

The set "Integers" does not denote a subset of the set "e_set".

How can I solve it?
Thanks.
Best
GL

deannezhang
AIMMS Champ
Forum|alt.badge.img+3
  • AIMMS Champ
  • 61 replies
  • September 25, 2019
Are you able to share the project with instruction of how to reproduce the error?

mohansx
Forum|alt.badge.img+5
  • Former AIMMSian
  • 223 replies
  • October 2, 2019
@graleo

I want to consider in the first cycle a constraint, but I wan't to consider this constraint in the second cycle.


Please review below article, it shows you how to select/deselect multiple variables and constraints from a math program.

https://how-to.aimms.com/Articles/175/175-select-variables-and-constraints-for-math-program.html


For your case, it might be easiest to declare a parameter with Initial data as 1. Say, pConstraintActive.

In the Index domain of the constraint you want to use in cycle 1 and not use in Cycle 2, include this parameter.

code:
(i, j) | pConstraintActive


This will make the constraint active only if pConstraintActive has a nonzero value.

Now, your procedure will be.

code:
!solve with constraint
pConstraintActive := 1;
solve MathModel;

!solve without constraint
pConstraintActive := 0;
solve MathModel;


Note that you will need to store the results between two subsequent runs so that you don't lose the results from the first solve run when you run the solve statement the second time.

  • Author
  • Newcomer
  • 27 replies
  • October 3, 2019
dear @mohansx ,
thanks for your replay. However, how can I relate this parameter to the constraint?
Best
GL

mohansx
Forum|alt.badge.img+5
  • Former AIMMSian
  • 223 replies
  • October 3, 2019
@graleo
how can I relate this parameter to the constraint?


The parameter must go in the index domain condition of the constraint.

code:
Constraint your_constraint {
IndexDomain: (i,j)
Definition: constraint definition;
}


must become

code:
Constraint your_constraint {
IndexDomain: (i,j)|pConstraintActive
Definition: constraint definition;
}

  • Author
  • Newcomer
  • 27 replies
  • October 5, 2019
dear @mohansx
how should be the pareto curve if one function is minimized and another function is maximized?
Thanks
GL


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator