$$Exercise: 1$$

$In\; this\; lab,\; we \;will\; consider \;non-linear \;problems \;which\; can \;be \;converted\; to\; linear\; programs.\; One \;famous\; example\; is\; the \;absolute \;value \;function \;given\; as: $ \\
\begin{align}
|x| = \begin{cases}
        x  & \text{ if } x\geq 0 \\ 
        -x & \text{ otherwise }.
      \end{cases}
\end{align}

$We\; will \;now \;consider \;the \;absolute\; value\; function \;appearing \;in \;the\; objective\; function.\; Consider \;the\; optimization \;problem: $ \\
$\textbf{(OP)}$:
\begin{align}
\min \ |x_1| + |x_2| + |x_3| + |x_4| + |x_5| &  \nonumber \\
{\rm{s.t.}} \ 85 x_1 + 92 x_2 + 45 x_3 + 27 x_4 + 31 x_5 & \geq 1 \nonumber \\
92 x_1 + 54 x_2 + 22 x_3 + 20 x_4 + 7 x_5 & \geq 1 \nonumber \\
96 x_1 + 67 x_2 + 29 x_3 + 20 x_4 + 11 x_5 & \geq 1 \nonumber \\
-91 x_1 - 57 x_2 - 33 x_3 - 23 x_4 - 12 x_5 & \geq 1 \nonumber \\
-99 x_1 - 75 x_2 - 26 x_3 - 24 x_4 - 41 x_5 & \geq 1 \nonumber \\
-98 x_1 - 99 x_2 - 57 x_3 - 45 x_4 - 65 x_5 & \geq 1 \nonumber
\end{align}

$In\; this\; optimization\; problem \\
\textbf{(OP)}, we \;wish \;to \;minimize\; the \;sum \;of\; absolute \;values\; of\; the \;decision \;variables.\; Such \;problems\; are \;useful \;when \;the \;decision\; variables \;might\; take\; both\; positive\; and\; negative \;values, \;and \;we \;want\; to \;optimize \;the \;magnitudes\; of \;the\; decision \;variables. \\
We \;will\; now \;consider\; two\; possible\; ways\; to\; solve\; this \;problem.$

$\textbf{Approach 1:}$ 

$We \;can\; use\; a \;substitution \;of\; the\; absolute\; function \;values\; of \;the \;variables \;to \;new \;variables\; as\; u_i = |x_i|, \; \forall i \in \{1,\ldots,5\}. \;With \;this \;substitution, \;note\; that\; we\; have\; u_i\geq 0, \ \forall i \in \{1,\ldots,5\}.\; Also,\; the\; following\; inequalities\; are \;satisfied:\; x_i \leq u_i, -x_i \leq u_i, \ \forall i \in \{1,\ldots,5\}. \;Thus\; we \;can\; transform \;the \;problem \; \textbf{(OP)} \; as\; the \;following \;optimization\; problem\; \textbf{(OP1)}, \;where \;the \;absolute\; values\; of\; x_i \; are\; replaced \;with\; u_i \; and \;constraints \;related\; to \;the\; new \;variables \; u_i \;are\; introduced.\; Thus\; we \;have\; the \;problem \; \textbf{(OP1)}:$

\begin{align}
\min \ u_1 + u_2 + u_3 + u_4 + u_5 &  \nonumber \\
{\rm{s.t.}} \ 85 x_1 + 92 x_2 + 45 x_3 + 27 x_4 + 31 x_5 & \geq 1 \nonumber \\
92 x_1 + 54 x_2 + 22 x_3 + 20 x_4 + 7 x_5 & \geq 1 \nonumber \\
96 x_1 + 67 x_2 + 29 x_3 + 20 x_4 + 11 x_5 & \geq 1 \nonumber \\
-91 x_1 - 57 x_2 - 33 x_3 - 23 x_4 - 12 x_5 & \geq 1 \nonumber \\
-99 x_1 - 75 x_2 - 26 x_3 - 24 x_4 - 41 x_5 & \geq 1 \nonumber \\
-98 x_1 - 99 x_2 - 57 x_3 - 45 x_4 - 65 x_5 & \geq 1 \nonumber \\
u_i \geq x_i, & \  \forall i \in \{1,\ldots,5\} \nonumber \\ 
u_i \geq -x_i, & \  \forall i \in \{1,\ldots,5\} \nonumber \\ 
u_i \geq 0, & \ \forall i \in \{1,\ldots,5\}. 
\end{align}

