# **********************************************************************************
# * Copyright (c) 2019 Process Systems Engineering (AVT.SVT), RWTH Aachen University
# *
# * This program and the accompanying materials are made available under the
# * terms of the Eclipse Public License 2.0 which is available at
# * http://www.eclipse.org/legal/epl-2.0.
# *
# * SPDX-License-Identifier: EPL-2.0
# *
# * @file problem_growingDatasets_simple.txt
# *
# * @brief File containing an exemplary optimization problem for MAiNGO with growing datasets in ALE syntax
# *
# **********************************************************************************

definitions:
# Optimization variables
real sqrt_slope in [0,5];

# Full dataset
index ndata := 3;
real[ndata] inputData  := (1.0, 1.0, 1.0);
real[ndata] outputData := (1.0, 0.6, 0.0);

# Model functions
real prediction(real input, real optvar) := optvar^2*input;

# Additional variables
real slope() := sqrt_slope^2;

outputs:
# Additional output
slope() "Final slope";

objectivePerData: # Always minimizing
# Objective per data for all data points
forall i in {1 .. ndata} :
    (outputData[i] - prediction(inputData[i],sqrt_slope))^2 = 0;

objective: # Always minimizing
# This objective will only be used when using a fixed dataset (MAiNGO_use_growing_datasets = false)
# It will be overwritten with objectivePerData defined above when using growing datasets
sum(i in {1 .. ndata} : (outputData[i] - prediction(inputData[i],sqrt_slope))^2);