write a code

  • 22 September 2019
  • 6 replies
  • 180 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

dear @mohansx

how should be the pareto curve if one function is minimized and another function is maximized?

Thanks

GL
Userlevel 5
Badge +5
@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;
}
dear @mohansx ,

thanks for your replay. However, how can I relate this parameter to the constraint?

Best

GL
Userlevel 5
Badge +5
@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.
Userlevel 4
Badge +3
Are you able to share the project with instruction of how to reproduce the error?
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

Reply


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

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