$Note\; that \;the\; number\; of \;decision \;variables\; in \; \textbf{(OP1)} is\; twice\; the\; number\; of \;decision\; variables\; in \; \textbf{(OP)}. \;However\; the\; objective\; function\; and\; the \;constraints\; in\;  \textbf{(OP1)} \;are\; now\; linear, \;and\; thus\;  \textbf{(OP1)} \;is\; a\; linear\; program. $



```python
! pip install -q pyomo
```


```python
from pyomo.environ import * 
```


```python
import numpy as np
```


```python
coef = np.loadtxt('file31.txt', delimiter=',')
```


```python
model_lab6_ex1 = ConcreteModel()
```


```python
N = coef.shape[1]-1
M = coef.shape[0]-1
obj_coef = coef[0,:-1]
constr_coef = coef[1:,:-1]
constr_rhs = coef[1:,-1]
```


```python
col_indices_x = np.arange(int(N/2))
model_lab6_ex1.x = Var(col_indices_x)
```


```python
col_indices_u = np.arange(int(N/2))
model_lab6_ex1.u = Var(col_indices_u, domain=NonNegativeReals)
```


```python
row_indices = np.arange(M)
```


```python
model_lab6_ex1.constraints = ConstraintList()
```


```python
model_lab6_ex1.objective = Objective(expr = summation(obj_coef[0:int(N/2)],model_lab6_ex1.x) + summation(obj_coef[int(N/2):N],model_lab6_ex1.u), sense=minimize)
```


```python
for i in row_indices:
  model_lab6_ex1.constraints.add(summation(constr_coef[i][0:int(N/2)],model_lab6_ex1.x) + summation(constr_coef[i][int(N/2):N],model_lab6_ex1.u)  >= constr_rhs[i])
```


