Egerstedt standard problem (AMPL)

From mintOC
Revision as of 15:38, 10 January 2018 by ClemensZeile (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page contains a discretized version of the MIOCP Egerstedt standard problem in AMPL format and with the package ampl_mintoc. You should be aware of the comments regarding discretization made on the AMPL overview page. Note that you will need to include two generic support AMPL files, mintocPre.mod and mintocPost.mod.

AMPL

The model in AMPL code for a fixed control discretization grid with a collocation method. We need a model file egerstedt.mod,

# Problem specific parameters and variables
#param ref{X};
#param p{X,Omega};
 
# Problem specific functions
 
var f {k in X,o in 0..no,i in I} = (
	if      (k==1 && o==0) then 0
	else if (k==2 && o==0) then 0
	else if (k==1 && o==1) then -x[1,i]
	else if (k==2 && o==1) then x[1,i]+2*x[2,i]
	else if (k==1 && o==2) then x[1,i]+x[2,i]
	else if (k==2 && o==2) then x[1,i]-2*x[2,i]
	else if (k==1 && o==3) then x[1,i]-x[2,i]
	else if (k==2 && o==3) then x[1,i]+x[2,i]
);
 
var lagrange{i in IC} = sum{k in X} (x[k,i])^2;
 
var re{k in RE} = (
	if      (k==1) then x[1,0] - 0.5
	else if (k==2) then x[2,0] - 0.5
);
 
var con {k in C, i in IC} = (
	if      (k==1) then 0.4-x[1,i]
);
 
 
 
# -----------------------------------------
# Unused modeling parts
var mayer = 0;
 
var ri {k in RI} = (
	if      (k==1) then x[1,0]
);
 
var xa {k in XA, i in I} = (
	if      (k==1) then x[1,i]
);
 
 
var vcon {k in VC, o in 0..no, i in IC} = (
	if      (k==1) then x[1,i]
);
 
var sw{o in Omega, i in IC diff {nt}, k in 1..nsw} = (
	if      (k==1) then x[1,i]
);

the data file egerstedt.dat

# ------------------------------------
# Data: Egerstedt example from Jung Dissertation
# ------------------------------------
 
# Dimensions, all other 0 by default
param nxd := 2;
param no := 3;
param nre := 2;
param nc :=1;
 
# Algorithmic parameters
param nt := 1200;
param ntperu := 30;
 
# Problem parameters
 
let T := 1.0;
 
 
 
# Initial values control
let {o in Omega, i in IU} wi[o,i] := 1.0;
 
let nplots := 2;
let filename_base := "egerstedt";
for {k in X} { let plotlambda[k] := 2; }
#let {k in X} plotrefx[k] := 3;


and the run file

##############################
model ../mintocPre.mod;
model egerstedt.mod;
model ../mintocPost.mod;
data egerstedt.dat;
##############################
 
let isSOS1 := 1;
let integrator := "explicitEuler";
 
 
 
 
##############################
let integrator := "radau3";
let mode := "Relaxed";
include ../solve.run;
include ../plot1404.run;
include ../storeTrajectory.run;
include ../saveTrajectory.run;
include ../printFrel.run;
include ../printOutput.run;
 
##############################
let mode := "CIA";
include ../solveMILP.run;
let mode := "Simulate";
include ../solve.run;
let filename_ext := "CIA";
include ../plot1404.run;
include ../printOutput.run;