Quiet@Remove["Global`*"];

NMinimize[{2 x-3 y,x+y<10,x-y>2,x>1},{x,y}]

LinearProgramming[{2,-3},(({{-1, -1}, {1, -1}, {1, 0}})),{-10,2,1}]

exprToBeMinimized=2x+3y;
constr=(x^2)+(y^2)==1;
rearrangedConstr=constr/.lhs_==rhs_:>lhs-rhs;
Lagrange=exprToBeMinimized+λ*rearrangedConstr;
eqn1=D[Lagrange,x]==0;
eqn2=D[Lagrange,y]==0;
eqn3=D[Lagrange,λ]==0;
sol=Solve[{eqn1,eqn2,eqn3}]
exprToBeMinimized/.sol

Minimize[{exprToBeMinimized,constr},{x,y}]
Maximize[{exprToBeMinimized,constr},{x,y}]

(x^2)/.{{x->2},{x->5}}

object=Table[{i,i+1},{i,10}]
object/.{a_,b_}:>{b,a}

a+b==a-u+y/.lhs_==rhs_:>lhs-rhs

Minimize[{exprToBeMinimized,constr},{x,y}]
Maximize[{exprToBeMinimized,constr},{x,y}]

NMinimize[{exprToBeMinimized,constr},{x,y}]
NMaximize[{exprToBeMinimized,constr},{x,y}]

constr1[var_,varMin_,varMax_,sloop_]:=(2-(Tanh[sloop*(var-varMin)]-Tanh[sloop*(var-varMax)]))*(((var-((varMax+varMin)/2)))^2);
aux=constr1[x,2,4,100];
Plot[aux,{x,-1,7},PlotRange->All];

(*example*)
exprToBeMinimized=x+2y;
con1=2<x<4;
con2=0<y<1;
NMinimize[{exprToBeMinimized,con1,con2},{x,y}]

penaltyX=constr1[x,2,4,1000];
penaltyY=constr1[y,0,1,1000];
F=exprToBeMinimized+100*(penaltyX+penaltyY);
NMinimize[F,{x,y}]

constr2[var_,varMin_,sloop_]:=(1-(Tanh[sloop*(var-varMin)]))*(((var-varMin))^2);
aux=constr2[x,2,100];
Plot[aux,{x,-1,7},PlotRange->All]

(*example DC transm.*)
R1=2;
R2=5;
loses=R1*(i1^2)+R2*(i2^2);
U1=U2=750*(10^3);
P1=(U1-R1*i1)*i1;
P2=(U2-R2*i2)*i2;
Ptotal=1500*(10^6);
NMinimize[{loses,P1+P2==Ptotal},{i1,i2}]

Quiet@Remove["Global`*"];
loses=R1*(i1^2)+R2*(i2^2);
U1=U2=750*(10^3);
P1=(U1-R1*i1)*i1;
P2=(U2-R2*i2)*i2;
Ptotal=1500*(10^6);
Minimize[{loses,P1+P2==Ptotal},{i1,i2}]