```python
model_lab6_ex1.pprint()
```

    3 Set Declarations
        constraints_index : Size=1, Index=None, Ordered=Insertion
            Key  : Dimen : Domain : Size : Members
            None :     1 :    Any :   16 : {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}
        u_index : Size=1, Index=None, Ordered=False
            Key  : Dimen : Domain : Size : Members
            None :     1 :    Any :    5 : {0, 1, 2, 3, 4}
        x_index : Size=1, Index=None, Ordered=False
            Key  : Dimen : Domain : Size : Members
            None :     1 :    Any :    5 : {0, 1, 2, 3, 4}
    
    2 Var Declarations
        u : Size=5, Index=u_index
            Key : Lower : Value : Upper : Fixed : Stale : Domain
              0 :     0 :  None :  None : False :  True : NonNegativeReals
              1 :     0 :  None :  None : False :  True : NonNegativeReals
              2 :     0 :  None :  None : False :  True : NonNegativeReals
              3 :     0 :  None :  None : False :  True : NonNegativeReals
              4 :     0 :  None :  None : False :  True : NonNegativeReals
        x : Size=5, Index=x_index
            Key : Lower : Value : Upper : Fixed : Stale : Domain
              0 :  None :  None :  None : False :  True :  Reals
              1 :  None :  None :  None : False :  True :  Reals
              2 :  None :  None :  None : False :  True :  Reals
              3 :  None :  None :  None : False :  True :  Reals
              4 :  None :  None :  None : False :  True :  Reals
    
    1 Objective Declarations
        objective : Size=1, Index=None, Active=True
            Key  : Active : Sense    : Expression
            None :   True : minimize :  + (u[0] + u[1] + u[2] + u[3] + u[4])
    
    1 Constraint Declarations
        constraints : Size=16, Index=constraints_index, Active=True
            Key : Lower : Body                                                             : Upper : Active
              1 :   1.0 :   85.0*x[0] + 92.0*x[1] + 45.0*x[2] + 27.0*x[3] + 31.0*x[4] + () :  +Inf :   True
              2 :   1.0 :    92.0*x[0] + 54.0*x[1] + 22.0*x[2] + 20.0*x[3] + 7.0*x[4] + () :  +Inf :   True
              3 :   1.0 :   96.0*x[0] + 67.0*x[1] + 29.0*x[2] + 20.0*x[3] + 11.0*x[4] + () :  +Inf :   True
              4 :   1.0 : - 91.0*x[0] - 57.0*x[1] - 33.0*x[2] - 23.0*x[3] - 12.0*x[4] + () :  +Inf :   True
              5 :   1.0 : - 99.0*x[0] - 75.0*x[1] - 26.0*x[2] - 24.0*x[3] - 41.0*x[4] + () :  +Inf :   True
              6 :   1.0 : - 98.0*x[0] - 99.0*x[1] - 57.0*x[2] - 45.0*x[3] - 65.0*x[4] + () :  +Inf :   True
              7 :   0.0 :                                                  - x[0] + (u[0]) :  +Inf :   True
              8 :   0.0 :                                                  - x[1] + (u[1]) :  +Inf :   True
              9 :   0.0 :                                                  - x[2] + (u[2]) :  +Inf :   True
             10 :   0.0 :                                                  - x[3] + (u[3]) :  +Inf :   True
             11 :   0.0 :                                                  - x[4] + (u[4]) :  +Inf :   True
             12 :   0.0 :                                                    x[0] + (u[0]) :  +Inf :   True
             13 :   0.0 :                                                    x[1] + (u[1]) :  +Inf :   True
             14 :   0.0 :                                                    x[2] + (u[2]) :  +Inf :   True
             15 :   0.0 :                                                    x[3] + (u[3]) :  +Inf :   True
             16 :   0.0 :                                                    x[4] + (u[4]) :  +Inf :   True
    
    7 Declarations: x_index x u_index u constraints_index constraints objective



```python
!apt-get install -y -qq coinor-cbc
```

$Q:1\; Using \;cbc \;solver \;to \;solve \;optimization \;problem$


```python
opt_cbc = SolverFactory('cbc')
result = opt_cbc.solve(model_lab6_ex1)
```

$Q:2\;Reporting \;the\; solver \;status\; and \;solver\; termination \;condition$


```python
print('Solver status:', result.solver.status)
print('Solver termination condition:',result.solver.termination_condition)
```

    Solver status: ok
    Solver termination condition: optimal


$Yes, \; the\; solver\; yield\; an\; optimal\;solution $

$Q:3\;Reporting\; the \;optimal \;objective \;function \;value,\;
values\; of \;the \;decision\; variables \;x_i \;and \;the\; new \;variables\; u_i\; and \;the \;constraint\; activities \;at\;the\; optimal\; solution.$


