3
$\begingroup$

I have a variable declared as follows in AMPL:

var i {j in UNIT, t in PERIOD}
integer <= 3; 

# therefore, an integer variable is declared that can take values ...,-1,0,1,2,3

Below are the two constraints where this integer variable is used.

\begin{align}c(j,t) &\le E(j,t)\cdot i(j,t)\\d(j,t)&\le F(j,t)\cdot i(j,t)\end{align}

The capital letters denote parameters and small letters are variables. There is a need to optimize the integer variable this way for later use in the formulation. Is there a way I can reformulate the constraints or formulate the variable condition declaration as constraint to make the execution time of the program faster?

$\endgroup$
4
  • $\begingroup$ Are you sure your declaration precludes negative integer values? I'm not an AMPL user, but that looks rather suspicious to me. $\endgroup$ Mar 24 '20 at 20:04
  • $\begingroup$ You are correct, I edited that part. $\endgroup$
    – S_Scouse
    Mar 24 '20 at 20:06
  • $\begingroup$ Can you clarify what the problem is with the current formulation? These constraints seem pretty straightforward -- is there something tricky here that you're trying to accomplish? $\endgroup$
    – LarrySnyder610
    Mar 25 '20 at 1:41
  • $\begingroup$ For some reason, the code executes slowly, I was wondering if there is a way I can reformulate that might make the execution faster. $\endgroup$
    – S_Scouse
    Mar 25 '20 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.