您好,欢迎访问三七文档
AMPLAModelingLanguageforMathematicalProgrammingIntroductionDownloadAMPLStudentEditionAMPL.exe/amplcml.zipSolversSolverAlgorithmTypesCPLEXLinear(simplex),Linear(interior)Network,QuadraticIntegerLinear,IntegerQuadraticGUROBILinear(simplex),IntegerLinearLP_SOLVELinear(simplex),IntegerLinearMINOSLinear(simplex),NonlinearExample-1AMPLExample-1ampl:solve;ampl:displayxb,xc;ampl:quit;AMPLBasicSetsandIndexingsetwhse;setwhse‘warehouses’;settime:=1..10;{whse}{tintime},{winwhse}{winwhse,tintime}AMPLBasicParametersparamio;paramio{commod,proc};paramlife0integer;paramcri{prd}=0;AMPLBasicOperatorOperation^exponentiation+-notunaryplus,minus,logicalnegation*/modmultiplication,division,remaindermaxminexistsforallsumproditeratedaddition,product+-lessaddition,subtraction,non-negativesubtractioninsetmembership===comparisonandlogicalconjunctionorlogicaldisjunctionif…then…else…conditionalevaluationAMPLBasicsum{pinprd}dem[p]ifroad[r,pl]0then0.5+0.0144*road[r,pl]else0AMPLBasicVariablevarpsip;varHire{time}=0;varrprd{prd,time}=0;AMPLBasicConstraintssubjecttoIreq{pinprd,tintime}:sum{ain1..life}Inv[p,t,a]+iil[p,t]=minv[p,t];AMPLBasicObjectivesminimizemaximizeAMPLBasicDataSetssetproc:=sulf_asulf_bsulf_c;setproc[aswan]:=can_335;setp_except:can_335can_310:=aswanabhelwancd;AMPLBasicDataParametersparamT:=4;paraminit_stock:=iron35.8nickel7.32;paraminit_stock:=nickel35.8iron7.32;AMPLBasicAMPLBasicAMPLBasicAMPLBasicAMPL+Cplexoptionsolvercplex;solve;Example-2a)Youareinchargeofanadvertisingcampaignforanewproduct,withabudgetof$1million.YoucanadvertiseonTVorinmagazines.OneminuteofTVtimecosts$20,000andreaches1.8millionpotentialcustomers;amagazinepagecosts$10,000andreaches1million.Youmustsignupforatleast10minutesofTVtime.Howshouldyouspendyourbudgettomaximizeyouraudience?FormulatetheprobleminAMPLandsolveit.Example-2b)Ittakescreativetalenttocreateeffectiveadvertising;inyourorganization,ittakesthreeperson-weekstocreateamagazinepage,andoneperson-weektocreateaTVminute.Youhaveonly100person-weeksavailable.Addthisconstrainttothemodelanddeterminehowyoushouldnowspendyourbudget.c)Radioadvertisingreachesaquartermillionpeopleperminute,costs$2,000perminute,andrequiresonly1person-dayoftime.Howdoesthismediumaffectyoursolutions?d)Howdoesthesolutionchangeifyouhavetosignupforatleasttwomagazinepages?Amaximumof120minutesofradio?
本文标题:AMPL
链接地址:https://www.777doc.com/doc-4226759 .html