```python
print('\nObjective = ', model_lab6_ex1.objective())

print('\nDecision Variables')
for j in col_indices_x:
    print('x[',j+1,']:', model_lab6_ex1.x[j].value)

for j in col_indices_u:
    print('u[',j+1,']:', model_lab6_ex1.u[j].value)

print('\nConstraints')
model_lab6_ex1.constraints.display()
```

    
    Objective =  0.547955725
    
    Decision Variables
    x[ 1 ]: -0.046448575
    x[ 2 ]: 0.18612441
    x[ 3 ]: -0.17131802
    x[ 4 ]: 0.0
    x[ 5 ]: -0.14406472
    u[ 1 ]: 0.046448575
    u[ 2 ]: 0.18612441
    u[ 3 ]: 0.17131802
    u[ 4 ]: 0.0
    u[ 5 ]: 0.14406472
    
    Constraints
    constraints : Size=16
        Key : Lower : Body               : Upper
          1 :   1.0 : 0.9999996250000001 :  None
          2 :   1.0 : 0.9999997599999997 :  None
          3 :   1.0 :  1.458337769999999 :  None
          4 :   1.0 : 1.0000002550000002 :  None
          5 :   1.0 :  1.000000215000001 :  None
          6 :   1.0 : 5.2549776999999995 :  None
          7 :   0.0 :         0.09289715 :  None
          8 :   0.0 :                0.0 :  None
          9 :   0.0 :         0.34263604 :  None
         10 :   0.0 :                0.0 :  None
         11 :   0.0 :         0.28812944 :  None
         12 :   0.0 :                0.0 :  None
         13 :   0.0 :         0.37224882 :  None
         14 :   0.0 :                0.0 :  None
         15 :   0.0 :                0.0 :  None
         16 :   0.0 :                0.0 :  None


$Observations:\; Here \;constraint \;1 , \;constraint \;2 , \;constraint\; 4 , \;constraint \;5 ,\; constraint\; 8 , \;constraint \;10 ,\; constraint \;12 , \;constraint \;14 , \;constraint \;15 ,\;constraint \;16 \;are\; active\; and\; rest \;of\; the \;constraints \;are\; inactive.$

Recall our optimization problem $\textbf{(OP)}$:
\begin{align}
\min \ |x_1| + |x_2| + |x_3| + |x_4| + |x_5| &  \nonumber \\
{\rm{s.t.}} \ 85 x_1 + 92 x_2 + 45 x_3 + 27 x_4 + 31 x_5 & \geq 1 \nonumber \\
92 x_1 + 54 x_2 + 22 x_3 + 20 x_4 + 7 x_5 & \geq 1 \nonumber \\
96 x_1 + 67 x_2 + 29 x_3 + 20 x_4 + 11 x_5 & \geq 1 \nonumber \\
-91 x_1 - 57 x_2 - 33 x_3 - 23 x_4 - 12 x_5 & \geq 1 \nonumber \\
-99 x_1 - 75 x_2 - 26 x_3 - 24 x_4 - 41 x_5 & \geq 1 \nonumber \\
-98 x_1 - 99 x_2 - 57 x_3 - 45 x_4 - 65 x_5 & \geq 1 \nonumber
\end{align}

Now we will consider a different approach to make the problem $\textbf{(OP)}$ linear. 

$\textbf{Approach 2:}$

In this approach we will use some fundamental properties of real numbers. Indeed, for any real number $x$, we can write $x=a-b$ where $a\geq 0, b\geq 0$. 

Hence we can substitute $|x| = |a-b|, \ a\geq 0, b\geq 0$. 

Now we will consider another interesting property of real numbers: 
$|u-v| = u+v \iff u\geq 0, v\geq 0, uv = 0$. 

Using this property we can write $|x| = a+b, \ a\geq 0, \ b\geq 0$. Note that this replacement will imply that $ab=0$. 

Thus we can transform the optimization problem $\textbf{(OP)}$ into a new optimization problem $\textbf{(OP2)}$ where $x_i = a_i - b_i, \text{ and } |x_i| = a_i + b_i, \ \forall i \in \{1,\dots,5\}$ where $a_i \geq 0, b_i \geq 0, \forall i \in \{1,\dots,5\}$. Thus we have the new optimization problem $\textbf{(OP2)}$: 

\begin{align}
\min \ (a_1 + b_1) +  (a_2 + b_2) + (a_3 + b_3) + (a_4 + b_4) + (a_5 + b_5) &  \nonumber \\
{\rm{s.t.}} \ 85 (a_1-b_1) + 92 (a_2-b_2) + 45 (a_3-b_3) + 27 (a_4-b_4) + 31 (a_5-b_5) & \geq 1 \nonumber \\
92 (a_1-b_1) + 54 (a_2-b_2) + 22 (a_3-b_3) + 20 (a_4-b_4) + 7 (a_5-b_5) & \geq 1 \nonumber \\
96 (a_1-b_1) + 67 (a_2-b_2) + 29 (a_3-b_3) + 20 (a_4-b_4) + 11 (a_5-b_5) & \geq 1 \nonumber \\
-91 (a_1-b_1) - 57 (a_2-b_2) - 33 (a_3-b_3) - 23 (a_4-b_4) - 12 (a_5-b_5) & \geq 1 \nonumber \\
-99 (a_1-b_1) - 75 (a_2-b_2) - 26 (a_3-b_3) - 24 (a_4-b_4) - 41 (a_5-b_5) & \geq 1 \nonumber \\
-98 (a_1-b_1) - 99 (a_2-b_2) - 57 (a_3-b_3) - 45 (a_4-b_4) - 65 (a_5-b_5) & \geq 1 \nonumber \\ 
a_i \geq 0, \ b_i \geq 0, & \ \forall i \in \{1,\ldots,5\}. \nonumber 
\end{align}

$Q: 4 - Done$

$Q: 5 - Done$

$Q: 6 - Using\; numpy\;  to\;  load \; the \; .txt\;  file\; contents$


```python
coef1 = np.loadtxt('file310P2.txt',delimiter=',')
```

$Q:7 - Writing\; a \;pyomo\; model\; to\; solve \;problem$


```python
N = coef1.shape[1]-1
M=coef1.shape[0]-1
obj_coef1 = coef1[0,:-1]
constr_coef1 = coef1[1:,:-1]
rhs_coef1 = coef1[1:,-1]
model_lab6_ex1_op2 = ConcreteModel()
col_indices_a = np.arange(int(N/2))
model_lab6_ex1_op2.a = Var(col_indices_a,domain=NonNegativeReals)
col_indices_b = np.arange(int(N/2))
model_lab6_ex1_op2.b = Var(col_indices_b,domain=NonNegativeReals)
row_indices = np.arange(M)
model_lab6_ex1_op2.constraints = ConstraintList()
model_lab6_ex1_op2.objective = Objective(expr = summation(obj_coef1[0:int(N/2)],model_lab6_ex1_op2.a) + summation(obj_coef1[int(N/2):N],model_lab6_ex1_op2.b), sense=minimize)
for i in row_indices:
  model_lab6_ex1_op2.constraints.add(summation(constr_coef1[i][0:int(N/2)],model_lab6_ex1_op2.a) + summation(constr_coef1[i][int(N/2):N],model_lab6_ex1_op2.b)  >= rhs_coef1[i])
```


```python
model_lab6_ex1_op2.pprint()
```

    3 Set Declarations
        a_index : Size=1, Index=None, Ordered=False
            Key  : Dimen : Domain : Size : Members
            None :     1 :    Any :    5 : {0, 1, 2, 3, 4}
        b_index : Size=1, Index=None, Ordered=False
            Key  : Dimen : Domain : Size : Members
            None :     1 :    Any :    5 : {0, 1, 2, 3, 4}
        constraints_index : Size=1, Index=None, Ordered=Insertion
            Key  : Dimen : Domain : Size : Members
            None :     1 :    Any :    6 : {1, 2, 3, 4, 5, 6}
    
    2 Var Declarations
        a : Size=5, Index=a_index
            Key : Lower : Value : Upper : Fixed : Stale : Domain
              0 :     0 :  None :  None : False :  True : NonNegativeReals
              1 :     0 :  None :  None : False :  True : NonNegativeReals
              2 :     0 :  None :  None : False :  True : NonNegativeReals
              3 :     0 :  None :  None : False :  True : NonNegativeReals
              4 :     0 :  None :  None : False :  True : NonNegativeReals
        b : Size=5, Index=b_index
            Key : Lower : Value : Upper : Fixed : Stale : Domain
              0 :     0 :  None :  None : False :  True : NonNegativeReals
              1 :     0 :  None :  None : False :  True : NonNegativeReals
              2 :     0 :  None :  None : False :  True : NonNegativeReals
              3 :     0 :  None :  None : False :  True : NonNegativeReals
              4 :     0 :  None :  None : False :  True : NonNegativeReals
    
    1 Objective Declarations
        objective : Size=1, Index=None, Active=True
            Key  : Active : Sense    : Expression
            None :   True : minimize : a[0] + a[1] + a[2] + a[3] + a[4] + (b[0] + b[1] + b[2] + b[3] + b[4])
    
    1 Constraint Declarations
        constraints : Size=6, Index=constraints_index, Active=True
            Key : Lower : Body                                                                                                                      : Upper : Active
              1 :   1.0 :     85.0*a[0] + 92.0*a[1] + 45.0*a[2] + 27.0*a[3] + 31.0*a[4] - 85.0*b[0] - 92.0*b[1] - 45.0*b[2] - 27.0*b[3] - 31.0*b[4] :  +Inf :   True
              2 :   1.0 :       92.0*a[0] + 54.0*a[1] + 22.0*a[2] + 20.0*a[3] + 7.0*a[4] - 92.0*b[0] - 54.0*b[1] - 22.0*b[2] - 20.0*b[3] - 7.0*b[4] :  +Inf :   True
              3 :   1.0 :     96.0*a[0] + 67.0*a[1] + 29.0*a[2] + 20.0*a[3] + 11.0*a[4] - 96.0*b[0] - 67.0*b[1] - 29.0*b[2] - 20.0*b[3] - 11.0*b[4] :  +Inf :   True
              4 :   1.0 : - 91.0*a[0] - 57.0*a[1] - 33.0*a[2] - 23.0*a[3] - 12.0*a[4] + (91.0*b[0] + 57.0*b[1] + 33.0*b[2] + 23.0*b[3] + 12.0*b[4]) :  +Inf :   True
              5 :   1.0 : - 99.0*a[0] - 75.0*a[1] - 26.0*a[2] - 24.0*a[3] - 41.0*a[4] + (99.0*b[0] + 75.0*b[1] + 26.0*b[2] + 24.0*b[3] + 41.0*b[4]) :  +Inf :   True
              6 :   1.0 : - 98.0*a[0] - 99.0*a[1] - 57.0*a[2] - 45.0*a[3] - 65.0*a[4] + (98.0*b[0] + 99.0*b[1] + 57.0*b[2] + 45.0*b[3] + 65.0*b[4]) :  +Inf :   True
    
    7 Declarations: a_index a b_index b constraints_index constraints objective


$Q:8 - Using \;cbc\; solver\; to\; solve\; the\; model \;for\; optimization \;problem$


```python
result = opt_cbc.solve(model_lab6_ex1_op2)
```

$Q: 9 - Reporting\; the \;solver \;status\; and \;solver \;termination \;condition.$


```python
print('Solver status:', result.solver.status)
print('Solver termination condition:',result.solver.termination_condition)
```

    Solver status: ok
    Solver termination condition: optimal


$Yes, \; the\; solver\; yield\; an\; optimal\;solution $

$Q:10 -  Reporting \;the \;optimal \;objective \;function \;value,\; values\;
of\; the\; decision\; variables \;ai \;and \;bi, \; and \;the \;constraint \;activities\; at\; the \;optimal \;solution.$



```python
print('\nObjective = ', model_lab6_ex1_op2.objective())

print('\nDecision Variables')
for j in col_indices_a:
    print('a[',j+1,']:', model_lab6_ex1_op2.a[j].value)

for j in col_indices_b:
    print('b[',j+1,']:', model_lab6_ex1_op2.b[j].value)

print('\nConstraints')
model_lab6_ex1_op2.constraints.display()
```

    
    Objective =  0.547955725
    
    Decision Variables
    a[ 1 ]: 0.0
    a[ 2 ]: 0.18612441
    a[ 3 ]: 0.0
    a[ 4 ]: 0.0
    a[ 5 ]: 0.0
    b[ 1 ]: 0.046448575
    b[ 2 ]: 0.0
    b[ 3 ]: 0.17131802
    b[ 4 ]: 0.0
    b[ 5 ]: 0.14406472
    
    Constraints
    constraints : Size=6
        Key : Lower : Body               : Upper
          1 :   1.0 :  0.999999625000001 :  None
          2 :   1.0 : 0.9999997599999997 :  None
          3 :   1.0 :         1.45833777 :  None
          4 :   1.0 : 1.0000002549999998 :  None
          5 :   1.0 :        1.000000215 :  None
          6 :   1.0 :  5.254977699999998 :  None


$Here \;constraint\; 1 , \;constraint\; 2 ,\; constraint \;4 ,\; constraint \;5\; are\; active \; and \;rest \;of\; the\; constraints\; are \;inactive.$

$Q: 11-Writing \;code \;to \;print \;the \;original\; variables\; x_i \;from \;a_i\; and\; b_i\; and\; print\; the\; values\; of\; x_i$



```python
model_lab6_ex1_op2.x = Var(col_indices_a, domain=Reals)
```


```python
 for i in col_indices_b:
    model_lab6_ex1_op2.x[i].value=model_lab6_ex1_op2.a[i].value-model_lab6_ex1_op2.b[i].value
```


```python
print('\nObjective = ', model_lab6_ex1_op2.objective())

print('\nDecision Variables')
for i in col_indices_a:
     print('x[',i+1,']:', model_lab6_ex1_op2.x[i].value)


print('\nConstraints')
model_lab6_ex1_op2.constraints.display()
```

    
    Objective =  0.547955725
    
    Decision Variables
    x[ 1 ]: -0.046448575
    x[ 2 ]: 0.18612441
    x[ 3 ]: -0.17131802
    x[ 4 ]: 0.0
    x[ 5 ]: -0.14406472
    
    Constraints
    constraints : Size=6
        Key : Lower : Body               : Upper
          1 :   1.0 :  0.999999625000001 :  None
          2 :   1.0 : 0.9999997599999997 :  None
          3 :   1.0 :         1.45833777 :  None
          4 :   1.0 : 1.0000002549999998 :  None
          5 :   1.0 :        1.000000215 :  None
          6 :   1.0 :  5.254977699999998 :  None


$Q:12-The \;values \;of \;x_i \;obtained \;from\; solving \;OP1 \;are\; same\; as\; the \;values \;of \;x_i \;obtained\; from\; solving \;OP2$

645ffad6b2c6eaac2fb991c0aa62dd39745dc500
ipynb
Jupyter Notebook
Objective function with absolute value function/Objective function with absolute value function, provided file31 and file310P2.ipynb
RoyaakasH/Modelling-and-Computation-Lab
0abe0e0aef0c6c0a080a24d2106dc446804fef83
MIT
Objective function with absolute value function/Objective function with absolute value function, provided file31 and file310P2.ipynb
RoyaakasH/Modelling-and-Computation-Lab
0abe0e0aef0c6c0a080a24d2106dc446804fef83
MIT
Objective function with absolute value function/Objective function with absolute value function, provided file31 and file310P2.ipynb
RoyaakasH/Modelling-and-Computation-Lab
0abe0e0aef0c6c0a080a24d2106dc446804fef83
MIT
Qwen/Qwen-72B
1. YES
2. YES